postgresql高可用性pacemaker+corosyncの7 remove node


os: ubuntu 16.04 db: postgresql 9.6.8 pacemaker: Pacemaker 1.1.14 Written by Andrew Beekhof corosync: Corosync Cluster Engine, version ‘2.3.5’
前の記事では、ノードの追加について説明しました.この記事では、ノードを削除する現在のクラスタについて説明します.
vip-mas 192.168.56.119 
vip-sla 192.168.56.120

node1 192.168.56.92
node2 192.168.56.90
node3 192.168.56.88
node4 192.168.56.86


ノードnode 4の削除
現在のクラスタの状況
# crm_mon -Afr -1

Last updated: Tue Feb 19 12:00:58 2019		Last change: Tue Feb 19 11:58:18 2019 by root via crm_attribute on node1
Stack: corosync
Current DC: node1 (version 1.1.14-70404b0) - partition with quorum
4 nodes and 7 resources configured

Online: [ node1 node2 node3 node4 ]

Full list of resources:

 Master/Slave Set: msPostgresql [pgsql]
     Masters: [ node1 ]
     Slaves: [ node2 node3 node4 ]
 Resource Group: master-group
     vip-mas	(ocf::heartbeat:IPaddr2):	Started node1
     vip-sla	(ocf::heartbeat:IPaddr2):	Started node1

Node Attributes:
* Node node1:
    + master-pgsql                    	: 1000      
    + pgsql-data-status               	: LATEST    
    + pgsql-master-baseline           	: 0000000017000098
    + pgsql-status                    	: PRI       
* Node node2:
    + master-pgsql                    	: -INFINITY 
    + pgsql-data-status               	: STREAMING|ASYNC
    + pgsql-status                    	: HS:async  
* Node node3:
    + master-pgsql                    	: -INFINITY 
    + pgsql-data-status               	: STREAMING|ASYNC
    + pgsql-status                    	: HS:async  
    + pgsql-xlog-loc                  	: 0000000017000140
* Node node4:
    + master-pgsql                    	: -INFINITY 
    + pgsql-data-status               	: STREAMING|ASYNC
    + pgsql-status                    	: HS:async  
    + pgsql-xlog-loc                  	: 0000000017000140

Migration Summary:
* Node node1:
* Node node3:
* Node node2:
* Node node4:


上から分かるようにnode 1は現在masterです
node 4の削除
# pcs cluster node remove 192.168.56.86

192.168.56.86: Stopping Cluster (pacemaker)...
192.168.56.86: Successfully destroyed cluster
192.168.56.92: Corosync updated
192.168.56.90: Corosync updated
192.168.56.88: Corosync updated

# crmadmin -N

(null) node: node1 (1)
(null) node: node2 (2)
(null) node: node3 (3)
(null) node: node4 (4)

# crm_node -R node4 --force
# crm_node -R 192.168.56.86 --force

# crmadmin -N
(null) node: node1 (1)
(null) node: node2 (2)
(null) node: node3 (3)

# pcs status

Cluster name: pgcluster
WARNING: corosync and pacemaker node names do not match (IPs used in setup?)
Last updated: Tue Feb 19 13:30:22 2019		Last change: Tue Feb 19 13:30:17 2019 by root via crm_node on node1
Stack: corosync
Current DC: node1 (version 1.1.14-70404b0) - partition with quorum
3 nodes and 7 resources configured

Online: [ node1 node2 node3 ]

Full list of resources:

 Master/Slave Set: msPostgresql [pgsql]
     Masters: [ node1 ]
     Slaves: [ node2 node3 ]
 Resource Group: master-group
     vip-mas	(ocf::heartbeat:IPaddr2):	Started node1
     vip-sla	(ocf::heartbeat:IPaddr2):	Started node1

PCSD Status:
  node1 (192.168.56.92): Online
  node2 (192.168.56.90): Online
  node3 (192.168.56.88): Online

Daemon Status:
  corosync: active/enabled
  pacemaker: active/enabled
  pcsd: active/enabled
  
postgres@node1:~$ psql -c "select * from pg_stat_replication;"

  pid  | usesysid | usename | application_name |  client_addr  | client_hostname | client_port |         backend_start         | backend_xmin |   state   | sent_location | write_location | flush_location | replay_location | sync_priority | sync_state 
-------+----------+---------+------------------+---------------+-----------------+-------------+-------------------------------+--------------+-----------+---------------+----------------+----------------+-----------------+---------------+------------
 25246 |    16384 | repl    | node2            | 192.168.56.90 |                 |       48146 | 2019-02-19 13:30:37.044977+08 |          588 | streaming | 0/1A000060    | 0/1A000060     | 0/1A000060     | 0/1A000060      |             0 | async
  7960 |    16384 | repl    | node3            | 192.168.56.88 |                 |       44532 | 2019-02-19 12:37:38.598882+08 |          588 | streaming | 0/1A000060    | 0/1A000060     | 0/1A000060     | 0/1A000060      |             0 | async
(2 rows)


参照先: