我的Openshift Online盒带上有Postgres 9.2。使用Pgadmin3,我已经为postgresql.conf启用了autovuum设置(通过勾选复选框)。然而,autovacuum似乎没有运行。
这是我所拥有的:
-
ps -ef | grep -i vacuum
没有显示自动真空过程。 -
使用psql控制台,
show autovacuum
,表示其值为ON -
使用psql控制台,
SELECT schemaname, relname, last_vacuum, last_autovacuum from FROM pg_stat_user_tables;
在last_vacuum和last_autovacuum列中没有给出值,尽管我使用pgadmin3通过维护功能手动执行了真空操作。 -
pgAdminIII中数据库上的属性选项卡显示AUTOVACUUM值为"未运行"
我想念什么?
编辑
当我试图在服务器上查找文件时,我也无法访问Openshift Online上的postgresql.conf,希望手动编辑文件,而不是使用pgAdminIII
--找到这个https://www.openshift.com/forums/openshift/how-do-i-set-maxpreparedtransactions-on-my-postgresql-cartridge
,我现在可以查看/编辑我的postgresql.conf了。显然,autovacuum已经打开了,所以conf的设置是正确的。
当发布pg_ctl restart -m fast
时,我得到了
LOG: could not bind socket for statistics collector: Permission denied
LOG: trying another address for the statistics collector
LOG: could not bind socket for statistics collector: Permission denied
LOG: trying another address for the statistics collector
LOG: could not bind socket for statistics collector: Cannot assign requested address LOG: trying another address for the statistics collector
LOG: could not bind socket for statistics collector: Cannot assign requested address LOG: disabling statistics collector for lack of working socket
WARNING: autovacuum not started because of misconfiguration
HINT: Enable the "track_counts" option.
LOG: database system was shut down at 2014-04-22 09:58:19 GMT
LOG: database system is ready to accept connections
尽管在postgresql.conf 中track_counts
已设置为打开
很抱歉你这么愚蠢,但我们非常感谢你的帮助或建议。提前谢谢。
我遇到了类似的问题,并在这次讨论中找到了一个有用的提示:
由于一些疯狂的原因,openshit禁用了localhost,而autovacuum只连接到localhost,我想他们不想尝试清空远程数据库是有道理的。。。但是openshit打破了自动真空。
我发现的一个解决方案(我可能会使用)是手动添加一个执行强制真空的cronjob。这是一个看起来很有前景的批处理脚本,但要小心强制真空可能带来的副作用(当然取决于你的应用程序)。
修补postgres以使用OPENSHIFT_PG_HOST
环境变量而不是localhost
似乎可以解决问题:pgstat.patch.