由于配置错误,Postgres autovacuum无法启动

时间:2013-07-08 18:16:21

标签: postgresql autovacuum

我正在尝试在Postgres 9.1实例上重新启用autovacuuming,并在db日志中收到:

2013-07-07 14:47:12 CDT WARNING:  autovacuum not started because of misconfiguration
2013-07-07 14:47:12 CDT HINT:  Enable the "track_counts" option.

似乎很简单。除了这里(我的postgresql.conf文件的相关部分):

...

#track_activities = on
track_counts = on
#track_functions = none         # none, pl, all
#track_activity_query_size = 1024   # (change requires restart)
#update_process_title = on
#stats_temp_directory = 'pg_stat_tmp'

...

autovacuum = on     # Enable autovacuum subprocess?  'on' 
                    # requires track_counts to also be on.
#log_autovacuum_min_duration = -1   # -1 disables, 0 logs all actions and
                    # their durations, > 0 logs only
                    # actions running at least this number
                    # of milliseconds.
autovacuum_max_workers = 5     # max number of autovacuum subprocesses
                    # (change requires restart)
#autovacuum_naptime = 1min      # time between autovacuum runs
#autovacuum_vacuum_threshold = 50   # min number of row updates before
                    # vacuum
#autovacuum_analyze_threshold = 50  # min number of row updates before
                    # analyze
#autovacuum_vacuum_scale_factor = 0.2   # fraction of table size before vacuum
#autovacuum_analyze_scale_factor = 0.1  # fraction of table size before analyze
#autovacuum_freeze_max_age = 200000000  # maximum XID age before forced vacuum
                    # (change requires restart)
#autovacuum_vacuum_cost_delay = 20ms    # default vacuum cost delay for
                    # autovacuum, in milliseconds;
                    # -1 means use vacuum_cost_delay
#autovacuum_vacuum_cost_limit = -1  # default vacuum cost limit for
                    # autovacuum, -1 means use
                    # vacuum_cost_limit

以下是psql在重启后报告的内容:

mydb=# show autovacuum;
 autovacuum 
------------
 on
(1 row)

mydb=# show track_counts;
 track_counts 
--------------
 off
(1 row)

非常感谢任何见解!

2 个答案:

答案 0 :(得分:1)

在进行更改后,您是否重新加载了postgresql.conf文件? 例如,作为超级用户(“postgres”)

select pg_reload_conf();

答案 1 :(得分:1)

仔细检查日志。在您列出的行之前,您是否得到以下这些内容:

LOG:  could not bind socket for statistics collector: Cannot assign requested address
LOG:  disabling statistics collector for lack of working socket

如果是这种情况,请先解决该问题。您最有可能要解决的问题是在/ etc / hosts文件中添加这样的条目:

127.0.0.1 localhost

很可能情况是该文件当前将localhost分配给IPv6,其行如下:

:: 1 localhost ipv6-localhost ipv6-loopback

如果是这种情况,您还需要将该行更改为:

:: 1 ipv6-localhost ipv6-loopback