Fix code block formatting

This commit is contained in:
Ian Barwick
2014-07-16 08:07:07 +09:00
parent 75baed233b
commit 7350a8bf57

View File

@@ -34,7 +34,7 @@ same PostgreSQL major version, and preferably should be running the same minor
version. version.
repmgr will work on any Linux or UNIX-like environment capable of running repmgr will work on any Linux or UNIX-like environment capable of running
PostgreSQL. rsync must also be installed. PostgreSQL. `rsync` must also be installed.
Installation Installation
@@ -55,7 +55,7 @@ repmgr must be installed on each PostgreSQL server node.
repmgr can be built easily using PGXS: repmgr can be built easily using PGXS:
sudo make USE_PGXS=1 install sudo make USE_PGXS=1 install
Configuration Configuration
@@ -71,12 +71,12 @@ between all server nodes to enable repmgr to copy required files.
The master PostgreSQL node needs to be configured for replication with the The master PostgreSQL node needs to be configured for replication with the
following settings: following settings:
wal_level = 'hot_standby' # minimal, archive, hot_standby, or logical wal_level = 'hot_standby' # minimal, archive, hot_standby, or logical
archive_mode = on # allows archiving to be done archive_mode = on # allows archiving to be done
archive_command = 'cd .' # command to use to archive a logfile segment archive_command = 'cd .' # command to use to archive a logfile segment
max_wal_senders = 10 # max number of walsender processes max_wal_senders = 10 # max number of walsender processes
wal_keep_segments = 5000 # in logfile segments, 16MB each; 0 disables wal_keep_segments = 5000 # in logfile segments, 16MB each; 0 disables
hot_standby = on # "on" allows queries during recovery hot_standby = on # "on" allows queries during recovery
Note that repmgr expects a default of 5000 wal_keep_segments, although this Note that repmgr expects a default of 5000 wal_keep_segments, although this
value can be overridden when executing the `repmgr` client. value can be overridden when executing the `repmgr` client.
@@ -92,11 +92,11 @@ one, however it's probably advisable to create a dedicated repmgr database.
Each PostgreSQL node requires a repmgr configuration file containing Each PostgreSQL node requires a repmgr configuration file containing
identification and database connection information: identification and database connection information:
cluster=test cluster=test
node=1 node=1
node_name=node1 node_name=node1
conninfo='host=repmgr_node1 user=repmgr_usr dbname=repmgr_db' conninfo='host=repmgr_node1 user=repmgr_usr dbname=repmgr_db'
pg_bindir=/path/to/postgres/bin pg_bindir=/path/to/postgres/bin
* `cluster`: common name for the replication cluster; this must be the same on all nodes * `cluster`: common name for the replication cluster; this must be the same on all nodes
* `node`: a unique, abitrary integer identifier * `node`: a unique, abitrary integer identifier
@@ -107,11 +107,11 @@ identification and database connection information:
resolvable by all nodes on the cluster. resolvable by all nodes on the cluster.
* `pg_bindir`: (optional) location of PostgreSQL binaries, if not in the default $PATH * `pg_bindir`: (optional) location of PostgreSQL binaries, if not in the default $PATH
Note that the configuration file should not be stored inside the PostgreSQL Note that the configuration file should *not* be stored inside the PostgreSQL
data directory. data directory.
Each node configuration needs to be registered with repmgr, either using the Each node configuration needs to be registered with repmgr, either using the
repmgr command line tool, or the repmgrd daemon; for details see below. Details `repmgr` command line tool, or the `repmgrd` daemon; for details see below. Details
about each node are inserted into the repmgr database (for details see below). about each node are inserted into the repmgr database (for details see below).
@@ -133,35 +133,34 @@ Master setup
- create user and database: - create user and database:
CREATE ROLE repmgr_usr LOGIN SUPERUSER; CREATE ROLE repmgr_usr LOGIN SUPERUSER;
CREATE DATABASE repmgr_db OWNER repmgr_usr; CREATE DATABASE repmgr_db OWNER repmgr_usr;
- configure postgresql.conf for replication (see above) - configure postgresql.conf for replication (see above)
- update pg_hba.conf: - update pg_hba.conf:
host repmgr_usr repmgr_db 192.168.1.0/24 trust host repmgr_usr repmgr_db 192.168.1.0/24 trust
host replication all 192.168.1.0/24 trust host replication all 192.168.1.0/24 trust
Restart the PostgreSQL server after making these changes. Restart the PostgreSQL server after making these changes.
2. Create the repmgr configuration file: 2. Create the repmgr configuration file:
$ cat $HOME/repmgr/repmgr.conf $ cat $HOME/repmgr/repmgr.conf
cluster=test cluster=test
node=1 node=1
node_name=node1 node_name=node1
conninfo='host=repmgr_node1 user=repmgr_usr dbname=repmgr_db' conninfo='host=repmgr_node1 user=repmgr_usr dbname=repmgr_db'
pg_bindir=/path/to/postgres/bin pg_bindir=/path/to/postgres/bin
3. Register the master node with repmgr: 3. Register the master node with repmgr:
$ repmgr -f $HOME/repmgr/repmgr.conf --verbose master register $ repmgr -f $HOME/repmgr/repmgr.conf --verbose master register
[2014-07-04 10:43:42] [INFO] repmgr mgr connecting to master database [2014-07-04 10:43:42] [INFO] repmgr mgr connecting to master database
[2014-07-04 10:43:42] [INFO] repmgr connected to master, checking its state [2014-07-04 10:43:42] [INFO] repmgr connected to master, checking its state
[2014-07-04 10:43:42] [INFO] master register: creating database objects inside the repmgr_test schema [2014-07-04 10:43:42] [INFO] master register: creating database objects inside the repmgr_test schema
[2014-07-04 10:43:43] [NOTICE] Master node correctly registered for cluster test with id 1 (conninfo: host=localhost user=repmgr_usr dbname=repmgr_db) [2014-07-04 10:43:43] [NOTICE] Master node correctly registered for cluster test with id 1 (conninfo: host=localhost user=repmgr_usr dbname=repmgr_db)
-d is the database defined in repmgr.conf file. -d is the database defined in repmgr.conf file.
@@ -170,21 +169,21 @@ Slave/standby setup
1. Use repmgr to clone the master: 1. Use repmgr to clone the master:
$ repmgr -f $HOME/repmgr/repmgr.conf -D $PGDATA -d repmgr_db -U repmgr_usr -R postgres --verbose standby clone 192.168.1.2 $ repmgr -f $HOME/repmgr/repmgr.conf -D $PGDATA -d repmgr_db -U repmgr_usr -R postgres --verbose standby clone 192.168.1.2
Opening configuration file: ./repmgr.conf Opening configuration file: ./repmgr.conf
[2014-07-04 10:49:00] [ERROR] Did not find the configuration file './repmgr.conf', continuing [2014-07-04 10:49:00] [ERROR] Did not find the configuration file './repmgr.conf', continuing
[2014-07-04 10:49:00] [INFO] repmgr connecting to master database [2014-07-04 10:49:00] [INFO] repmgr connecting to master database
[2014-07-04 10:49:00] [INFO] repmgr connected to master, checking its state [2014-07-04 10:49:00] [INFO] repmgr connected to master, checking its state
[2014-07-04 10:49:00] [INFO] Successfully connected to primary. Current installation size is 1807 MB [2014-07-04 10:49:00] [INFO] Successfully connected to primary. Current installation size is 1807 MB
[2014-07-04 10:49:00] [NOTICE] Starting backup... [2014-07-04 10:49:00] [NOTICE] Starting backup...
[2014-07-04 10:49:00] [INFO] creating directory "/path/to/data/"... [2014-07-04 10:49:00] [INFO] creating directory "/path/to/data/"...
(...) (...)
[2014-07-04 10:53:19] [NOTICE] Finishing backup... [2014-07-04 10:53:19] [NOTICE] Finishing backup...
NOTICE: pg_stop_backup complete, all required WAL segments have been archived NOTICE: pg_stop_backup complete, all required WAL segments have been archived
[2014-07-04 10:53:21] [INFO] repmgr requires primary to keep WAL files 0000000100000000000000AD until at least 0000000100000000000000AD [2014-07-04 10:53:21] [INFO] repmgr requires primary to keep WAL files 0000000100000000000000AD until at least 0000000100000000000000AD
[2014-07-04 10:53:21] [NOTICE] repmgr standby clone complete [2014-07-04 10:53:21] [NOTICE] repmgr standby clone complete
[2014-07-04 10:53:21] [NOTICE] HINT: You can now start your postgresql server [2014-07-04 10:53:21] [NOTICE] HINT: You can now start your postgresql server
[2014-07-04 10:53:21] [NOTICE] for example : /etc/init.d/postgresql start [2014-07-04 10:53:21] [NOTICE] for example : /etc/init.d/postgresql start
-R is the database system user on the master node. At this point it does not matter -R is the database system user on the master node. At this point it does not matter
if the `repmgr.conf` file is not found. if the `repmgr.conf` file is not found.
@@ -196,26 +195,26 @@ Slave/standby setup
3. Create the repmgr configuration file: 3. Create the repmgr configuration file:
$ cat $HOME/repmgr/repmgr.conf $ cat $HOME/repmgr/repmgr.conf
cluster=test cluster=test
node=2 node=2
node_name=node2 node_name=node2
conninfo='host=repmgr_node2 user=repmgr_usr dbname=repmgr_db' conninfo='host=repmgr_node2 user=repmgr_usr dbname=repmgr_db'
pg_bindir=/path/to/postgres/bin pg_bindir=/path/to/postgres/bin
4. Register the master node with repmgr: 4. Register the master node with repmgr:
$ repmgr -f $HOME/repmgr/repmgr.conf --verbose standby register $ repmgr -f $HOME/repmgr/repmgr.conf --verbose standby register
Opening configuration file: /path/to/repmgr/repmgr.conf Opening configuration file: /path/to/repmgr/repmgr.conf
[2014-07-04 11:48:13] [INFO] repmgr connecting to standby database [2014-07-04 11:48:13] [INFO] repmgr connecting to standby database
[2014-07-04 11:48:13] [INFO] repmgr connected to standby, checking its state [2014-07-04 11:48:13] [INFO] repmgr connected to standby, checking its state
[2014-07-04 11:48:13] [INFO] repmgr connecting to master database [2014-07-04 11:48:13] [INFO] repmgr connecting to master database
[2014-07-04 11:48:13] [INFO] finding node list for cluster 'test' [2014-07-04 11:48:13] [INFO] finding node list for cluster 'test'
[2014-07-04 11:48:13] [INFO] checking role of cluster node 'host=repmgr_node1 user=repmgr_usr dbname=repmgr_db' [2014-07-04 11:48:13] [INFO] checking role of cluster node 'host=repmgr_node1 user=repmgr_usr dbname=repmgr_db'
[2014-07-04 11:48:13] [INFO] repmgr connected to master, checking its state [2014-07-04 11:48:13] [INFO] repmgr connected to master, checking its state
[2014-07-04 11:48:13] [INFO] repmgr registering the standby [2014-07-04 11:48:13] [INFO] repmgr registering the standby
[2014-07-04 11:48:13] [INFO] repmgr registering the standby complete [2014-07-04 11:48:13] [INFO] repmgr registering the standby complete
[2014-07-04 11:48:13] [NOTICE] Standby node correctly registered for cluster test with id 2 (conninfo: host=localhost user=repmgr_usr dbname=repmgr_db) [2014-07-04 11:48:13] [NOTICE] Standby node correctly registered for cluster test with id 2 (conninfo: host=localhost user=repmgr_usr dbname=repmgr_db)
Monitoring Monitoring
---------- ----------