在CentOS7上安装和配置Postgres 9.5.

我正在尝试做某件事,并发现了https://qiita.com/SOJO/items/a1d97887d24c3e44596f,但是我发现它与我的环境不同,所以我写下了我所做的事情和错误消息,以便对后来的学习有所帮助。(๑•̀ㅁ•́๑)✧

尽管现状需要重新进行某些调整(在底部进行注明),但是重新启动。

[root@localhost ~]# systemctl restart postgresql-9.5
Job for postgresql-9.5.service failed because the control process exited with error code. See "systemctl status postgresql-9.5.service" and "journalctl -xe" for details.

当收到错误提示后,我查看了状态。

[root@localhost ~]# systemctl status postgresql-9.5
● postgresql-9.5.service - PostgreSQL 9.5 database server
   Loaded: loaded (/usr/lib/systemd/system/postgresql-9.5.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since 金 2019-04-19 09:46:06 JST; 12min ago
     Docs: https://www.postgresql.org/docs/9.5/static/
  Process: 32816 ExecStop=/usr/pgsql-9.5/bin/pg_ctl stop -D ${PGDATA} -s -m fast (code=exited, status=0/SUCCESS)
  Process: 33172 ExecStart=/usr/pgsql-9.5/bin/pg_ctl start -D ${PGDATA} -s -w -t 300 (code=exited, status=1/FAILURE)
  Process: 33167 ExecStartPre=/usr/pgsql-9.5/bin/postgresql95-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
 Main PID: 32098 (code=exited, status=0/SUCCESS)

 4月 19 09:46:05 localhost.localdomain systemd[1]: Starting PostgreSQL 9.5 database server...
 4月 19 09:46:05 localhost.localdomain pg_ctl[33172]: < 2019-04-19 09:46:05.897 JST >LOG:  ログ出力をログ収集プロセスにリダイレクトしています
 4月 19 09:46:05 localhost.localdomain pg_ctl[33172]: < 2019-04-19 09:46:05.897 JST >ヒント:  ここからのログ出力はディレクトリ"pg_log"に現れます。
 4月 19 09:46:06 localhost.localdomain systemd[1]: postgresql-9.5.service: control process exited, code=exited status=1
 4月 19 09:46:06 localhost.localdomain systemd[1]: Failed to start PostgreSQL 9.5 database server.
 4月 19 09:46:06 localhost.localdomain systemd[1]: Unit postgresql-9.5.service entered failed state.
 4月 19 09:46:06 localhost.localdomain systemd[1]: postgresql-9.5.service failed.

看起来无法正常工作……

后来的感觉好像是之前设定的一样。

yum -y install postgresql95-server postgresql95-devel postgresql95-contrib
/usr/pgsql-9.5/bin/postgresql95-setup initdb  (初期設定)
systemctl enable postgresql-9.5
systemctl start postgresql-9.5         (postgresqlの起動設定)

firewall-cmd --permanent --add-service=postgresql(postgresqlを許可)
firewall-cmd --permanent --add-port=15432/tcp  (ポート15432を許可)
firewall-cmd --reload              (パラメータのリロード)
firewall-cmd --list-all             (確認)
systemctl restart firewalld            (FWの再起動)

打开/var/lib/pgsql/9.5/data/pg_hba.conf文件(在终端中使用vi命令)。

#
listen_addresses = '*'
port=15432
timezone='UTC'
#
host all all 0.0.0.0/0 trust

我以为我做到了……

要不要从头开始安装并确认呢?

bannerAds