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

Commit fbe1070

Browse files
author
Liudmila Mantrova
committed
DOC: added setup example for multimaster in EE10
1 parent 5667b8b commit fbe1070

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

doc/src/sgml/multimaster.sgml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,87 @@ SELECT mtm.get_cluster_state();
549549
<para><emphasis role="strong">See Also</emphasis></para>
550550
<para><link linkend="multimaster-tuning-configuration-parameters">Tuning
551551
Configuration Parameters</link></para>
552+
<sect4>
553+
<title>Sample Cluster Configuration</title>
554+
<para>
555+
This section shows a sample configuration of a three-node cluster with
556+
host names <literal>node1</literal>, <literal>node2</literal> and
557+
<literal>node3</literal>. The name of the database
558+
to be replicated is <literal>mydb</literal>.
559+
The name of DBMS user with superuser rights to perform database
560+
replication is <literal>myuser</literal>.
561+
</para>
562+
<orderedlist>
563+
<listitem>
564+
<para>
565+
First, run the following commands on behalf of OS user
566+
<literal>postgres</literal>, on all cluster nodes:
567+
</para>
568+
<programlisting>
569+
# Configure each node, and then create the myuser user
570+
# and mydb database owned by myuser.
571+
export PATH=/opt/pgpro/&edn;-&majorversion;/bin:$PATH
572+
export PGDATA=/var/lib/pgpro/&edn;-&majorversion;/data
573+
574+
for i in `seq 1 3`; do
575+
echo "host replication myuser node$i md5" >> $PGDATA/pg_hba.conf
576+
echo "node$i:5432:mydb:myuser:myuserpassword" >> ~/.pgpass
577+
done
578+
chmod 0600 ~/.pgpass
579+
580+
cat << EOF | psql --dbname=postgres --username=postgres --port=5432
581+
ALTER SYSTEM SET default_transaction_isolation = 'read committed';
582+
ALTER SYSTEM SET wal_level = logical;
583+
ALTER SYSTEM SET max_connections = 100;
584+
ALTER SYSTEM SET max_prepared_transactions = 300;
585+
ALTER SYSTEM SET max_wal_senders = 10;
586+
ALTER SYSTEM SET max_replication_slots = 10;
587+
ALTER SYSTEM SET max_worker_processes = 250;
588+
ALTER SYSTEM SET shared_preload_libraries = 'multimaster';
589+
CREATE USER myuser WITH SUPERUSER PASSWORD 'myuserpassword';
590+
CREATE DATABASE mydb OWNER myuser;
591+
EOF
592+
593+
# Define the number of nodes in the cluster, assign node IDs,
594+
# and connection strings to the nodes. This example assumes
595+
# that node hostnames are node1, node2, and node3, and their
596+
# IDs are the corresponding numbers starting with 1.
597+
cat << EOF >> $PGDATA/postgresql.conf
598+
multimaster.max_nodes = 3
599+
multimaster.node_id = `hostname | awk '{ print substr($1,5,1) }'`
600+
multimaster.arbiter_port = 5433
601+
multimaster.conn_strings = 'dbname=mydb user=myuser host=node1 port=5432 arbiter_port=5433,dbname=mydb user=myuser host=node2 port=5432 arbiter_port=5433,dbname=mydb user=myuser host=node3 port=5432 arbiter_port=5433'
602+
EOF
603+
604+
</programlisting>
605+
</listitem>
606+
607+
<listitem>
608+
<para>
609+
On behalf of an OS user with superuser privileges, restart
610+
<productname>&productname;</productname> service on all cluster nodes:
611+
</para>
612+
<programlisting>
613+
sudo service postgrespro-&edn;-&majorversion; restart
614+
</programlisting>
615+
</listitem>
616+
617+
<listitem>
618+
<para>
619+
Now create the <filename>multimaster</filename> extension on
620+
one of the cluster nodes, on behalf of OS user <literal>postgres</literal>.
621+
It will be replicated to all the other nodes automatically.
622+
The following example illustrates extension creation on node1.
623+
<programlisting>
624+
psql --dbname=mydb --username=myuser --host=127.0.0.1 --port=5432 -c "CREATE EXTENSION IF NOT EXISTS multimaster"
625+
</programlisting>
626+
</para>
627+
<para>
628+
The cluster is set up and ready to use.
629+
</para>
630+
</listitem>
631+
</orderedlist>
632+
</sect4>
552633
</sect3>
553634
<sect3 id="multimaster-tuning-configuration-parameters">
554635
<title>Tuning Configuration Parameters</title>

0 commit comments

Comments
 (0)