因此,我在配置集群时已经运行了所有服务,但重新启动后我得到以下信息:
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
在节点 1(AKA Primary)上设置首选位置:
pcs constraint location sqlfs prefers node1=50
关于如何解决这个问题有什么想法吗?同样,它在初始配置期间工作,并在重新启动后崩溃......
谢谢!
答案1
我没有在 Pacemaker 中看到 mysql 的定义;您是在集群启动后手动启动还是在启动时启动?
如果它在启动时启动,它可能会在 Pacemaker 之前启动,因此会锁定挂载点(数据应该在的位置),这将导致文件系统资源无法在那里挂载文件系统。
有点盲目,但如果是这种情况,您应该禁用 mysql 在启动时启动,然后在集群中定义它。