読者です 読者をやめる 読者になる 読者になる

DRYな備忘録

Don't Repeat Yourself.

MacでPostgresの停止

postgresql

いろいろやったけど結局これでした

launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

ログ

% pg_ctl stop
pg_ctl: no database directory specified and environment variable PGDATA unset

oh...

% pg_ctl stop -D /usr/local/var/postgres
waiting for server to shut down............................................................... failed
pg_ctl: server does not shut down
HINT: The "-m fast" option immediately disconnects sessions rather than
waiting for session-initiated disconnection.

oh...

liblog.seesaa.net

ユーザが接続してるのか

% pg_ctl stop -D /usr/local/var/postgres -m fast
waiting for server to shut down............................................................... failed
pg_ctl: server does not shut down

もうちょいなんか言えよ理由とか

killだ

% pg_ctl status -D /usr/local/var/postgres
pg_ctl: server is running (PID: 96268)
/usr/local/Cellar/postgresql/9.4.5_2/bin/postgres "-D" "/usr/local/var/postgres" "-r" "/usr/local/var/postgres/server.log"
% pg_ctl kill QUIT 96268
% pg_ctl status -D /usr/local/var/postgres
pg_ctl: server is running (PID: 96301)
/usr/local/Cellar/postgresql/9.4.5_2/bin/postgres "-D" "/usr/local/var/postgres" "-r" "/usr/local/var/postgres/server.log"

なんだこの復活劇

まじで殺す

% brew uninstall postgres
Uninstalling /usr/local/Cellar/postgresql/9.4.5_2... (3021 files, 40M)
% ps aux | grep postgres
otiai10         96362   0.0  0.0  2432772    668 s002  S+    3:52PM   0:00.00 grep postgres
otiai10         96337   0.0  0.0  2487700    644   ??  Ss    3:52PM   0:00.00 postgres: stats collector process
otiai10         96336   0.0  0.0  2623340   1480   ??  Ss    3:52PM   0:00.00 postgres: autovacuum launcher process
otiai10         96335   0.0  0.0  2631532    768   ??  Ss    3:52PM   0:00.00 postgres: wal writer process
otiai10         96334   0.0  0.0  2623340   1132   ??  Ss    3:52PM   0:00.01 postgres: writer process
otiai10         96333   0.0  0.0  2623340    824   ??  Ss    3:52PM   0:00.00 postgres: checkpointer process
otiai10         96331   0.0  0.1  2623340  14704   ??  S     3:52PM   0:00.03 /usr/local/opt/postgresql/bin/postgres -D /usr/local/var/postgres -r /usr/local/var/postgres/server.log
% pkill postgres
% ps aux | grep postgres
otiai10         96366   0.0  0.0  2432772    656 s002  R+    3:52PM   0:00.00 grep postgres
%

brew install postgres したら同じ現象。Macのlaunchctlとかでは

hack.aipo.com

launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

なおった

広告を非表示にする