1. Preparation before installation
High-availability clusters generally need to configure time synchronization, based on host name Mutual communication, SSH mutual trust communication, Corosync Pacemaker only need to configure time synchronization, based on host name to communicate with each other:
yum install chrony #安装chronyvim /etc/chrony.conf server172.16.0.1 iburst #设置为可用的ntp服务器systemctl restart chronyd #启动服务vim /etc/ hosts #将hosts文件分发给每个节点 172.16.19.21 node1 172.16.19.22 node2 172.16.19.23 node3 172.16.19.24 node4vim /etc/hostname #配置每个节点的主机名, corresponding to the host file node1
2, Corosyncpacemaker installation and basic configuration
yum -yinstall corosync pacemakercp /etc/corosync/corosync.conf.example/etc/corosync/ corosync.confcorosync-keygen -l #生成通信秘钥分发给各个节点vim /etc/corosync/corosync.conf crypto_cipher: aes128 crypto_hash: md5 bindnetaddr:172.16.0.0 #此处填网络地址即可 mcastaddr: 239.255.1.1 # Modify provider: corosync_votequorum nodelist { as needed #配置集群节点 node { ring0_addr:node1 nodeid: 1 } node { ring0_addr:node2 nodeid: 2 } node { ring0_addr:node3 nodeid: 3 } node { ring0_addr:node4 nodeid: 4 }}scp /etc/corosync/corosync.conf172.16.19.22:/etc/corosync/ # Distributing the configuration file to each node Systemctl start corOsync systemctl start pacemaker
3, Installation Crmsh
Pacemaker itself is just a resource manager, we need an interface to define and manage resources on the Pacemker, and Crmsh is the Pacemaker configuration interface, the following three RPM packages can be installed:
RPM-IVHCRMSH-2.1.4-1.1.X86_64.RPMRPM-IVH pssh-2.3.1-4.2.x86_64.rpmrpm-ivhpython-pssh-2.3.1-4.2.x86_64.rpm
4. Configure RA Resources
execution at any node CRM Command , Enter Crmsh command line:
CRM (Live) configure# primitive Mariadbip ocf:heartbeat:IPaddr params ip=172.16.19.88 op monitor interval=20stimeout= 10scrm (Live) configure#primitive mariadb ocf:heartbeat:mariadb op monitor interval=10s TIMEOUT=20SCRM (live) configure# Primitive NFS Ocf:heartbeat:Filesystem params device=172.16.19.22:/webdatadirectory=/sqldata fstype=nfs op Monitor interval=10s timeout=20sgroup SQL Server mariadb NFS #配置资源组, allowing Mariadbip, mariadb, NFS to always be on a single node
5. MARIADB Configuration
VIM/ETC/MY.CNF #每节点均需配置 Datadir=/sqldata #指向nfs挂载目录
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/86/73/wKiom1e-5FvCA5YLAAE_TN7tMiQ989.jpg "title=" 2016-08-25_20-25-15.jpg "alt=" Wkiom1e-5fvca5ylaae_tn7tmiq989.jpg "/>
Corosync Pacemaker High-availability Mariadb