File: README.md

package info (click to toggle)
resource-agents-paf 2.2.1-1
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 340 kB
  • sloc: perl: 1,811; sh: 208; makefile: 27
file content (152 lines) | stat: -rw-r--r-- 3,827 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# How to bootstrap a cluster using vagrant

This `Vagrantfile` is bootstrapping a fresh cluster with:

* servers `srv1`, `srv2` and `srv3` hosting a pgsql cluster with streaming replication
* pgsql primary is on `srv1` and the two standby are on `srv2` and `srv3`
* server `log-sink` where all logs from `srv1`, `srv2` and `srv3` are collected under `/var/log/<server>`
* pacemaker stack is setup on `srv1`, `srv2` and `srv3`
* fencing using fence_virsh
* watchdog enabled

Note that NTP is enabled by default (using chrony) in the vagrant box used (`centos/7`).
No need to set it up ourselves.

## Prerequisites:


You need `vagrant` and `vagrant-libvirt`. Everything is tested with versions 2.0.2 and
0.0.40. Please, report your versions if it works with inferior ones.

~~~
apt install make vagrant vagrant-libvirt libvirt-clients # for Debian-like
yum install make vagrant vagrant-libvirt libvirt-client # for RH-like
dnf install make vagrant vagrant-libvirt libvirt-client # for recent RH-like
systemctl enable --now libvirtd
~~~

Alternatively, you might be able to install vagrant-libvirt only for your current user
using (depending on the system, this might not work):

~~~
vagrant plugin install vagrant-libvirt
~~~

Pacemaker must be able to ssh to the libvirt host with no password using a user able
to `virsh destroy $other_vm`. Here are the steps:

* copy `<PAF>/test/ssh/id_rsa.pub` inside `user@host:~/.ssh/authorized_keys`
* edit `ssh_login` in the `vagrant.yml` configuration file
* user might need to be in group `libvirt`
* user might need to add `uri_default='qemu:///system'` in its
  file `~<user>/.config/libvirt/libvirt.conf`
* make sure sshd is started on the host

Here is a setup example:

~~~
####  Replace "myuser" with your usual user  ####
root$ systemctl start sshd
root$ export MYUSER=myuser
root$ usermod -a -G libvirt "$MYUSER"
root$ su - $MYUSER
myuser$ mkdir -p "${HOME}/.config/libvirt"
myuser$ echo "uri_default='qemu:///system'" > "${HOME}/.config/libvirt/libvirt.conf"
myuser$ git clone https://github.com/ClusterLabs/PAF.git
myuser$ cd PAF/test
myuser$ cat "ssh/id_rsa.pub" >> "${HOME}/.ssh/authorized_keys"
myuser$ echo "ssh_login: \"$USER\"" >> vagrant.yml
~~~

## Creating the cluster

To create the cluster, run:

~~~
cd PAF/test
make all
~~~

After some minutes and tons of log messages, you can connect to your servers using eg.:

~~~
vagrant ssh srv1
vagrant ssh log-sink
~~~

## Destroying the cluster

To destroy your cluster, run:

~~~
vagrant destroy -f
~~~


## Customization

You can edit file `vagrant.yml`:

~~~
cp vagrant.yml-dist vagrant.yml
$EDITOR vagrant.yml
make clean
make all
~~~

## Cluster Test Suite

You can install the Cluster Test Suite from the Pacemaker project using:

~~~
vagrant up --provision-with=cts
~~~

Then, you'll be able to start the exerciser from the log-sink server using eg.:

~~~
vagrant ssh -c "sudo pcs cluster stop --all"
vagrant ssh log-sink
sudo -i
cd /usr/share/pacemaker/tests/cts
./CTSlab.py --nodes "srv1 srv2 srv3" --outputfile ~/cts.log --once
~~~

You can select the test you want to run with:

~~~
./CTSlab.py --nodes "srv1 srv2 srv3" --list-tests
./CTSlab.py --nodes "srv1 srv2 srv3" --outputfile ~/cts.log --choose <$NAME> 1
~~~

Where `<$NAME>` is the name of the test you want to run.

You can select exercise the cluster randomly and repetitively with:

~~~
./CTSlab.py --nodes "srv1 srv2 srv3" --list-tests
./CTSlab.py --nodes "srv1 srv2 srv3" --outputfile ~/cts.log <$NTESTS>
~~~

## Tips

Find all existing VM created by vagrant on your system:

~~~
vagrant global-status
~~~

Shutdown all VM:

~~~
vagrant ssh -c "sudo pcs resource disable pgsql-ha --wait"
vagrant halt
~~~

Restart cluster:

~~~
vagrant up
vagrant ssh -c "sudo pcs cluster start --all"
vagrant ssh -c "sudo pcs resource enable pgsql-ha --wait"
~~~