暂无图片
暂无图片
暂无图片
暂无图片
暂无图片
Corosync+pacemaker+DRBD+mysql实现高可用(ha)的mysql集群.pdf
591
14页
4次
2021-02-08
25墨值下载
准备环境
1.
Linux版本:CentOS Linux release 7.4.1708 (Core)
192.168.134.144 node1
192.168.134.153 node2
192.168.134.166 vip
Mysql 5.6
借助pcs安装与配置corosyncpacemakerpcs只是一个管理工具)
2.
配置集群的前提:
1)时间同步:
[root@node1 ~]# service ntpd start
[root@node2 ~]# service ntpd start
查看状态:
[root@node1 ~]# ntpstat
synchronised to NTP server (84.16.73.33) at stratum 2
time correct to within 133 ms
polling server every 64 s
2)配置各节点ssh互信:
node1
[root@node1 ~]# ssh-keygen -t rsa
[root@node1 ~]# scp /root/.ssh/id_rsa.pub root@192.168.134.153:/root/.ssh/authorized_keys
node2:
[root@node2 ~]# ssh-keygen -t rsa
[root@node2 ~]# scp /root/.ssh/id_rsa.pub root@192.168.134.144:/root/.ssh/authorized_keys
3)各节点关闭防火墙与SELinux
Node1:
[root@node1 ~]# cat /etc/selinux/config
SELINUX=disabled
[root@node1 ~]# service firewalld stop
Node2:
[root@node2 ~]# cat /etc/selinux/config
SELINUX=disabled
[root@node2 ~]# service firewalld stop
安装pacemaker相关组件:
两个节点上都要执行:
yum install pcs pacemaker corosync fence-agents-all -y
报错:
Error: Package: python2-subprocess32-3.2.6-16.el6.x86_64 (epel)
Requires: libpython2.6.so.1.0()(64bit)
Error: Package: python2-subprocess32-3.2.6-16.el6.x86_64 (epel)
Requires: python(abi) = 2.6
Installed: python-2.7.5-58.el7.x86_64 (@anaconda)
python(abi) = 2.7
python(abi) = 2.7
Available: python-2.7.5-89.el7.x86_64 (base)
python(abi) = 2.7
python(abi) = 2.7
Corosync+pacemaker+DRBD+mysql实现高可用(ha)的mysql集群
2020128
11:26
分区 Corosync+pacemaker+DRBD+mysql实现高可用(ha)的mysql集群 的第 1
python(abi) = 2.7
Available: python-2.7.5-90.el7.x86_64 (updates)
python(abi) = 2.7
python(abi) = 2.7
Available: python3-3.6.8-17.el7.i686 (base)
python(abi) = 3.6
python(abi) = 3.6
Available: python3-3.6.8-18.el7.i686 (updates)
python(abi) = 3.6
python(abi) = 3.6
Available: python34-3.4.10-4.el6.i686 (epel)
python(abi) = 3.4
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
解决方法:
先卸载 epel-release源
[root@node1 ~]# yum install epel-release -y
清理yum源缓存和新建缓存:
[root@node1 ~]# yum clean all
[root@node1 ~]# yum makecache
两节点上启动pcs并且开机启动:
[root@node1 ~]# systemctl start pcsd.service
[root@node1 ~]# systemctl enable pcsd.service
两节点上修改用户hacluster的密码(用户已经固定不可以改变)
[root@node1 ~]# passwd hacluster
注册pcs集群主机(默认注册使用用户名hacluster,和密码)
[root@node1 ~]# pcs cluster auth node1 node2 ##设置注册那个集群节点
Username: hacluster
Password:
node1: Authorized
node2: Authorized
在集群上注册两台集群
[root@node1 ~]# pcs cluster setup --name mycluster node1 node2 --force
Destroying cluster on nodes: node1, node2...
node1: Stopping Cluster (pacemaker)...
node2: Stopping Cluster (pacemaker)...
node1: Successfully destroyed cluster
node2: Successfully destroyed cluster
Sending 'pacemaker_remote authkey' to 'node1', 'node2'
node1: successful distribution of the file 'pacemaker_remote authkey'
node2: successful distribution of the file 'pacemaker_remote authkey'
Sending cluster config files to the nodes...
node1: Succeeded
node2: Succeeded
Synchronizing pcsd certificates on nodes node1, node2...
node1: Success
node2: Success
Restarting pcsd on the nodes in order to reload the certificates...
node1: Success
node2: Success
接下来就在某个节点上已经生成来corosync配置文件:
[root@node1 corosync]# ls
corosync.conf corosync.conf.example corosync.conf.example.udpu corosync.xml.example uidgid.d
可以看到已经生成了corosync.conf配置文件
我们看一下注册进来的文件:
[root@node1 corosync]# pwd
分区 Corosync+pacemaker+DRBD+mysql实现高可用(ha)的mysql集群 的第 2
of 14
25墨值下载
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文档的来源(墨天轮),文档链接,文档作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

文档被以下合辑收录

评论

关注
最新上传
暂无内容,敬请期待...
下载排行榜
Top250 周榜 月榜