Kntmrkm.new

WEB技術のメモ

OSX PostgreSQL(brew)のアップグレード

brew upgrade後

サービス停止

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

旧バージョンデータの移動

mv /usr/local/var/postgres /usr/local/var/postgres94

PostgreSQL初期化

initdb /usr/local/var/postgres -E utf8

データのmigration

pg_upgrade -b /usr/local/Cellar/postgresql/9.4.5_2/bin -B /usr/local/Cellar/postgresql/9.5.0/bin -d /usr/local/var/postgres94 -D /usr/local/var/postgres

以下のエラーが出る場合

*failure*
Consult the last few lines of "pg_upgrade_server.log" for
the probable cause of the failure.

There seems to be a postmaster servicing the old cluster.
Please shutdown that postmaster and try again.
Failure, exiting

アクティビティモニタ等でpostgresのプロセスを停止しておく。

サービス起動

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