Cluster
MySQL DRBD 資源無法啟動 PaceMaker + Corosync
因此,當我配置集群時,我已經達到了所有服務都在執行的地步,但是在重新啟動後,我得到了以下資訊:
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 ]
失敗的動作:
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
這是我用於我的 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; } }
啟動 DRBD 並同步:
drbdadm -- --overwrite-data-of-peer primary sqldata drbdadm primary --force sqldata watch cat /proc/drbd
修改後的 my.cnf 在兩台伺服器上都發生了變化:
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 :
掛載並填充 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
這是似乎失敗的配置:
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
在 node1 AKA Primary 上設置首選位置:
pcs constraint location sqlfs prefers node1=50
有關如何解決此問題的任何想法?同樣,它在初始配置期間工作,並在重新啟動後中斷……
謝謝!
我沒有看到 Pacemaker 中定義了 mysql;您是在集群啟動後手動啟動它還是在啟動時啟動它?
如果它在啟動時啟動,它可能在 Pacemaker 之前啟動,因此會鎖定安裝點(數據應該在哪裡),這將導致文件系統資源無法在那里安裝文件系統。
有點像在黑暗中拍攝,但如果是這種情況,您應該禁用 mysql 從啟動時啟動,然後在集群中定義它。