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

Commit 1bf462f

Browse files
committed
docs extended
1 parent 9545eed commit 1bf462f

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

doc/administration.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ When things go more stable we will release prebuilt packages for major platforms
6565

6666

6767

68-
## Configuration
68+
## Setting up empty cluster
6969

7070
After installing software on all cluster nodes we can configure our cluster. Here we describe how to set up multimaster consisting of 3 nodes with empty database. Suppose our nodes accesible via domain names ```node1```, ```node2``` and ```node3```. Perform following steps on each node (sequentially or in parallel – doesn't matter):
7171

@@ -149,13 +149,32 @@ After installing software on all cluster nodes we can configure our cluster. Her
149149
150150
151151
## Setting up cluster from pre-existing database
152+
153+
In case of preexisting database setup would be slightly different. Suppose we have running database on server ```node1``` and wan't to turn it to a multimaster by adding two new nodes ```node2``` and ```node3```. Instead of initializing new directory and creating database and user through a temporary launch, one need to initialize new node through pg_basebackup from working node.
154+
155+
1. On each new node run:
156+
157+
```
158+
pg_basebackup -D ./datadir -h node1 mydb
159+
```
160+
161+
After that configure and atart multimaster from step 3 of previous section. See deteailed description of pg_basebackup options in the official [documentation](https://www.postgresql.org/docs/9.6/static/app-pgbasebackup.html).
162+
163+
152164
## Tuning configuration params
165+
166+
While multimaster is usable with default configuration optins several params may require tuning.
167+
168+
* Hearbeat timeouts — multimaster periodically send heartbeat packets to check availability of neighbour nodes. ```multimaster.heartbeat_send_timeout``` defines amount of time between sending heartbeats, while ```multimaster.heartbeat_recv_timeout``` sets amount of time following which node assumed to be disconnected if no hearbeats were received during this time. It's good idea to set ```multimaster.heartbeat_send_timeout``` based on typical ping latencies between you nodes. Small recv/senv ratio decraeases time of failure detection, but increases probability of false positive failure detection, so tupical packet loss ratio between nodes should be taken into account.
169+
170+
* Min/max recovery lag — when node is disconnected from the cluster other nodes will keep to collect WAL logs for disconnected node until size of WAL log will grow to ```multimaster.max_recovery_lag```. Upon reaching this threshold WAL logs for disconnected node will be deleted, automatic recovery will be no longer possible and disconnected node should be cloned manually from one of alive node by ```pg_basebackup```. Increasing ```multimaster.max_recovery_lag``` increases amount of time while automatic recovery is possible, but also increasing maximum disk usage during WAL collection. On the other hand ```multimaster.min_recovery_lag``` sets difference between acceptor and donor nodes before switching ordanary recovery to exclusive mode, when commits on donor node are stopped. This step is necessary to ensure that no new commits will happend during node promotion from recovery state to online state and nodes will be at sync after that.
171+
172+
153173
## Monitoring
154174
155175
* `mtm.get_nodes_state()` -- show status of nodes on cluster
156176
* `mtm.get_cluster_state()` -- show whole cluster status
157177
* `mtm.get_cluster_info()` -- print some debug info
158-
* `mtm.make_table_local(relation regclass)` -- stop replication for a given table
159178
160179
Read description of all management functions at [functions](doc/functions.md)
161180

0 commit comments

Comments
 (0)