web-dev-qa-db-ja.com

PostgreSQLはTCP / IPソケットのMavericksを作成できませんでした

私は醸造を通してインストールしています。

エラーメッセージ:

電話するとき

postgres

エラーが表示されます

LOG:  could not bind IPv6 socket: Address already in use
HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
LOG:  could not bind IPv4 socket: Address already in use
HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and  retry.
LOG:  could not bind IPv6 socket: Address already in use
HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
WARNING:  could not create listen socket for "localhost"
FATAL:  could not create any TCP/IP sockets

ランニング

postgres -D /usr/local/var/postgres

同じエラーを作成します

createdb

パスワードの入力を2回求められ、

createdb: could not connect to database template1: FATAL:  password authentication failed for user "thomasmurphy"

私が試したこと* pg gemのアンインストールと再インストール、postgresのアンインストールと再インストール*コマンドラインツールの更新*すべてのbrew doctorのニーズを満たす* pg_hba.confの権限の編集* .bash_profileの編集

Postgresを仕事用のコンピューターとMavericksで完全に実行しているので、これはEdgeケースのように感じます。これを解決するために他にどのようなベクターを突き刺すことができますか?

14
Thomas Murphy

発生しているエラーは、PostgreSQLが実行されているためです。どうやって知るの?パスワードを拒否しているためです。それはかなり明確です。

今、あなたの本当の問題は、信頼できるアクセスを与えるためにpg_hba.confを変更した後にPostgreSQLを再起動する必要があることでしょう。次に、次のことができます。

 ALTER USER foo WITH PASSWORD 'bar';

PostgreSQLの起動と再起動については、次の質問を参照してください。 Mac OS XでPostgreSQLサーバーを起動する方法

6
Chris Travers

あなたが得たエラーはあなたのホストが壊れているためです。 /etc/hostsファイルを確認してください。

ホストの最初の行に127.0.0.1 localhostを置きます。

14
gpxlcj

Linux:コマンドラインでifconfigを実行して、ループバックインターフェイスが起動していることを確認します。稼働していない場合は、/sbin/ifconfig lo 127.0.0.1表示します。

4
kazou

この場合、チェックするシナリオと場所は複数あります。これが原因で一度迷子になった。通常のデフォルトのhostsファイルは次のようになります。

[root@localmachine ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

localhostが解決できることを確認するには、pingを使用してテストします。

[root@localmachine ~]# ping localhost

cat /etc/nsswitch.conf|grep hostsを確認し、filesが存在することを確認します。

#     hosts: files dns
#     hosts: files dns  # from user file
#hosts:     db files nisplus nis dns
hosts:     files mdns4_minimal [NOTFOUND=return] dns myhostname

/etc/hostsファイルの権限を確認します。644である必要があります(すべてのプロセス/ユーザーが読み取り可能 `):

[root@localmachine ~]# ls -al /etc/hosts
-rw-r--r--. 1 root root 240 Aug 14 08:04 /etc/hosts

十分な時間がある人のために、ここに詳細なブログ投稿を作成しました: https://coffeewithbytes.com/blog/postgres-hostsfile-permissions/

どのようにチェックして結論に至ったかについて述べました。

0
Anto

/etc/hostsが壊れているとは限りません。 localhost、---のDNSルックアップを壊す別の何かかもしれません正しい行が/etc/hostsにある場合でも

nslookup localhostを確認し、結果として127.0.0.1が表示されるかどうかを確認します。 getent hosts localhostでも確認してください。これらも確認してくださいユーザーPostgresが実行されているため

0
Wildcard