Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0c8536f

Browse files
author
Liudmila Mantrova
committed
DOC: fixed instructions for adding nodes
1 parent 152a4d1 commit 0c8536f

File tree

1 file changed

+27
-17
lines changed

1 file changed

+27
-17
lines changed

doc/src/sgml/multimaster.sgml

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -430,11 +430,11 @@ multimaster.conn_strings = 'dbname=mydb user=myuser host=node1, dbname=mydb user
430430
# of connection strings
431431
# to neighbor nodes
432432
</programlisting>
433-
<para>The <literal>multimaster.max_nodes</literal> variable defines the maximum cluster size. If you plan to add new nodes to your cluster, the <literal>multimaster.max_nodes</literal> value should exceed the initial number of nodes. In this case, you can add new nodes without restarting <productname>&productname;</productname>.
433+
<para>The <literal>multimaster.max_nodes</literal> variable defines the maximum cluster size. If you plan to add new nodes to your cluster, the <literal>multimaster.max_nodes</literal> value should exceed the initial number of nodes. In this case, you can add new nodes without restarting <productname>&productname;</productname> until the specified number of nodes is reached.
434434
</para>
435435
<para>In most cases, three cluster nodes are enough to ensure high availability. Since the data on all cluster nodes is the same, you do not typically need more than five cluster nodes.
436436
</para>
437-
<para>If you would like to change the default connection settings for a cluster node, you can add other <link linkend="libpq-paramkeywords"> connection parameters</link> to the corresponding connection string in the <varname>multimaster.conn_strings</varname> variable. Additionally, you can specify the <literal>arbiter_process</literal> parameter to change the port used by the arbiter process to connect to the nodes. For details, see <xref linkend="multimaster-conn-strings"> and <xref linkend="multimaster-arbiter-port">.</para>
437+
<para>If you would like to change the default connection settings for a cluster node, you can add other <link linkend="libpq-paramkeywords"> connection parameters</link> to the corresponding connection string in the <varname>multimaster.conn_strings</varname> variable. If you change the default port on which the arbiter process listens for connections, you must specify this port in the <literal>arbiter_port</literal> parameter. For details, see <xref linkend="multimaster-arbiter-port"> and <xref linkend="multimaster-conn-strings">.</para>
438438
<important><para>The
439439
<literal>multimaster.node_id</literal> variable takes natural
440440
numbers starting from 1, without any gaps in numbering.
@@ -480,7 +480,7 @@ CREATE EXTENSION multimaster;</programlisting></para>
480480
the <structname>mtm.get_cluster_state()</structname> view:
481481
</para>
482482
<programlisting>
483-
SELECT * FROM mtm.get_cluster_state();
483+
mtm.get_cluster_state();
484484
</programlisting>
485485
<para>
486486
If <literal>liveNodes</literal> is equal to
@@ -611,22 +611,24 @@ SELECT * FROM mtm.get_cluster_state();
611611
To check node-specific information, use <literal>mtm.get_nodes_state()</literal>:
612612
</para>
613613
<programlisting>
614-
SELECT * FROM mtm.get_nodes_state();
614+
mtm.get_nodes_state();
615615
</programlisting>
616616
<para>To check the status of the whole cluster, use the
617617
<literal>mtm.get_cluster_state()</literal> view:
618618
</para>
619619
<programlisting>
620-
SELECT * FROM mtm.get_cluster_state();
620+
mtm.get_cluster_state();
621621
</programlisting>
622622
<para>For details on all the returned information, see <xref linkend="multimaster-functions">.
623623
</para>
624624
</sect3>
625625
<sect3 id="multimaster-adding-new-nodes-to-the-cluster">
626626
<title>Adding New Nodes to the Cluster</title>
627+
<para>With the <filename>multimaster</filename> extension, you can add or drop cluster nodes without
628+
stopping the database service.
629+
</para>
627630
<para>
628-
With multimaster, you can add or drop cluster nodes without a
629-
restart. To add a new node, you need to change the cluster
631+
To add a new node, you need to change the cluster
630632
configuration on alive nodes, load all the data to the new node using
631633
<application>pg_basebackup</application>, and start the node.
632634
</para>
@@ -637,21 +639,30 @@ SELECT * FROM mtm.get_cluster_state();
637639
<literal>node4</literal>, follow these steps:
638640
</para>
639641
<orderedlist>
642+
<listitem>
643+
<para>Check whether the current number of cluster nodes has reached the value specified in the
644+
<varname>multimaster.max_nodes</varname> variable. If this value is reached, increase
645+
the <varname>multimaster.max_nodes</varname> value on each node and restart all nodes.
646+
You can restart the nodes one by one, without stopping the database.
647+
If the maximum number of nodes is not reached, proceed to the next step.
648+
</para>
649+
</listitem>
640650
<listitem>
641651
<para>
642652
Figure out the required connection string to
643653
access the new node. For example, for the database
644654
<literal>mydb</literal>, user <literal>myuser</literal>, and
645655
the new node <literal>node4</literal>, the connection string
646-
is <literal>&quot;dbname=mydb user=myuser host=node4&quot;</literal>.
656+
can be <literal>&quot;dbname=mydb user=myuser host=node4&quot;</literal>.
657+
For details, see <xref linkend="multimaster-conn-strings">.
647658
</para>
648659
</listitem>
649660
<listitem>
650661
<para>
651662
In <literal>psql</literal> connected to any alive node, run:
652663
</para>
653664
<programlisting>
654-
SELECT * FROM mtm.add_node('dbname=mydb user=myuser host=node4');
665+
mtm.add_node('dbname=mydb user=myuser host=node4');
655666
</programlisting>
656667
<para>
657668
This command changes the cluster configuration on all nodes
@@ -757,7 +768,7 @@ SELECT mtm.stop_node(3);
757768
In <literal>psql</literal> connected to any alive node, create a new replication slot for the disconnected node with the following command:
758769
</para>
759770
<programlisting>
760-
SELECT * FROM mtm.recover_node(2);
771+
mtm.recover_node(2);
761772
</programlisting>
762773
<para>where 2 is the ID of the disconnected node specified in the <varname>multimaster.node_id</varname> variable.</para>
763774
</listitem>
@@ -814,19 +825,18 @@ pg_ctl -D <replaceable>datadir</replaceable> -l <replaceable>pg.log</replaceable
814825
Connection strings must appear in the order of the node IDs
815826
specified in the <varname>multimaster.node_id</varname> variable.
816827
Connection string for the i-th node must be on the i-th position.
817-
You can also specify a
818-
custom port for the arbiter to listen on using the <literal>arbiter_port</literal>
819-
parameter. The provided value must be the same as the <varname>multimaster.arbiter_port</varname>
820-
value specified for this node.
828+
If you specify a custom port in the <varname>multimaster.arbiter_port</varname>,
829+
you must provide this value in the <literal>arbiter_port</literal>
830+
parameter in the connection string for the corresponding node.
821831
</para></listitem></varlistentry>
822832
<varlistentry><term><varname>multimaster.max_nodes</varname><indexterm><primary><varname>multimaster.max_nodes</varname></primary></indexterm></term><listitem><para>
823-
The maximum number of nodes allowed in the cluster. If you plan to add new nodes to your cluster, the <literal>multimaster.max_nodes</literal> value should exceed the initial number of nodes. In this case, you can add new nodes without restarting <productname>&productname;</productname>. In most cases, three cluster nodes are enough to ensure high availability. Since the data on all cluster nodes is the same, you do not typically need more than five cluster nodes. The maximum possible number of nodes is limited to 64.</para>
833+
The maximum number of nodes allowed in the cluster. If you plan to add new nodes to your cluster, the <literal>multimaster.max_nodes</literal> value should exceed the initial number of nodes. In this case, you can add new nodes without restarting <productname>&productname;</productname> until the specified number of nodes is reached. In most cases, three cluster nodes are enough to ensure high availability. Since the data on all cluster nodes is the same, you do not typically need more than five cluster nodes. The maximum possible number of nodes is limited to 64.</para>
824834
<para>Default: the number of nodes specified in the <varname>multimaster.conn_strings</varname> variable
825835
</para></listitem></varlistentry>
826836
<varlistentry id="multimaster-arbiter-port">
827837
<term><varname>multimaster.arbiter_port</varname><indexterm><primary><varname>multimaster.arbiter_port</varname></primary></indexterm></term><listitem><para>
828838
Port for the arbiter process to listen on. If you change the default value, you must specify this value in the <literal>arbiter_port</literal>
829-
parameter in the connection string of the corresponding node.</para>
839+
parameter in the connection string for the corresponding node.</para>
830840
<para>Default: 5433
831841
</para></listitem></varlistentry>
832842
<varlistentry><term><varname>multimaster.heartbeat_send_timeout</varname><indexterm><primary><varname>multimaster.heartbeat_send_timeout</varname></primary></indexterm></term><listitem><para>
@@ -873,7 +883,7 @@ pg_ctl -D <replaceable>datadir</replaceable> -l <replaceable>pg.log</replaceable
873883
</para></listitem></varlistentry>
874884
<varlistentry><term><varname>multimaster.cluster_name</varname><indexterm><primary><varname>multimaster.cluster_name</varname></primary></indexterm></term><listitem><para>
875885
Name of the cluster. If
876-
you set this variable, <filename>multimaster</filename> checks that
886+
you define this variable when setting up the cluster, <filename>multimaster</filename> checks that
877887
the cluster name is the same for all the cluster nodes.
878888
</para></listitem></varlistentry>
879889
<varlistentry>

0 commit comments

Comments
 (0)