ちょっとしたデータが入ってるだけの Postgres を別ホストに移したかったのでメモ
pg_dump でデータベースをダンプする。
1 | $ pg_dump -h 10.0.0.1 -U postgres -d testdb > testdb.sql |
ダンプした SQL ファイルを psql コマンドで新しいサーバーに流し込む。
1 | $ psql -h 10.0.0.2 -U postgres -d testdb < testdb.sql |
ちょっとしたデータが入ってるだけの Postgres を別ホストに移したかったのでメモ
pg_dump でデータベースをダンプする。
1 | $ pg_dump -h 10.0.0.1 -U postgres -d testdb > testdb.sql |
ダンプした SQL ファイルを psql コマンドで新しいサーバーに流し込む。
1 | $ psql -h 10.0.0.2 -U postgres -d testdb < testdb.sql |