データのPostgreSQL 9.3から9.6への移行

データのPostgreSQL 9.3から9.6への移行についての説明です。

ここではChatLuckのデータをPostgreSQL 9.3から9.6に移行する手順を説明します。

ご注意

PostgreSQL 9.3のデータを取得したあとに登録されたメッセージ等のデータは、PostgreSQL 9.6に引き継がれません。

1.PostgreSQL 9.3からのデータの取得

1-1. suコマンドにて、rootユーザーからpostgresユーザーにスイッチしてください。

[root@xxxxxx start-scripts]# su - postgres
[postgres@xxxxxx ~]$

 

1-2. pg_dumpコマンドを使用し、ChatLuckデータベースのダンプとログ収集用データベースのダンプを取得します。
ダンプの取得には、お使いのハードウェアスペックとデータ量により時間がかかることがありますので、完了までお待ちください。

[postgres@xxxxxx ~]$ pg_dump -C -Fc -f chatlkdb.pgdmp -E UTF8 chatlkdb
[postgres@xxxxxx ~]$ pg_dump -C -Fc -f chatladdb.pgdmp -E UTF8 chatladdb
[postgres@xxxxxx ~]$

2. PostgreSQL 9.6へのデータの移行

※本インストール手順に従ってPostgreSQL 9.6を構成している場合、パスワードは「postgres」です。

2-1.postgresユーザーで、PostgreSQL 9.6にChatLuck用のデータベースロールを作成します。

[postgres@xxxxxx ~]$ psql -p 5433 -d template1 -c "CREATE USER chatlk WITH PASSWORD 'chatlk' CREATEROLE"
Password:
CREATE ROLE
[postgres@xxxxxx ~]$

2-2.pg_restoreコマンドを使用し、ChatLuckデータベースとログ収集用データベースを作成します。
データベースの作成には、お使いのハードウェアスペックとデータ量により時間がかかることがありますので、完了までお待ちください。

[postgres@xxxxxx ~]$ pg_restore -p 5433 -C -Fc -d template1 chatlkdb.pgdmp
Password:
[postgres@xxxxxx ~]$ pg_restore -p 5433 -C -Fc -d template1 chatladdb.pgdmp
Password:
[postgres@xxxxxx ~]$

2-3.ログ収集用データベースのChatLuck用データベースへの接続情報を更新します。

[postgres@xxxxxx ~]$ psql -p 5433 -d chatladdb
Password:
psql (9.6.5)
Type "help" for help.

chatladdb=# alter server chatdbfdw options (set port '5433');
ALTER SERVER
chatladdb=# \q
[postgres@xxxxxx ~]$ exit
[root@xxxxxx start-scripts]# cd ~
[root@xxxxxx ~]#

 

以上で、データのPostgreSQL 9.3から9.6への移行は完了です。

 

続いて『ChatLuckの更新』を行います。

 

記載の製品名および商品名は、各社の商標、または登録商標です。