ansible redhat cluster qorum qdevice
- hosts: localhost
user: root
become: yes
become_method: sudo
tasks:
- name: high availability is removed/installed
yum: name='@High Availability' state=present
- name: resilent storage is removed/installed
yum: name='@Resilient Storage' state=present
- name: install pcs pacemaker fence-agent-all
command: yum install pcs pacemaker fence-agents-all
- name: pcsd is running and enabled
service:
name=pcsd
state=started
enabled=yes
- firewalld:
service: high-availability
permanent: yes
state: enabled
user: root
become: yes
become_method: sudo
tasks:
- name: high availability is removed/installed
yum: name='@High Availability' state=present
- name: resilent storage is removed/installed
yum: name='@Resilient Storage' state=present
- name: install pcs pacemaker fence-agent-all
command: yum install pcs pacemaker fence-agents-all
- name: pcsd is running and enabled
service:
name=pcsd
state=started
enabled=yes
- firewalld:
service: high-availability
permanent: yes
state: enabled
[root@localhost ~]# pcs cluster setup --start --name cluster cluster1 cluster2 --force
Destroying cluster on nodes: cluster1, cluster2...
cluster1: Stopping Cluster (pacemaker)...
cluster2: Stopping Cluster (pacemaker)...
cluster1: Successfully destroyed cluster
cluster2: Successfully destroyed cluster
Sending 'pacemaker_remote authkey' to 'cluster1', 'cluster2'
cluster2: successful distribution of the file 'pacemaker_remote authkey'
cluster1: successful distribution of the file 'pacemaker_remote authkey'
Sending cluster config files to the nodes...
cluster1: Succeeded
cluster2: Succeeded
Starting cluster on nodes: cluster1, cluster2...
cluster1: Starting Cluster (corosync)...
cluster2: Starting Cluster (corosync)...
cluster1: Starting Cluster (pacemaker)...
cluster2: Starting Cluster (pacemaker)...
Synchronizing pcsd certificates on nodes cluster1, cluster2...
cluster2: Success
cluster1: Success
Restarting pcsd on the nodes in order to reload the certificates...
cluster2: Success
cluster1: Success
[root@localhost ~]# ansible-playbook pace.yml
PLAY [Set cluster Online] ****************************************************************************************************************************
TASK [Get cluster state] *****************************************************************************************************************************
ok: [localhost]
PLAY RECAP *******************************************************************************************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=0
[root@localhost ~]# pcs status
Cluster name: cluster
WARNINGS:
No stonith devices and stonith-enabled is not false
Stack: corosync
Current DC: cluster1 (version 1.1.20-5.el7_7.1-3c4c782f70) - partition with quorum
Last updated: Sat Oct 26 20:04:34 2019
Last change: Sat Oct 26 20:03:49 2019 by hacluster via crmd on cluster1
2 nodes configured
0 resources configured
Online: [ cluster1 cluster2 ]
No resources
Daemon Status:
corosync: active/disabled
pacemaker: active/disabled
pcsd: active/enabled
Options:
[root@localhost ~]# pcs quorum status
Quorum information
------------------
Date: Sat Oct 26 20:06:50 2019
Quorum provider: corosync_votequorum
Nodes: 2
Node ID: 1
Ring ID: 1/12
Quorate: Yes
Votequorum information
----------------------
Expected votes: 2
Highest expected: 2
Total votes: 2
Quorum: 1
Flags: 2Node Quorate WaitForAll
Membership information
----------------------
Nodeid Votes Qdevice Name
1 1 NR cluster1 (local)
2 1 NR cluster2
on both nodes
[root@localhost ~]# yum install corosync-qdevice
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.piconets.webwerks.in
* epel: my.fedora.ipserverone.com
* extras: mirrors.piconets.webwerks.in
* updates: mirrors.piconets.webwerks.in
Resolving Dependencies
--> Running transaction check
---> Package corosync-qdevice.x86_64 0:2.4.3-6.el7_7.1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
======================================================================================================================================================
Package Arch Version Repository Size
======================================================================================================================================================
Installing:
corosync-qdevice x86_64 2.4.3-6.el7_7.1 updates 126 k
Transaction Summary
======================================================================================================================================================
Install 1 Package
Total download size: 126 k
Installed size: 275 k
Is this ok [y/d/N]: y
Downloading packages:
corosync-qdevice-2.4.3-6.el7_7.1.x86_64.rpm | 126 kB 00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : corosync-qdevice-2.4.3-6.el7_7.1.x86_64 1/1
Verifying : corosync-qdevice-2.4.3-6.el7_7.1.x86_64 1/1
Installed:
corosync-qdevice.x86_64 0:2.4.3-6.el7_7.1
Complete!
root@localhost ~]# yum install pcs corosync-qnetd
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.piconets.webwerks.in
* epel: my.fedora.ipserverone.com
* extras: mirrors.piconets.webwerks.in
* updates: mirrors.piconets.webwerks.in
Package pcs-0.9.167-3.el7.centos.1.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package corosync-qnetd.x86_64 0:2.4.3-6.el7_7.1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
======================================================================================================================================================
Package Arch Version Repository Size
======================================================================================================================================================
Installing:
corosync-qnetd x86_64 2.4.3-6.el7_7.1 updates 99 k
Transaction Summary
======================================================================================================================================================
Install 1 Package
Total download size: 99 k
Installed size: 160 k
Is this ok [y/d/N]: y
Downloading packages:
corosync-qnetd-2.4.3-6.el7_7.1.x86_64.rpm | 99 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : corosync-qnetd-2.4.3-6.el7_7.1.x86_64 1/1
Verifying : corosync-qnetd-2.4.3-6.el7_7.1.x86_64 1/1
Installed:
corosync-qnetd.x86_64 0:2.4.3-6.el7_7.1
Complete!
root@localhost ~]# service corosync-qdevice status
Redirecting to /bin/systemctl status corosync-qdevice.service
● corosync-qdevice.service - Corosync Qdevice daemon
Loaded: loaded (/usr/lib/systemd/system/corosync-qdevice.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Docs: man:corosync-qdevice
[root@localhost ~]# service corosync-qdevice start
Redirecting to /bin/systemctl start corosync-qdevice.service
[root@localhost ~]# pcs qdevice setup model net --enable --start
Quorum device 'net' initialized
quorum device enabled
Starting quorum device...
quorum device started
[root@localhost ~]# service corosync-qnetd start
Redirecting to /bin/systemctl start corosync-qnetd.service
[root@localhost ~]# pcs quorum status
Quorum information
------------------
Date: Sat Oct 26 20:27:43 2019
Quorum provider: corosync_votequorum
Nodes: 2
Node ID: 1
Ring ID: 1/20
Quorate: Yes
Votequorum information
----------------------
Expected votes: 2
Highest expected: 2
Total votes: 2
Quorum: 1
Flags: 2Node Quorate WaitForAll Qdevice
Membership information
----------------------
Nodeid Votes Qdevice Name
1 1 NA,NV,NM cluster1 (local)
2 1 NR cluster2
0 0 Qdevice (votes 0)
[root@localhost ~]# pcs qdevice status net --full
QNetd address: *:5403
TLS: Supported (client certificate required)
Connected clients: 0
Connected clusters: 0
Maximum send/receive size: 32768/32768 bytes
[root@localhost ~]# pcs quorum device add model net host=cluster1 algorithm=ffsplit
Setting up qdevice certificates on nodes...
cluster1: Succeeded
cluster2: Succeeded
Enabling corosync-qdevice...
cluster2: not enabling corosync-qdevice: corosync is not enabled
cluster1: not enabling corosync-qdevice: corosync is not enabled
Sending updated corosync.conf to nodes...
cluster1: Succeeded
cluster2: Succeeded
Corosync configuration reloaded
Starting corosync-qdevice...
cluster2: corosync-qdevice started
cluster1: corosync-qdevice started
[root@localhost ~]# pcs quorum config
Options:
Device:
votes: 1
Model: net
algorithm: ffsplit
host: cluster1
[root@localhost ~]# pcs quorum status
Quorum information
------------------
Date: Sat Oct 26 20:35:36 2019
Quorum provider: corosync_votequorum
Nodes: 2
Node ID: 1
Ring ID: 1/24
Quorate: Yes
Votequorum information
----------------------
Expected votes: 3
Highest expected: 3
Total votes: 3
Quorum: 2
Flags: Quorate WaitForAll Qdevice
Membership information
----------------------
Nodeid Votes Qdevice Name
1 1 A,V,NMW cluster1 (local)
2 1 A,V,NMW cluster2
0 1 Qdevice
[root@localhost ~]# [root@localhost ~]# pcs qdevice setup model net --enable --start
Quorum device 'net' initialized
quorum device enabled
Starting quorum device...
quorum device started
[root@localhost ~]# pcs quorum status
Quorum information
------------------
Date: Sat Oct 26 20:31:27 2019
Quorum provider: corosync_votequorum
Nodes: 2
Node ID: 2
Ring ID: 1/24
Quorate: Yes
Votequorum information
----------------------
Expected votes: 2
Highest expected: 2
Total votes: 2
Quorum: 1
Flags: 2Node Quorate WaitForAll Qdevice
Membership information
----------------------
Nodeid Votes Qdevice Name
1 1 NA,NV,NM cluster1
2 1 NA,NV,NM cluster2 (local)
0 0 Qdevice (votes 0)
[root@localhost ~]# pcs qdevice status net --full
QNetd address: *:5403
TLS: Supported (client certificate required)
Connected clients: 0
Connected clusters: 0
Maximum send/receive size: 32768/32768 bytes
[root@localhost ~]# pcs cluster auth qdevice
Username: hacluster
Password:
Error: Unable to communicate with qdevice
[root@localhost ~]# pcs quorum device add model net host=cluster2 algorithm=ffsplit
Error: quorum device is already defined
[root@localhost ~]# pcs quorum config
Options:
Device:
votes: 1
Model: net
algorithm: ffsplit
host: cluster1
[root@localhost ~]# pcs quorum status
Quorum information
------------------
Date: Sat Oct 26 20:36:29 2019
Quorum provider: corosync_votequorum
Nodes: 2
Node ID: 2
Ring ID: 1/24
Quorate: Yes
Votequorum information
----------------------
Expected votes: 3
Highest expected: 3
Total votes: 3
Quorum: 2
Flags: Quorate WaitForAll Qdevice
Membership information
----------------------
Nodeid Votes Qdevice Name
1 1 A,V,NMW cluster1
2 1 A,V,NMW cluster2 (local)
0 1 Qdevice
[root@localhost ~]# pcs quorum device status
Qdevice information
-------------------
Model: Net
Node ID: 2
Configured node list:
0 Node ID = 1
1 Node ID = 2
Membership node list: 1, 2
Qdevice-net information
----------------------
Cluster name: cluster
QNetd host: cluster1:5403
Algorithm: Fifty-Fifty split
Tie-breaker: Node with lowest node ID
State: Connected
[root@localhost ~]# pcs qdevice status net --full
QNetd address: *:5403
TLS: Supported (client certificate required)
Connected clients: 0
Connected clusters: 0
Maximum send/receive size: 32768/32768 bytes
[root@localhost ~]# pcs quorum device update model algorithm=lms
Sending updated corosync.conf to nodes...
cluster2: Succeeded
cluster1: Succeeded
Corosync configuration reloaded
Reloading qdevice configuration on nodes...
cluster2: corosync-qdevice stopped
cluster1: corosync-qdevice stopped
cluster1: corosync-qdevice started
cluster2: corosync-qdevice started
[root@localhost ~]#
[root@localhost ~]# pcs quorum device remove
Disabling corosync-qdevice...
cluster1: corosync-qdevice disabled
cluster2: corosync-qdevice disabled
Stopping corosync-qdevice...
cluster1: corosync-qdevice stopped
cluster2: corosync-qdevice stopped
Removing qdevice certificates from nodes...
cluster1: Succeeded
cluster2: Succeeded
Sending updated corosync.conf to nodes...
cluster1: Succeeded
cluster2: Succeeded
Corosync configuration reloaded
[root@localhost ~]# pcs quorum device status
Error: Unable to get quorum status: corosync-qdevice-tool: Can't connect to QDevice socket (is QDevice running?): No such file or directory
[root@localhost ~]#
Disabling corosync-qdevice...
cluster1: corosync-qdevice disabled
cluster2: corosync-qdevice disabled
Stopping corosync-qdevice...
cluster1: corosync-qdevice stopped
cluster2: corosync-qdevice stopped
Removing qdevice certificates from nodes...
cluster1: Succeeded
cluster2: Succeeded
Sending updated corosync.conf to nodes...
cluster1: Succeeded
cluster2: Succeeded
Corosync configuration reloaded
[root@localhost ~]# pcs quorum device status
Error: Unable to get quorum status: corosync-qdevice-tool: Can't connect to QDevice socket (is QDevice running?): No such file or directory
[root@localhost ~]#
[root@localhost ~]# pcs qdevice destroy net
Stopping quorum device...
quorum device stopped
quorum device disabled
Quorum device 'net' configuration files removed
[root@localhost ~]#
Stopping quorum device...
quorum device stopped
quorum device disabled
Quorum device 'net' configuration files removed
[root@localhost ~]#
[root@localhost ~]# corosync-quorumtool
Quorum information
------------------
Date: Sat Oct 26 20:46:29 2019
Quorum provider: corosync_votequorum
Nodes: 2
Node ID: 2
Ring ID: 1/24
Quorate: Yes
Votequorum information
----------------------
Expected votes: 2
Highest expected: 2
Total votes: 2
Quorum: 1
Flags: 2Node Quorate WaitForAll
Membership information
----------------------
Nodeid Votes Name
1 1 cluster1
2 1 cluster2 (local)
[root@localhost ~]#
[root@localhost ~]# pcs cluster stop cluster1
cluster1: Stopping Cluster (pacemaker)...
cluster1: Stopping Cluster (corosync)...
[root@localhost ~]# corosync-quorumtool
Quorum information
------------------
Date: Sat Oct 26 20:48:06 2019
Quorum provider: corosync_votequorum
Nodes: 1
Node ID: 2
Ring ID: 2/28
Quorate: Yes
Votequorum information
----------------------
Expected votes: 2
Highest expected: 2
Total votes: 1
Quorum: 1
Flags: 2Node Quorate WaitForAll
Membership information
----------------------
Nodeid Votes Name
2 1 cluster2 (local)
[root@localhost ~]# pcs cluster start cluster1
cluster1: Starting Cluster (corosync)...
cluster1: Starting Cluster (pacemaker)...
[root@localhost ~]# corosync-quorumtool
Quorum information
------------------
Date: Sat Oct 26 20:48:22 2019
Quorum provider: corosync_votequorum
Nodes: 2
Node ID: 2
Ring ID: 1/32
Quorate: Yes
Votequorum information
----------------------
Expected votes: 2
Highest expected: 2
Total votes: 2
Quorum: 1
Flags: 2Node Quorate WaitForAll
Membership information
----------------------
Nodeid Votes Name
1 1 cluster1
2 1 cluster2 (local)
[root@localhost ~]#
Comments
Post a Comment