PostgreSQL-9.0 で、プライマリサーバ 1 台にホットスタンバイサーバ 2 台を追加し、プライマリが死んだことを想定してホットスタンバイからプライマリへ昇格するところまでをやってみます。CentOS-5.5 を利用します。Twitter で @bose999 とやりあっていて、どうも自分の理解 (特に、WAL アーカイブと SR の関係) があいまいでしたので。
以下の 3 台で構成します。非同期のレプリケーションでは、障害復旧後のスイッチバックは現実的ではないので、スイッチしたらそのまま運用します。そのため、”master”, “active”, “primary” や “slave”, “standby” といった、クラスタ内での役割を表す名前はつけない方が良いと思います。
- node1.priv (192.168.1.24/24): 最初のプライマリ
- node2.priv (192.168.1.27/24): ホットスタンバイ。node1 障害後のプライマリ
- node3.priv (192.168.1.30/24): ホットスタンバイ
インストール
CentOS 用のパッケージを、yum でインストールします。
上記サイトから、最新の、yum 設定ファイルの RPM をインストールしてください。
[root@node1 ~]# rpm \
-Uvh http://www.pgrpms.org/reporpms/9.0/pgdg-centos-9.0-2.noarch.rpm
http://www.pgrpms.org/reporpms/9.0/pgdg-centos-9.0-2.noarch.rpm を取得中
警告: /var/tmp/rpm-xfer.gb5Tw9: ヘッダ V3 DSA signature: NOKEY, key ID 442df0f8
準備中... ########################################### [100%]
1:pgdg-centos ########################################### [100%]
[root@node1 ~]# yum install -y postgresql90 postgresql90-server
(中略)
Installed:
postgresql90.x86_64 0:9.0.0-1PGDG.rhel5
postgresql90-server.x86_64 0:9.0.0-1PGDG.rhel5
Dependency Installed:
postgresql90-libs.x86_64 0:9.0.0-1PGDG.rhel5
Complete!
[root@node1 ~]#
postgresql90 のクライアントは、alternatives を使っているのでパスが通っています。postgresql90-server のコマンドへはパスが通っていませんので、パスを通すなりフルパスで指定するなりが必要です。
一台目を、普通にセットアップ
まずは、普通に (ストリーミングレプリケーションとホットスタンバイのことを考慮せずに) セットアップを行ないます。当座は、ホットスタンバイによる負荷分散が不要で、1 台で運用するという想定です。今回は、システムの init のサービススクリプトを用いずに、postgres ユーザが自前でサービスを用意します。それ以外は一般的な設定だと思いますので、サラッと流します。
- ユーザ・グループ: postgres.postgres
- DB クラスタのディレクトリ: /pgdata/
- WAL アーカイブ先: /backup/walarch/
- 週一での物理バックアップ先: /backup/pgdata/
以下の設定では、レプリケーションへの流れがあるため、バックアップ (障害対策と PITR のため) については考慮していますが、性能チューニングやセキュリティについては考慮していません。
[root@node1 ~]# mkdir -m 0700 -p /pgdata/ /backup/ \
/backup/walarch/ /backup/pgdata/
[root@node1 ~]# chown postgres.postgres /pgdata/ /backup/ \
/backup/walarch/ /backup/pgdata/
[root@node1 ~]# iptables -I INPUT -p tcp --dport 5432 -j ACCEPT
[root@node1 ~]# service iptables save
ファイアウォールのルールを /etc/sysconfig/iptables に保存中[ OK ]
[root@node1 ~]# su - postgres
-bash-3.2$ /usr/pgsql-9.0/bin/initdb -D /pgdata/ --encoding=UTF-8 \
--no-locale --username=admin --pwprompt --auth=md5
データベースシステム内のファイルの所有者は"postgres"ユーザでした。
このユーザがサーバプロセスを所有しなければなりません。
データベースクラスタはロケールCで初期化されます。
デフォルトのテキスト検索設定はenglishに設定されました。
ディレクトリ/pgdataの権限を設定しています ... ok
サブディレクトリを作成しています ... ok
デフォルトのmax_connectionsを選択しています ... 100
デフォルトの shared_buffers を選択しています ... 32MB
設定ファイルを作成しています ... ok
/pgdata/base/1にtemplate1データベースを作成しています ... ok
pg_authidを初期化しています ... ok
新しいスーパーユーザのパスワードを入力してください:<パスワード>
再入力してください:<パスワード>
パスワードを設定しています ... ok
依存関係を初期化しています ... ok
システムビューを作成しています ... ok
システムオブジェクトの定義をロードしています ... ok
変換を作成しています ... ok
ディレクトリを作成しています ... ok
組み込みオブジェクトに権限を設定しています ... ok
情報スキーマを作成しています ... ok
PL/pgSQL サーバサイド言語をロードしています ...ok
template1データベースをバキュームしています ... ok
template1からtemplate0へコピーしています ... ok
template1からpostgresへコピーしています ... ok
成功しました。以下を使用してデータベースサーバを起動することができます。
/usr/pgsql-9.0/bin/postmaster -D /pgdata
または
/usr/pgsql-9.0/bin/pg_ctl -D /pgdata -l logfile start
-bash-3.2$ cp /pgdata/postgresql.conf /pgdata/postgresql.conf.orig
-bash-3.2$ vi /pgdata/postgresql.conf
-bash-3.2$ diff -uNr /pgdata/postgresql.conf.orig /pgdata/postgresql.conf
--- /pgdata/postgresql.conf.orig 2010-09-26 16:51:35.000000000 +0900
+++ /pgdata/postgresql.conf 2010-09-26 16:52:56.000000000 +0900
@@ -56,7 +56,7 @@
# - Connection Settings -
-#listen_addresses = 'localhost' # what IP address(es) to listen on;
+listen_addresses = '*' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost', '*' = all
# (change requires restart)
@@ -150,7 +150,7 @@
# - Settings -
-#wal_level = minimal # minimal, archive, or hot_standby
+wal_level = archive # minimal, archive, or hot_standby
#fsync = on # turns forced synchronization on or off
#synchronous_commit = on # immediate fsync at commit
#wal_sync_method = fsync # the default is the first option
@@ -177,10 +177,11 @@
# - Archiving -
-#archive_mode = off # allows archiving to be done
+archive_mode = on # allows archiving to be done
# (change requires restart)
-#archive_command = '' # command to use to archive a logfile segment
-#archive_timeout = 0 # force a logfile segment switch after this
+archive_command = 'rsync -a %p /backup/walarch/%f'
+ # command to use to archive a logfile segment
+archive_timeout = 3600 # force a logfile segment switch after this
# number of seconds; 0 disables
# - Streaming Replication -
-bash-3.2$ cp /pgdata/pg_hba.conf /pgdata/pg_hba.conf.orig
-bash-3.2$ vi /pgdata/pg_hba.conf
-bash-3.2$ diff -uNr /pgdata/pg_hba.conf.orig /pgdata/pg_hba.conf
--- /pgdata/pg_hba.conf.orig 2010-09-26 13:51:48.000000000 +0900
+++ /pgdata/pg_hba.conf 2010-09-26 13:52:30.000000000 +0900
@@ -76,5 +76,6 @@
local all all md5
# IPv4 local connections:
host all all 127.0.0.1/32 md5
+host all all 192.168.1.0/24 md5
# IPv6 local connections:
host all all ::1/128 md5
-bash-3.2$ /usr/pgsql-9.0/bin/pg_ctl -D /pgdata/ start
サーバは起動中です。
-bash-3.2$ touch ~/.pgpass
-bash-3.2$ chmod 0600 ~/.pgpass
-bash-3.2$ echo "localhost:*:*:admin:admin" >> ~/.pgpass
-bash-3.2$ createdb -U admin reptest
-bash-3.2$ psql -U admin reptest
psql (9.0.0)
"help" でヘルプを表示します.
reptest=# \q
-bash-3.2$
インスタンス起動を永続化しておきます。”crontab -e” を実行し、以下を追加します。”@reboot” は、最近めの cron でないとサポートしていないかも知れませんので、man で見ておいてください。
@reboot /usr/pgsql-9.0/bin/pg_ctl -D /pgdata/ start
これでは WAL のアーカイブがたまり続けますので、10 日 (240 時間) より古いものは消して行くように設定します。”crontab -e” を実行し、以下を追加します。
0 5 * * * /usr/bin/tmpwatch 240 /backup/walarch/
定期的な物理バックアップ用のスクリプトを作成します。
-bash-3.2$ touch /pgdata/backup-pgdata
-bash-3.2$ chmod +x /pgdata/backup-pgdata
-bash-3.2$ vi /pgdata/backup-pgdata
-bash-3.2$ cat /pgdata/backup-pgdata
#!/bin/sh
rm -fr /backup/pgdata.new/
psql -U admin -c "select pg_start_backup('$(date +%Y%m%d%H%M)')" template1 &&
sleep 5 && \
rsync -ar --link-dest=/backup/pgdata/ /pgdata/ /backup/pgdata.new/ &&
mv /backup/pgdata /backup/pgdata.old && \
mv /backup/pgdata.new/ /backup/pgdata/ && rm -fr /backup/pgdata.old
psql -U admin -c "select pg_stop_backup()" template1
-bash-3.2$ /pgdata/backup-pgdata
pg_start_backup
-----------------
0/7000020
(1 行)
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
pg_stop_backup
----------------
0/70000A0
(1 行)
-bash-3.2$
バックアップを、週に一回定期実行します。”crontab -e” を実行し、以下を追加します。
0 5 * * 0 /pgdata/backup-pgdata
crontab は、全体で以下のようになっているかと思います。
-bash-3.2$ crontab -l
@reboot /usr/pgsql-9.0/bin/pg_ctl -D /pgdata/ start
0 5 * * * /usr/bin/tmpwatch 240 /backup/walarch/
0 5 * * 0 /pgdata/backup-pgdata
-bash-3.2$
以上の設定で、キャパシティが一杯になるまでは 1 台で運用していた、という設定で次へ行きます。
1 台目のサーバをプライマリ化
キャパシティが厳しくなってきたので、ホットスタンバイ サーバを追加するとことにします。
まずは、後ほどホットスタンバイ側から DB アカウントでパスワードなしの SSH ログインする必要がでてきますので、もしまだ存在しないようでしたら、RSA キー登録のために必要なパスワードとキーチェーン ファイルを用意しておきます。
[root@node1 ~]# passwd postgres
Changing password for user postgres.
New UNIX password:<パスワード>
Retype new UNIX password:<パスワード>
passwd: all authentication tokens updated successfully.
[root@node1 ~]# su - postgres
-bash-3.2$ mkdir ~/.ssh/
-bash-3.2$ chmod 0700 ~/.ssh/
-bash-3.2$ touch ~/.ssh/authorized_keys
-bash-3.2$ chmod 0600 ~/.ssh/authorized_keys
-bash-3.2$
ストリーミングレプリケーションのプライマリとして働くように設定を変更し、設定を反映させるために再起動します。
-bash-3.2$ cp /pgdata/postgresql.conf /pgdata/postgresql.conf.orig2
-bash-3.2$ vi /pgdata/postgresql.conf
-bash-3.2$ diff -uNr /pgdata/postgresql.conf.orig2 /pgdata/postgresql.conf
--- /pgdata/postgresql.conf.orig2 2010-09-26 14:39:18.000000000 +0900
+++ /pgdata/postgresql.conf 2010-09-26 14:42:54.000000000 +0900
@@ -150,7 +150,7 @@
# - Settings -
-wal_level = archive # minimal, archive, or hot_standby
+wal_level = hot_standby # minimal, archive, or hot_standby
#fsync = on # turns forced synchronization on or off
#synchronous_commit = on # immediate fsync at commit
#wal_sync_method = fsync # the default is the first option
@@ -186,14 +186,14 @@
# - Streaming Replication -
-#max_wal_senders = 0 # max number of walsender processes
+max_wal_senders = 10 # max number of walsender processes
#wal_sender_delay = 200ms # walsender cycle time, 1-10000 milliseconds
#wal_keep_segments = 0 # in logfile segments, 16MB each; 0 disables
#vacuum_defer_cleanup_age = 0 # number of xacts by which cleanup is delayed
# - Standby Servers -
-#hot_standby = off # "on" allows queries during recovery
+hot_standby = on # "on" allows queries during recovery
#max_standby_archive_delay = 30s # max delay before canceling queries
# when reading WAL from archive;
# -1 allows indefinite delay
-bash-3.2$ cp /pgdata/pg_hba.conf /pgdata/pg_hba.conf.orig2
-bash-3.2$ vi /pgdata/pg_hba.conf
-bash-3.2$ diff -uNr /pgdata/pg_hba.conf.orig2 /pgdata/pg_hba.conf
--- /pgdata/pg_hba.conf.orig2 2010-09-26 14:44:01.000000000 +0900
+++ /pgdata/pg_hba.conf 2010-09-26 14:45:02.000000000 +0900
@@ -79,3 +79,5 @@
host all all 192.168.1.0/24 md5
# IPv6 local connections:
host all all ::1/128 md5
+
+host replication admin 192.168.1.0/24 md5
-bash-3.2$ /usr/pgsql-9.0/bin/pg_ctl -D /pgdata/ restart
サーバ停止処理の完了を待っています....完了
サーバは停止しました
サーバは起動中です。
-bash-3.2$
ホットスタンバイ追加のたびに作成するのは面倒なので、ホットスタンバイ サーバ共通の recovery.conf を事前に作っておきます。
-bash-3.2$ cp /usr/pgsql-9.0/share/recovery.conf.sample \
/pgdata/recovery.conf.hotstby
-bash-3.2$ vi /pgdata/recovery.conf.hotstby
-bash-3.2$ diff -uNr \
/usr/pgsql-9.0/share/recovery.conf.sample /pgdata/recovery.conf.hotstby
--- /usr/pgsql-9.0/share/recovery.conf.sample 2010-09-17 23:12:06.000000000 +0900
+++ /pgdata/recovery.conf.hotstby 2010-09-26 17:18:13.000000000 +0900
@@ -43,7 +43,7 @@
# NOTE that the basename of %p will be different from %f; do not
# expect them to be interchangeable.
#
-#restore_command = '' # e.g. 'cp /mnt/server/archivedir/%f %p'
+restore_command = 'cp /backup/walarch/%f %p'
#
#
# archive_cleanup_command
@@ -95,9 +95,9 @@
# connection settings primary_conninfo, and receives XLOG records
# continuously.
#
-#standby_mode = 'off'
-#
-#primary_conninfo = '' # e.g. 'host=localhost port=5432'
+standby_mode = 'on'
+
+primary_conninfo = 'host=node1.priv port=5432 user=admin password=admin'
#
#
# By default, a standby server keeps streaming XLOG records from the
@@ -106,7 +106,7 @@
# Server will poll the trigger file path periodically and stop streaming
# when it's found.
#
-#trigger_file = ''
+trigger_file = '/var/lib/pgsql/trigger'
#
#---------------------------------------------------------------------------
# HOT STANDBY PARAMETERS
-bash-3.2$
“wal_mode = archive” で作成された WAL を一掃してから、一度バックアップを取得します。これが、スタンバイ サーバのベースとなります。
-bash-3.2$ rm -f /backup/walarch/*
-bash-3.2$ /pgdata/backup-pgdata
pg_start_backup
-----------------
0/A000020
(1 行)
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
pg_stop_backup
----------------
0/A0000A0
(1 行)
-bash-3.2$
ホットスタンバイを追加
プライマリの「インストール」と同様にして、”postgresql90″ と “postgresql90-server” をインストールします。
[root@node2 ~]# rpm \
-Uvh http://www.pgrpms.org/reporpms/9.0/pgdg-centos-9.0-2.noarch.rpm
[root@node2 ~]# yum install -y postgresql90-server
(中略)
Installed:
postgresql90-server.x86_64 0:9.0.0-1PGDG.rhel5
Dependency Installed:
postgresql90.x86_64 0:9.0.0-1PGDG.rhel5
postgresql90-libs.x86_64 0:9.0.0-1PGDG.rhel5
Complete!
[root@node2 ~]#
ディレクトリを用意し、ファイアウォールにポートをあけます。
[root@node2 ~]# mkdir -m 0700 -p /pgdata/ /backup/ \
/backup/walarch/ /backup/pgdata/
[root@node2 ~]# chown postgres.postgres /pgdata/ /backup/ \
/backup/walarch/ /backup/pgdata/
[root@node2 ~]# iptables -I INPUT -p tcp --dport 5432 -j ACCEPT
[root@node2 ~]# service iptables save
ファイアウォールのルールを /etc/sysconfig/iptables に保存中[ OK ]
[root@node2 ~]#
SSH で、パスワードなしでプライマリにログインできるようにします。
[root@node2 ~]# su - postgres
-bash-3.2$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/var/lib/pgsql/.ssh/id_rsa): <Enter>
Created directory '/var/lib/pgsql/.ssh'.
Enter passphrase (empty for no passphrase): <Enter>
Enter same passphrase again: <Enter>
Your identification has been saved in /var/lib/pgsql/.ssh/id_rsa.
Your public key has been saved in /var/lib/pgsql/.ssh/id_rsa.pub.
The key fingerprint is:
a6:bd:ea:76:8b:93:de:3f:7e:48:16:07:c3:a1:f5:ce postgres@node2.priv
-bash-3.2$ cat ~/.ssh/id_rsa.pub |
ssh node1.priv "cat >> .ssh/authorized_keys"
The authenticity of host 'node1.priv (192.168.1.24)' can't be established.
RSA key fingerprint is 4c:98:4e:3c:dc:d0:e9:49:d0:d0:02:59:66:f8:56:59.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'node1.priv,192.168.1.24' (RSA) to the list of
known hosts.
postgres@node1.priv's password: <パスワード>
-bash-3.2$ ssh node1.priv
Last login: Sun Sep 26 15:21:11 2010 from queen-centos2.priv
-bash-3.2$ hostname
node1.priv
-bash-3.2$ exit
logout
Connection to node1.priv closed.
-bash-3.2$
ベースバックアップと WAL アーカイブを、プライマリから複製します。今回はサーバ間で、rsync による定期コピーで共有を行なっていますが、既存のバックアップサーバ等が存在するのであれば、NFS 等を用いた方がスマートだと思います。
-bash-3.2$ rsync -azr --delete --rsh=ssh node1.priv:/backup/pgdata/ /pgdata/
-bash-3.2$ rsync -azr --delete --rsh=ssh node1.priv:/backup/walarch/ /backup/walarch/
-bash-3.2$
1 時間ごとに WAL アーカイブをプライマリから複製するよう、”crontab -e” で以下を追加しておきます。
0 * * * * rsync -azr --delete --rsh=ssh node1.priv:/backup/walarch/ /backup/walarch/
recovery.conf を用意し、ホットスタンバイ サーバを起動します。ついでに .pgpass を用意しておきます。
ここで、postgresql.conf の archive_command はプライマリのそれ、そのものなので、フェイルオーバ後は、/backup/walarch/ にアーカイブをします。今回は障害時に自動での切り替えは行ないませんので問題ないとは思いますが、自動での切り替えで、しかも NFS での共有だと、両ノードがスプリットブレインで同じディレクトリに書きこむ怖れがあります。下記サイトに、そのあたりの考察があって参考になりました:
-bash-3.2$ cp /pgdata/recovery.conf.hotstby /pgdata/recovery.conf
-bash-3.2$ rm -f /pgdata/postmaster.pid
-bash-3.2$ /usr/pgsql-9.0/bin/pg_ctl -D /pgdata/ start
サーバは起動中です。
-bash-3.2$ touch ~/.pgpass
-bash-3.2$ chmod 0600 ~/.pgpass
-bash-3.2$ echo "localhost:*:*:admin:admin" >> ~/.pgpass
-bash-3.2$
起動を永続化します。
@reboot /usr/pgsql-9.0/bin/pg_ctl -D /pgdata/ start
crontab は、最終的に以下のようになっていると思います。
-bash-3.2$ crontab -l
0 * * * * rsync -azr --delete --rsh=ssh node1.priv:/backup/walarch/ /backup/walarch/
@reboot /usr/pgsql-9.0/bin/pg_ctl -D /pgdata/ start
-bash-3.2$
2 つ目、3 つ目のホットスタンバイも、同様の手順で増やします。スレーブが障害を起こして再度追加する場合も、手順は同じです。
スレーブからマスターへの昇格
ホットスタンバイが障害を起こしたとしても、前項のように簡単にリプレースができるのですが、プライマリが障害を起こすと面倒です。プライマリだけでも、DRBD なり共有ディスクなりで、同期で HA 化しておくと良いかも知れません。
障害に見立てて、ブチ切りで、プライマリ (node1) のプロセスを落とします。
[root@node1 ~]# su - postgres
-bash-3.2$ /usr/pgsql-9.0/bin/pg_ctl -D /pgdata/ -m immediate stop
サーバ停止処理の完了を待っています...完了
サーバは停止しました
-bash-3.2$
書きこみができないという報告なり、プロセス監視なりでこの事態を把握してください。修復不能と判断したら、node1 を捨てます。cron のエントリを削除します。
-bash-3.2$ crontab -l
@reboot /usr/pgsql-9.0/bin/pg_ctl -D /pgdata/ start
0 5 * * * /usr/bin/tmpwatch 240 /backup/walarch/
0 5 * * 0 /pgdata/backup-pgdata
-bash-3.2$ crontab -e
-bash-3.2$ crontab -l
-bash-3.2$
新しくプライマリになるサーバ以外のホットスタンバイ サーバも捨てます。プロセスを停止し、crontab のエントリを消します。
[root@node3 ~]# su - postgres
-bash-3.2$ /usr/pgsql-9.0/bin/pg_ctl -D /pgdata/ stop
サーバ停止処理の完了を待っています....完了
サーバは停止しました
-bash-3.2$ crontab -l
0 * * * * rsync -azr --delete --rsh=ssh node1.priv:/backup/walarch/ /backup/walarch/
@reboot /usr/pgsql-9.0/bin/pg_ctl -D /pgdata/ start
-bash-3.2$ crontab -e
-bash-3.2$ crontab -l
-bash-3.2$
新しくプライマリとなる node2 上でトリガを発行して、node2 をプライマリにします。crontab で、node1 から WAL アーカイブを同期していたエントリを消し、かわりに、古い WAL アーカイブを削除するためのエントリと、物理バックアップのエントリを追加します。
[root@node2 ~]# su - postgres
-bash-3.2$ touch /var/lib/pgsql/trigger
-bash-3.2$ crontab -l
0 * * * * rsync -azr --delete --rsh=ssh node1.priv:/backup/walarch/ /backup/walarch/
@reboot /usr/pgsql-9.0/bin/pg_ctl -D /pgdata/ start
-bash-3.2$ crontab -e
-bash-3.2$ crontab -l
@reboot /usr/pgsql-9.0/bin/pg_ctl -D /pgdata/ start
0 5 * * * /usr/bin/tmpwatch 240 /backup/walarch/
0 5 * * 0 /pgdata/backup-pgdata
-bash-3.2$
「1 台目のサーバをプライマリ化」と同等のやり残しをしておきます。
[root@node1 ~]# passwd postgres
Changing password for user postgres.
New UNIX password:<パスワード>
Retype new UNIX password:<パスワード>
passwd: all authentication tokens updated successfully.
[root@node1 ~]# su - postgres
-bash-3.2$ mkdir -p ~/.ssh/
-bash-3.2$ chmod 0700 ~/.ssh/
-bash-3.2$ touch ~/.ssh/authorized_keys
-bash-3.2$ chmod 0600 ~/.ssh/authorized_keys
-bash-3.2$ rm -f /backup/walarch/*
-bash-3.2$ cp /pgdata/recovery.conf.hotstby /pgdata/recovery.conf.hotstby.orig
-bash-3.2$ vi /pgdata/recovery.conf.hotstby
-bash-3.2$ diff -uNr /pgdata/recovery.conf.hotstby.orig \
/pgdata/recovery.conf.hotstby
--- /pgdata/recovery.conf.hotstby.orig 2010-09-26 21:48:16.000000000 +0900
+++ /pgdata/recovery.conf.hotstby 2010-09-26 21:48:34.000000000 +0900
@@ -97,7 +97,7 @@
#
standby_mode = 'on'
-primary_conninfo = 'host=node1.priv port=5432 user=admin password=admin'
+primary_conninfo = 'host=node2.priv port=5432 user=admin password=admin'
#
#
# By default, a standby server keeps streaming XLOG records from the
-bash-3.2$ /pgdata/backup-pgdata
pg_start_backup
-----------------
0/A000020
(1 行)
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
pg_stop_backup
----------------
0/A0000A0
(1 行)
-bash-3.2$
あとは、「ホットスタンバイを追加」の項の、”node1″ を “node2″ に読み替えて、ホットスタンバイを追加していきます。