Então, cheguei ao ponto de ter todos os serviços em execução quando configurei o cluster, mas depois da reinicialização estou recebendo o seguinte:
Full list of resources:
virtual_ip (ocf::heartbeat:IPaddr2): Started node1
webserver (ocf::heartbeat:apache): Stopped
Master/Slave Set: WebDataClone [WebData]
Masters: [ node2 ]
Slaves: [ node1 ]
WebFS (ocf::heartbeat:Filesystem): Started node2
sqlfs (ocf::heartbeat:Filesystem): Stopped
Master/Slave Set: SQLDataClone [SQLData]
Masters: [ node1 ]
Slaves: [ node2 ]
Ações com falha:
sqlfs_start_0 on node1 'unknown error' (1): call=26, status=complete, last-rc-change='Sat Jun 4 00:57:27 2016', queued=0ms, exec=32ms
sqlfs_start_0 on node2 'unknown error' (1): call=34, status=complete, last- rc-change='Sat Jun 4 00:57:27 2016', queued=0ms, exec=59ms
Isso é o que eu usei para minha configuração do SQL:
resource sqldata {
protocol C;
disk /dev/sdb2;
device /dev/drbd1;
startup {
wfc-timeout 30;
outdated-wfc-timeout 20;
degr-wfc-timeout 30;
}
net {
cram-hmac-alg sha1;
shared-secret sync_disk;
}
syncer {
rate 10M;
al-extents 257;
on-no-data-accessible io-error;
verify-alg sha1;
}
on node1.freesoftwareservers.com {
address 192.168.1.218:7788;
flexible-meta-disk internal;
}
on node2.freesoftwareservers.com {
address 192.168.1.221:7788;
meta-disk internal;
}
}
Inicie o DRBD e sincronize:
drbdadm -- --overwrite-data-of-peer primary sqldata
drbdadm primary --force sqldata
watch cat /proc/drbd
My.cnf modificado é alterado em ambos os servidores:
service mysqld stop
sudo nano /etc/my.cnf
Change in /etc/my.cnf :
#bind-address = 127.0.0.1
#Make Virtual_IP
bind-address = 192.168.1.215
#datadir=/var/lib/mysql
#Where DRBD will Mount
datadir=/var/lib/mysql_drbd
Mount and Populate with Data :
Montar e preencher drbd1:
/sbin/mkfs.ext4 /dev/drbd1
mkdir /mnt/drbd1
mount /dev/drbd1 /mnt/drbd1
mv /var/lib/mysql_drbd/* /mnt/drbd1/
chcon -R --reference=/var/lib/mysql /mnt/drbd1
umount /dev/drbd1
ESTA É A CONFIGURAÇÃO QUE PARECE FALHAR:
pcs cluster start --all
pcs cluster cib sqlfs_cfg
pcs -f sqlfs_cfg resource create sqlfs ocf:heartbeat:Filesystem device="/dev/drbd1" directory="/var/lib/mysql_drbd" fstype="ext4"
pcs -f sqlfs_cfg constraint colocation add sqlfs with SQLDataClone INFINITY with-rsc-role=Master
pcs -f sqlfs_cfg constraint order promote SQLDataClone then start sqlfs
pcs -f sqlfs_cfg constraint colocation add webserver with sqlfs INFINITY
pcs -f sqlfs_cfg constraint order sqlfs then webserver
pcs -f sqlfs_cfg constraint
pcs -f sqlfs_cfg resource show
pcs cluster cib-push sqlfs_cfg
sqlfs_drbd_cfg:
pcs cluster start --all
pcs cluster cib sqlfs_drbd_cfg
pcs -f sqlfs_drbd_cfg resource create SQLData ocf:linbit:drbd drbd_resource=sqldata op monitor interval=60s
pcs -f sqlfs_drbd_cfg resource master SQLDataClone SQLData master-max=1 master- node-max=1 clone-max=2 clone-node-max=1 notify=true
pcs -f sqlfs_drbd_cfg resource show
pcs cluster cib-push sqlfs_drbd_cfg
Defina o Local Preferido no node1 AKA Primary:
pcs constraint location sqlfs prefers node1=50
Alguma ideia de como solucionar isso? Novamente, funcionou durante a configuração inicial e quebrou após a reinicialização ...
Obrigado!