-
Notifications
You must be signed in to change notification settings - Fork 0
/
commands.txt
executable file
·42 lines (33 loc) · 1.79 KB
/
commands.txt
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
# Run these commands on one node only...
pcs cluster auth node1 node2 node3 -u hacluster -p redhat
pcs cluster setup --name mycluster node1 node2 node3
pcs cluster start --all
pcs cluster enable --all
pcs property set stonith-enabled=false
pcs node standby node3
pcs cluster cib drbd_cfg
pcs -f drbd_cfg resource create DrbdDataVolume ocf:linbit:drbd drbd_resource=testdata1 op monitor interval=60s
pcs -f drbd_cfg resource ban DrbdDataVolume node3
pcs -f drbd_cfg resource master DrbdData DrbdDataVolume master-max=1 master-node-max=1 clone-max=2 clone-node-max=1 notify=true
pcs cluster cib-push drbd_cfg
drbdadm attach testdata1
drbdadm primary testdata1 --force
mkfs.ext3 /dev/drbd0
mount /dev/drbd0 /mnt
mkdir /mnt/mysql
chown -R mysql:mysql /mnt/mysql
mysqld --initialize-insecure --user=mysql
pcs cluster cib resource_cfg
pcs -f resource_cfg resource create filesystem_1 Filesystem device="/dev/drbd0" directory="/mnt" fstype="ext3"
pcs -f resource_cfg resource create virtual_ip_1 ocf:heartbeat:IPaddr2 ip="172.16.2.41" cidr_netmask=32 nic="eth1:1" op monitor interval=30s
pcs -f resource_cfg resource create mysql_1 systemd:mysqld op monitor interval=10s
pcs -f resource_cfg constraint colocation add filesystem_1 with DrbdData INFINITY with-rsc-role=Master
pcs -f resource_cfg constraint order promote DrbdData then start filesystem_1
pcs -f resource_cfg resource group add database_a filesystem_1 virtual_ip_1 mysql_1
pcs cluster cib-push resource_cfg
mysql --execute="CREATE USER 'root'@'172.16.2.0/255.255.255.0';"
mysql --execute="GRANT ALL PRIVILEGES ON *.* TO 'root'@'172.16.2.0/255.255.255.0' WITH GRANT OPTION;"
mysql --execute="GRANT PROXY ON ''@'' TO 'root'@'172.16.2.0/255.255.255.0' WITH GRANT OPTION;"
# on the other node run this
drbdadm attach testdata1
drbd-overview (make sure it gets synced up)