From 24cd129c199a0ac55ddbb8f773dc84feaf3d728f Mon Sep 17 00:00:00 2001 From: Taiki Koshino Date: Tue, 19 Aug 2025 09:33:20 +0900 Subject: [PATCH] Doc: Update "8.3. Replication Mode and Snapshot Isolation Mode Configuration Example" Document. Updated the link to the example script and the explanation in the "8.3.3. Before you begin" section. --- .../src/sgml/example-replication-si-mode.sgml | 69 +++++++++++-------- doc/src/sgml/example-replication-si-mode.sgml | 67 +++++++++++------- 2 files changed, 85 insertions(+), 51 deletions(-) diff --git a/doc.ja/src/sgml/example-replication-si-mode.sgml b/doc.ja/src/sgml/example-replication-si-mode.sgml index 4ed4ee3e1..b19b87af0 100644 --- a/doc.ja/src/sgml/example-replication-si-mode.sgml +++ b/doc.ja/src/sgml/example-replication-si-mode.sgml @@ -221,16 +221,6 @@ exclude=pgpool* PostgreSQL、Pgpool-IIの設定の前に、以下の設定を行います。 - - postgresユーザパスワードの設定 - - 全サーバで以下のコマンドを実行し、postgresユーザのパスワードの設定を行います。 - - -[全サーバ]# passwd postgres - - - SSHの設定 @@ -240,19 +230,42 @@ exclude=pgpool* [全サーバ]# su - postgres -[全サーバ]$ cd ~/.ssh -[全サーバ]$ ssh-keygen -t rsa -f id_rsa_pgpool -[全サーバ]$ ssh-copy-id -i id_rsa_pgpool.pub postgres@server1 -[全サーバ]$ ssh-copy-id -i id_rsa_pgpool.pub postgres@server2 -[全サーバ]$ ssh-copy-id -i id_rsa_pgpool.pub postgres@server3 - - - 設定後、postgresユーザで、 - ssh postgres@serverX -i ~/.ssh/id_rsa_pgpoolコマンドを実行し、 - パスワード入力せずログインできることを確認してください。 - 必要に応じて/etc/ssh/sshd_configを編集し、 - sshdを再起動してください。 - +[全サーバ]$ mkdir ~/.ssh && chmod 700 ~/.ssh +[全サーバ]$ ssh-keygen -t rsa -f ~/.ssh/id_rsa_pgpool + + + 次に、公開鍵id_rsa_pgpool.pubを各サーバの/var/lib/pgsql/.ssh/authorized_keysファイルに追加します。 + + + 設定後、postgresユーザでssh postgres@serverX -i ~/.ssh/id_rsa_pgpoolコマンドを実行し、パスワードなしでログインできることを確認してください。 + + + + + 公開鍵認証によるログインに失敗した場合には、以下を確認してください。 + + + + /etc/ssh/sshd_configで公開鍵認証が許可されていることを確認します。 + + + + +PubkeyAuthentication yes + + + + + SELinuxを有効化している場合は、SSH公開鍵認証(パスワードなし)が失敗する可能性があるので、すべてのサーバで以下のコマンドを実行する必要があります。 + + + + +[全サーバ]# su - postgres +[全サーバ]$ restorecon -Rv ~/.ssh + + + @@ -265,7 +278,7 @@ exclude=pgpool* [全サーバ]# su - postgres -[全サーバ]$ vi /var/lib/pgsql/.pgpass +[全サーバ]$ vi ~/.pgpass (以下を追加) server1:5432:replication:repl:<replユーザのパスワード> server2:5432:replication:repl:<replユーザのパスワード> @@ -273,7 +286,7 @@ server3:5432:replication:repl:<replユーザのパスワード> server1:5432:postgres:postgres:<postgresユーザのパスワード> server2:5432:postgres:postgres:<postgresユーザのパスワード> server3:5432:postgres:postgres:<postgresユーザのパスワード> -[全サーバ]$ chmod 600 /var/lib/pgsql/.pgpass +[全サーバ]$ chmod 600 ~/.pgpass @@ -534,9 +547,9 @@ recovery_1st_stage_command = 'recovery_1st_stage.sh' recovery_2nd_stage_command = 'recovery_2nd_stage.sh' - ネイティブレプリケーションモード/スナップショットアイソレーションモード専用のオンラインリカバリ用のサンプルスクリプトreplication_mode_recovery_1st_stage.sample、 - replication_mode_recovery_2nd_stage.sample - 及びpgpool_remote_start.sampleは + ネイティブレプリケーションモード/スナップショットアイソレーションモード専用のオンラインリカバリ用のサンプルスクリプトreplication_mode_recovery_1st_stage.sample、 + replication_mode_recovery_2nd_stage.sample + 及びpgpool_remote_start.sampleは /etc/pgpool-II/配下にインストールされていますので、 これらのファイルをmainノード(server1)のデータベースクラスタ配下に配置します。 diff --git a/doc/src/sgml/example-replication-si-mode.sgml b/doc/src/sgml/example-replication-si-mode.sgml index e06b91e77..56c18fe81 100644 --- a/doc/src/sgml/example-replication-si-mode.sgml +++ b/doc/src/sgml/example-replication-si-mode.sgml @@ -223,16 +223,6 @@ exclude=pgpool* Before you start the configuration process, please check the following prerequisites. - - Setting password of postgres user - - Run the following command to set the password of postgres user on each server. - - -[all servers]# passwd postgres - - - Configure passwordless SSH login @@ -245,17 +235,48 @@ exclude=pgpool* [all servers]# su - postgres -[all servers]$ cd ~/.ssh -[all servers]$ ssh-keygen -t rsa -f id_rsa_pgpool -[all servers]$ ssh-copy-id -i id_rsa_pgpool.pub postgres@server1 -[all servers]$ ssh-copy-id -i id_rsa_pgpool.pub postgres@server2 -[all servers]$ ssh-copy-id -i id_rsa_pgpool.pub postgres@server3 +[all servers]$ mkdir ~/.ssh && chmod 700 ~/.ssh +[all servers]$ ssh-keygen -t rsa -f ~/.ssh/id_rsa_pgpool - After setting SSH, use ssh postgres@serverX -i ~/.ssh/id_rsa_pgpool command to - make sure that you can log in without entering a password. Edit /etc/ssh/sshd_config - if necessary and restart sshd. + Then add the public key id_rsa_pgpool.pub to + /var/lib/pgsql/.ssh/authorized_keys file + on each server. + + + After setting SSH, make sure that you can run + ssh postgres@serverX -i ~/.ssh/id_rsa_pgpool command + as postgres user to login to each server + without entering a password. + + + + If you failed to login using SSH public key authentication, please check the following: + + + + Ensure the public key authentication option PubkeyAuthentication are allowed in /etc/ssh/sshd_config: + + + + +PubkeyAuthentication yes + + + + + If SELinux is enabled, SSH public key authentication (passwordless SSH) may fail. + You need to run the following command on all servers. + + + + +[all servers]# su - postgres +[all servers]$ restorecon -Rv ~/.ssh + + + @@ -268,14 +289,14 @@ exclude=pgpool* [all servers]# su - postgres -[all servers]$ vi /var/lib/pgsql/.pgpass +[all servers]$ vi ~/.pgpass server1:5432:replication:repl:<repl user password> server2:5432:replication:repl:<repl user password> server3:5432:replication:repl:<repl user password> server1:5432:postgres:postgres:<postgres user password> server2:5432:postgres:postgres:<postgres user password> server3:5432:postgres:postgres:<postgres user password> -[all servers]$ chmod 600 /var/lib/pgsql/.pgpass +[all servers]$ chmod 600 ~/.pgpass @@ -525,10 +546,10 @@ recovery_1st_stage_command = 'recovery_1st_stage' recovery_2nd_stage_command = 'recovery_2nd_stage' The sample scripts - replication_mode_recovery_1st_stage.sample, - replication_mode_recovery_2nd_stage.sample + replication_mode_recovery_1st_stage.sample, + replication_mode_recovery_2nd_stage.sample and - pgpool_remote_start.sample + pgpool_remote_start.sample are installed in /etc/pgpool-II/. Create the scripts used by online recovery command from sample scripts and copy these files to the database cluster directory. -- 2.39.5