私はUbuntu 16.04 OSを実行しており、最近提供された指示を使用してpostgresをインストールしました。https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-16-04。
しかし、Postgresを使用しようとすると
snowbell@snowbell-Aspire-4738Z:/var/www$ sudo -i -u postgres
postgres@snowbell-Aspire-4738Z:~$ psql
次のエラーメッセージが表示されます。
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
postgres@snowbell-Aspire-4738Z:~$ sudo -u postgres psql
postgres is not in the sudoers file. This incident will be reported.
このエラーを取り除くために、次のように試しました。
snowbell@snowbell-Aspire-4738Z:~$ sudo -u postgres psql -p 5432 -h 127.0.0.1
その結果、次のエラーが発生します。
psql: could not connect to server: Connection refused
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5432?
どんな手がかりがありますか?
これは Sample_error ファイル blissini です。
ベストアンサー1
コメントで提案された内容をすべて使用した場合、エラー自体はpostgresql
サーバーが起動する前に競合を引き起こす誤った構成に関連している可能性があります。
次のガイドラインに従ってください。
postgresql
サービスが実行されていることを確認するには、次を使用します。sudo service postgresql start
pg_lsclusters
端末で実行- 実行中のクラスタを確認したら、出力は次のようになります。
バージョン - クラスタポートステータス所有者データディレクトリ
9.6 ------- main -- 5432 online postgres /var/lib/postgresql/9.6/main
バージョンとクラスタから情報をコピーして、次のように使用します。
pg_ctlcluster <version> <cluster> start
例:pg_ctlcluster 9.6 main start
問題が発生すると
postgresql
、からアクセスできるログが生成されます/var/log/postgresql/postgresql-<version>-main.log
。例:
2017-07-13 16:53:04 BRT [32176-1] LOG: invalid authentication method "all" 2017-07-13 16:53:04 BRT [32176-2] CONTEXT: line 90 of configuration file "/etc/postgresql/9.5/main/pg_hba.conf" 2017-07-13 16:53:04 BRT [32176-3] FATAL: could not load pg_hba.conf
ログに表示されるエラーが何であれ、修正して次のようにしてpostgresqlサービスを再起動してください。
sudo service postgresql restart