ThingWorx 高可用性 > Pgpool-II を使用した PostgreSQL HA の展開例 > 7. すべてのノードへのストリーミングレプリケーションの検証
7. すべてのノードへのストリーミングレプリケーションの検証
手順 1
node0 で、PostgreSQL サービスを再開始します。
手順 2
node1 で、start_replication スクリプトを使用して node1 を node0 と同期化してから、node1 で PostgreSQL を再起動します。IP アドレス 10.91.9.200 は node0 のアドレスです。
sudo su postgres
/db/bin/start_replication.sh 10.91.9.200
exit
sudo systemctl start postgresql-10.x
手順 3
node2 で、start_replication スクリプトを使用して node2 を node1 と同期化してから、node 2 で PostgreSQL を再起動します。IP アドレス 10.91.9.24 は node1 のアドレスです。
sudo su postgres
/db/bin/start_replication.sh 10.91.9.24
exit
sudo systemctl start postgresql-10.x
手順 4
レプリケーションのステータスをチェックします。
PostgreSQL プロセスのステータスの結果をレビューしてレプリケーションがアクティブであることを確認します。
node0:
[ec2-user@ip-10-91-9-200 ~]$ ps -ef|grep postgres
postgres 837 1 0 14:39 ? 00:00:00 /usr/pgsql-10.x/bin/postgres -D /db/postgres
postgres 863 837 0 14:39 ? 00:00:00 postgres: logger process
postgres 878 837 0 14:39 ? 00:00:00 postgres: checkpointer process
postgres 879 837 0 14:39 ? 00:00:00 postgres: writer process
postgres 880 837 0 14:39 ? 00:00:00 postgres: wal writer process
postgres 881 837 0 14:39 ? 00:00:00 postgres: autovacuum launcher process
postgres 882 837 0 14:39 ? 00:00:00 postgres: archiver process
postgres 883 837 0 14:39 ? 00:00:00 postgres: stats collector process
postgres 910 837 0 14:39 ? 00:00:00 postgres: wal sender process replicator 10.91.9.24(48264) streaming 1A/BC0039A0
node1:
[ec2-user@ip-10-91-9-24 ~]$ ps -ef|grep postgres
postgres 834 1 0 14:39 ? 00:00:00 /usr/pgsql-10.x/bin/postgres -D /db/postgres
postgres 861 834 0 14:39 ? 00:00:00 postgres: logger process
postgres 863 834 0 14:39 ? 00:00:00 postgres: startup process recovering 000000170000001A000000BC
postgres 897 834 0 14:39 ? 00:00:00 postgres: checkpointer process
postgres 898 834 0 14:39 ? 00:00:00 postgres: writer process
postgres 899 834 0 14:39 ? 00:00:00 postgres: stats collector process
postgres 1236 834 0 14:39 ? 00:00:00 postgres: wal sender process replicator 10.91.9.41(48620) streaming 1A/BC0039A0
postgres 1279 834 0 14:39 ? 00:00:05 postgres: wal receiver
node2:
[ec2-user@ip-10-91-9-41 ~]$ ps -ef|grep postgres
postgres 837 1 0 14:39 ? 00:00:00 /usr/pgsql-10.x/bin/postgres -D /db/postgres
postgres 859 837 0 14:39 ? 00:00:00 postgres: logger process
postgres 860 837 0 14:39 ? 00:00:00 postgres: startup process recovering 000000170000001A000000BC
postgres 887 837 0 14:39 ? 00:00:00 postgres: checkpointer process
postgres 888 837 0 14:39 ? 00:00:00 postgres: writer process
postgres 889 837 0 14:39 ? 00:00:00 postgres: stats collector process
postgres 890 837 0 14:39 ? 00:00:07 postgres: wal receiver
上記のプロセスステータスから、以下の点に注目してレプリケーションが正常に行われていることを確認します。
node0 に 1 つの sender プロセスがあり、レプリケーションターゲットは 10.91.9.24 (node1) である。
node1 に 1 つの sender プロセスと 1 つの receiver プロセスがある。
node2 には receiver プロセスが 1 つだけある。
3 つのノードすべてがストリーム 1A/BC0039A0 で同期化される