Doc: Update "8.3. Replication Mode and Snapshot Isolation Mode Configuration Example...
authorTaiki Koshino <koshino@sraoss.co.jp>
Tue, 19 Aug 2025 00:33:20 +0000 (09:33 +0900)
committerTaiki Koshino <koshino@sraoss.co.jp>
Tue, 19 Aug 2025 00:33:20 +0000 (09:33 +0900)
Updated the link to the example script and the explanation in the "8.3.3. Before you begin" section.

doc.ja/src/sgml/example-replication-si-mode.sgml
doc/src/sgml/example-replication-si-mode.sgml

index 4ed4ee3e1618c39e7f6e11d910a12f00b288aad2..b19b87af082d1aa4f8e5651e7b63ce1f6729a4a2 100644 (file)
@@ -221,16 +221,6 @@ exclude=pgpool*
    PostgreSQL、Pgpool-IIの設定の前に、以下の設定を行います。
   </para>
 
-  <sect3 id="example-replication-mode-postgres-password">
-   <title>postgresユーザパスワードの設定</title>
-   <para>
-    全サーバで以下のコマンドを実行し、<literal>postgres</literal>ユーザのパスワードの設定を行います。
-   </para>
-   <programlisting>
-[全サーバ]# passwd postgres
-   </programlisting>
-  </sect3>
-
   <sect3 id="example-replication-mode-ssh">
    <title>SSHの設定</title>
    <para>
@@ -240,19 +230,42 @@ exclude=pgpool*
    </para>
    <programlisting>
 [全サーバ]# 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
-   </programlisting>
-   <para>
-    設定後、<literal>postgres</literal>ユーザで、
-    <command>ssh postgres@serverX -i ~/.ssh/id_rsa_pgpool</command>コマンドを実行し、
-    パスワード入力せずログインできることを確認してください。
-    必要に応じて<filename>/etc/ssh/sshd_config</filename>を編集し、
-    <systemitem>sshd</systemitem>を再起動してください。
-   </para>
+[全サーバ]$ mkdir ~/.ssh && chmod 700 ~/.ssh
+[全サーバ]$ ssh-keygen -t rsa -f ~/.ssh/id_rsa_pgpool
+    </programlisting>
+    <para>
+     次に、公開鍵<literal>id_rsa_pgpool.pub</literal>を各サーバの<filename>/var/lib/pgsql/.ssh/authorized_keys</filename>ファイルに追加します。
+    </para>
+    <para>
+     設定後、<literal>postgres</literal>ユーザで<command>ssh postgres@serverX -i ~/.ssh/id_rsa_pgpool</command>コマンドを実行し、パスワードなしでログインできることを確認してください。
+    </para>
+
+    <note>
+     <para>
+      公開鍵認証によるログインに失敗した場合には、以下を確認してください。
+      <itemizedlist>
+       <listitem>
+        <para>
+         <filename>/etc/ssh/sshd_config</filename>で公開鍵認証が許可されていることを確認します。
+        </para>
+       </listitem>
+      </itemizedlist>
+      <programlisting>
+PubkeyAuthentication yes
+      </programlisting>
+      <itemizedlist>
+       <listitem>
+        <para>
+         SELinuxを有効化している場合は、SSH公開鍵認証(パスワードなし)が失敗する可能性があるので、すべてのサーバで以下のコマンドを実行する必要があります。
+        </para>
+       </listitem>
+      </itemizedlist>
+      <programlisting>
+[全サーバ]# su - postgres
+[全サーバ]$ restorecon -Rv ~/.ssh
+      </programlisting>
+     </para>
+    </note>
   </sect3>
 
   <sect3 id="example-replication-mode-pgpass">
@@ -265,7 +278,7 @@ exclude=pgpool*
    </para>
    <programlisting>
 [全サーバ]# su - postgres
-[全サーバ]$ vi /var/lib/pgsql/.pgpass
+[全サーバ]$ vi ~/.pgpass
 (以下を追加)
 server1:5432:replication:repl:&lt;replユーザのパスワード&gt;
 server2:5432:replication:repl:&lt;replユーザのパスワード&gt;
@@ -273,7 +286,7 @@ server3:5432:replication:repl:&lt;replユーザのパスワード&gt;
 server1:5432:postgres:postgres:&lt;postgresユーザのパスワード&gt;
 server2:5432:postgres:postgres:&lt;postgresユーザのパスワード&gt;
 server3:5432:postgres:postgres:&lt;postgresユーザのパスワード&gt;
-[全サーバ]$ chmod 600 /var/lib/pgsql/.pgpass
+[全サーバ]$ chmod 600 ~/.pgpass
    </programlisting>
   </sect3>
 
@@ -534,9 +547,9 @@ recovery_1st_stage_command = 'recovery_1st_stage.sh'
 recovery_2nd_stage_command = 'recovery_2nd_stage.sh'
    </programlisting>
    <para>
-    ネイティブレプリケーションモード/スナップショットアイソレーションモード専用のオンラインリカバリ用のサンプルスクリプト<ulink url="https://git.postgresql.org/gitweb/?p=pgpool2.git;a=blob_plain;f=src/sample/scripts/replication_mode_recovery_1st_stage.sample;hb=refs/heads/V4_4_STABLE">replication_mode_recovery_1st_stage.sample</ulink>、
-    <ulink url="https://git.postgresql.org/gitweb/?p=pgpool2.git;a=blob_plain;f=src/sample/scripts/replication_mode_recovery_2nd_stage.sample;hb=refs/heads/V4_4_STABLE">replication_mode_recovery_2nd_stage.sample</ulink>
-    及び<ulink url="https://git.postgresql.org/gitweb/?p=pgpool2.git;a=blob_plain;f=src/sample/scripts/pgpool_remote_start.sample;hb=refs/heads/V4_4_STABLE">pgpool_remote_start.sample</ulink>は
+    ネイティブレプリケーションモード/スナップショットアイソレーションモード専用のオンラインリカバリ用のサンプルスクリプト<ulink url="https://raw.githubusercontent.com/pgpool/pgpool2/refs/heads/V4_4_STABLE/src/sample/scripts/replication_mode_recovery_1st_stage.sample">replication_mode_recovery_1st_stage.sample</ulink>、
+    <ulink url="https://raw.githubusercontent.com/pgpool/pgpool2/refs/heads/V4_4_STABLE/src/sample/scripts/replication_mode_recovery_2nd_stage.sample">replication_mode_recovery_2nd_stage.sample</ulink>
+    及び<ulink url="https://raw.githubusercontent.com/pgpool/pgpool2/refs/heads/V4_4_STABLE/src/sample/scripts/pgpool_remote_start.sample">pgpool_remote_start.sample</ulink>は
     <filename>/etc/pgpool-II/</filename>配下にインストールされていますので、
     これらのファイルをmainノード(<literal>server1</literal>)のデータベースクラスタ配下に配置します。
    </para>
index e06b91e779ee44d1e0b6ac94912d73623d2af509..56c18fe815e881869f6869e34c445a88f044259b 100644 (file)
@@ -223,16 +223,6 @@ exclude=pgpool*
    Before you start the configuration process, please check the following prerequisites.
   </para>
 
-  <sect3 id="example-replication-mode-postgres-password">
-   <title>Setting password of postgres user</title>
-   <para>
-    Run the following command to set the password of <literal>postgres</literal> user on each server.
-   </para>
-   <programlisting>
-[all servers]# passwd postgres
-   </programlisting>
-  </sect3>
-
   <sect3 id="example-replication-mode-ssh">
    <title>Configure passwordless SSH login</title>
    <para>
@@ -245,17 +235,48 @@ exclude=pgpool*
    </para>
    <programlisting>
 [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
    </programlisting>
    <para>
-    After setting SSH, use <command>ssh postgres@serverX -i ~/.ssh/id_rsa_pgpool</command> command to
-    make sure that you can log in without entering a password. Edit <filename>/etc/ssh/sshd_config</filename>
-    if necessary and restart sshd.
+    Then add the public key <filename>id_rsa_pgpool.pub</filename> to
+    <filename>/var/lib/pgsql/.ssh/authorized_keys</filename> file
+    on each server.
+   </para>
+   <para>
+    After setting SSH, make sure that you can run
+    <command>ssh postgres@serverX -i ~/.ssh/id_rsa_pgpool</command> command
+    as <literal>postgres</literal> user to login to each server
+    without entering a password.
    </para>
+
+   <note>
+    <para>
+     If you failed to login using SSH public key authentication, please check the following:
+     <itemizedlist>
+      <listitem>
+       <para>
+        Ensure the public key authentication option <literal>PubkeyAuthentication</literal> are allowed in <filename>/etc/ssh/sshd_config</filename>:
+       </para>
+      </listitem>
+     </itemizedlist>
+     <programlisting>
+PubkeyAuthentication yes
+     </programlisting>
+     <itemizedlist>
+      <listitem>
+       <para>
+        If SELinux is enabled, SSH public key authentication (passwordless SSH) may fail.
+        You need to run the following command on all servers.
+       </para>
+      </listitem>
+     </itemizedlist>
+    <programlisting>
+[all servers]# su - postgres
+[all servers]$ restorecon -Rv ~/.ssh
+    </programlisting>
+    </para>
+   </note>
   </sect3>
 
   <sect3 id="example-replication-mode-pgpass">
@@ -268,14 +289,14 @@ exclude=pgpool*
    </para>
    <programlisting>
 [all servers]# su - postgres
-[all servers]$ vi /var/lib/pgsql/.pgpass
+[all servers]$ vi ~/.pgpass
 server1:5432:replication:repl:&lt;repl user password&gt;
 server2:5432:replication:repl:&lt;repl user password&gt;
 server3:5432:replication:repl:&lt;repl user password&gt;
 server1:5432:postgres:postgres:&lt;postgres user password&gt;
 server2:5432:postgres:postgres:&lt;postgres user password&gt;
 server3:5432:postgres:postgres:&lt;postgres user password&gt;
-[all servers]$ chmod 600 /var/lib/pgsql/.pgpass
+[all servers]$ chmod 600 ~/.pgpass
    </programlisting>
   </sect3>
 
@@ -525,10 +546,10 @@ recovery_1st_stage_command = 'recovery_1st_stage'
 recovery_2nd_stage_command = 'recovery_2nd_stage'
    </programlisting>
     The sample scripts
-    <ulink url="https://git.postgresql.org/gitweb/?p=pgpool2.git;a=blob_plain;f=src/sample/scripts/replication_mode_recovery_1st_stage.sample;hb=refs/heads/V4_4_STABLE">replication_mode_recovery_1st_stage.sample</ulink>,
-    <ulink url="https://git.postgresql.org/gitweb/?p=pgpool2.git;a=blob_plain;f=src/sample/scripts/replication_mode_recovery_2nd_stage.sample;hb=refs/heads/V4_4_STABLE">replication_mode_recovery_2nd_stage.sample</ulink>
+    <ulink url="https://raw.githubusercontent.com/pgpool/pgpool2/refs/heads/V4_4_STABLE/src/sample/scripts/replication_mode_recovery_1st_stage.sample">replication_mode_recovery_1st_stage.sample</ulink>,
+    <ulink url="https://raw.githubusercontent.com/pgpool/pgpool2/refs/heads/V4_4_STABLE/src/sample/scripts/replication_mode_recovery_2nd_stage.sample">replication_mode_recovery_2nd_stage.sample</ulink>
     and
-    <ulink url="https://git.postgresql.org/gitweb/?p=pgpool2.git;a=blob_plain;f=src/sample/scripts/pgpool_remote_start.sample;hb=refs/heads/V4_4_STABLE">pgpool_remote_start.sample</ulink>
+    <ulink url="https://raw.githubusercontent.com/pgpool/pgpool2/refs/heads/V4_4_STABLE/src/sample/scripts/pgpool_remote_start.sample">pgpool_remote_start.sample</ulink>
     are installed in <filename>/etc/pgpool-II/</filename>.
     Create the scripts used by online recovery command from sample scripts and copy these files to the database cluster directory.
    </para>