LoginSignup
0
0

More than 1 year has passed since last update.

postgresが動かなくなった2

Last updated at Posted at 2019-04-25

ruby会議2019にて気になったrabbitをインストールしたところ、開発中のシステムが動かなくなった!
いやrabbitのせいじゃないんだけどw

lib/pg.rb:56:in `initialize': could not connect to server: Connection refused (PG::ConnectionBad)
	Is the server running on host "localhost" (::1) and accepting
	TCP/IP connections on port 5432?
could not connect to server: Connection refused
	Is the server running on host "localhost" (127.0.0.1) and accepting
	TCP/IP connections on port 5432?

過去に色々試したpostgres復活の呪文も何も通らず、、、
ただ1つだけ気になるメッセージ発見

$ pg_ctl -D /usr/local/var/postgres start
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib
  Referenced from: /usr/local/Cellar/postgresql/10.5/bin/postgres
  Reason: image not found
no data was returned by command ""/usr/local/Cellar/postgresql/10.5/bin/postgres" -V"
The program "postgres" is needed by pg_ctl but was not found in the
same directory as "/usr/local/Cellar/postgresql/10.5/bin/pg_ctl".
Check your installation.

/usr/local/opt/icu4c/lib/libicui18n.62.dylib
がロードできないよーと

最終的にはこちらの記事のおかげで解決

$ brew switch icu4c 62.1
Cleaning /usr/local/Cellar/icu4c/64.2
Cleaning /usr/local/Cellar/icu4c/62.1
Cleaning /usr/local/Cellar/icu4c/59.1
Opt link created for /usr/local/Cellar/icu4c/62.1

たぶん64.2が勝手にインストールされて、そっちを参照するようになってしまったものを62.1を見るようにスイッチしたんでしょう!

よかったー


2023/01/17 追記

システムのRubyバージョンアップ(かなり大型)に備えて、brew update して、rbenvを更新して、Rubyをいくつかインストール
その日は特に問題なかったのだが、、、

翌日postgresに接続できなくなった
エラーは上記とほぼ同じなんだけど、brew switch がエラーになった

そこでログをよくみてみたら、新しくアクセスしようとしていたのが
postgresql@14
元々は
postgresql@12
だったはず

$ brew services list

でインストールされているサービスを確認し、

brew services start postgresql@12

で無事起動

ただし今まで使っていたDBが全部消えてた・・・
次回から brew update する前にはバックアップを取っておこう。。。

0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0