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

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

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

ご注意

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

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

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

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

 

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

[postgres@xxxxxx ~]$ pg_dump -b -Fc -f chatlkdb.pgdmp chatlkdb
[postgres@xxxxxx ~]$ pg_dump -b -Fc -f chatladdb.pgdmp chatladdb
[postgres@xxxxxx ~]$

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

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

2-1.postgresユーザーで、PostgreSQL 11に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 (11.10)
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.6から11への移行は完了です。

 

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

 

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