每次我重新启动我的 Kali 机器时,我的 postgresql 服务都无法正常启动。有一段时间我不知道它是什么,但我很快发现这个目录和文件一直被删除。
/var/run/postgresql/10-main.pg_stat_tmp/global.stat
跑完之后,
mkdir /var/run/postgresql/10-main.pg_stat_tmp
touch global.stat
我现在可以成功启动服务了。
但是,这是我的 postgresql.log 的输出。
2018-01-29 16:46:03.278 UTC [1890] WARNING: corrupted statistics file
"/var/run/postgresql/10-main.pg_stat_tmp/global.stat"
2018-01-29 16:46:03.289 UTC [1890] WARNING: corrupted statistics file
"/var/run/postgresql/10-main.pg_stat_tmp/global.stat"
2018-01-29 16:46:03.299 UTC [1890] WARNING: corrupted statistics file
"/var/run/postgresql/10-main.pg_stat_tmp/global.stat"
2018-01-29 16:46:03.310 UTC [1890] WARNING: corrupted statistics file
"/var/run/postgresql/10-main.pg_stat_tmp/global.stat"
2018-01-29 16:46:03.322 UTC [1890] WARNING: corrupted statistics file
"/var/run/postgresql/10-main.pg_stat_tmp/global.stat"
2018-01-29 16:46:03.333 UTC [1890] WARNING: corrupted statistics file
"/var/run/postgresql/10-main.pg_stat_tmp/global.stat"
2018-01-29 16:46:03.343 UTC [1890] LOG: using stale statistics instead of
current ones because stats collector is not responding
2018-01-29 16:46:03.343 UTC [1890] WARNING: corrupted statistics file
"/var/run/postgresql/10-main.pg_stat_tmp/global.stat"
2018-01-29 16:46:35.896 UTC [1885] LOG: received smart shutdown request
2018-01-29 16:46:38.988 UTC [1885] LOG: worker process: logical replication
launcher (PID 1892) exited with exit code 1
2018-01-29 16:46:38.990 UTC [1887] LOG: shutting down
2018-01-29 16:46:39.125 UTC [1885] LOG: database system is shut down
这就是 postgresql.conf 里面的内容
# The default values of these variables are driven from the -D command-line
# option or PGDATA environment variable, represented here as ConfigDir.
data_directory = '/var/lib/postgresql/10/main' # use data in another
directory
# (change requires restart)
hba_file = '/etc/postgresql/10/main/pg_hba.conf' # host-based
authentication file
# (change requires restart)
ident_file = '/etc/postgresql/10/main/pg_ident.conf' # ident
configuration file
# (change requires restart)
这是 Postgres 版本 10。
在 VMware 上运行的 Linux Kali 4.14.0-kali3-686-pae (2018-01-25) i686 GNU/Linux