Corosync and pacemaker implement httpd and mysql dual Clusters
I. Environment Introduction: Three are dual NIC: openstack-control.example.com openstack-control eth0: 172.16.171.100 eth1: 10.1.1.100 openstack-nova.example.com openstack-nova eth0: 172.16.171.110 eth1: Drawing openstack-neutron eth0: 172.16.171.120 eth1: 10.1.1.120 II. The configuration steps of corosync and pacemaker are as follows: 1. Configure the time zone and synchronization time. 2. Configure the host name to communicate with each other among cluster nodes. 3. Configure the cluster host so that the root user can communicate with each other using the password-free ssh key. 4. Disable selinux and iptables5, install corosync and pacemaker packages 6. Modify corosync. conf configuration file compatibility: whitetank totem {version: 2 secauth: on threads: 2 rrp_mode: passive interface {ringnumber: 0 bindnetaddr: 10.1.1.0 mcastaddr: 239.20.1.1 mcastport: 5405 ttl: 1} interface {ringnumber: 1 bindnetaddr: 172.16.171.0 mcastaddr: 238.20.1.1 mcastport: 5406 ttl: 1} logging {fileline: off to_stderr: no to_logfile: yes logfile: /var/log/cluster/corosync. log to_syslog: no debug: off timestamp: on logger_subsys {subsys: AMF debug: off} service {ver: 0 name: pacemaker} 7. Generate the authentication file: authkey and send it to other cluster servers 8. Start the corosync service, view the log 9, and install crmsh http://download.opensuse.org/repositories/network:/ha-clustering:/Stable/CentOS_CentOS-6/ [Network_ha-clustering_Stable] name = Stable High Availability/Clustering packages (CentOS_CentOS-6) type = rpm-mdbaseurl = http://download.opensuse.org/repositories/network:/ha-clustering:/Stable/CentOS_CentOS-6/ Gpgcheck = 1 gpgkey = http://download.opensuse.org/repositories/network:/ha-clustering:/Stable/CentOS_CentOS-6/ Repodata/repomd. xml. keyenabled = 1 10. Use the crmsh tool to configure global attributes crm (live) # configurecrm (live) configure # property stonith-enabled = falsecrm (live) configure # property no-quorum-policy = ignorecrm (live) configure # property default-resource-stickiness = 100 11. Use the crmsh tool to configure the coordination constraints (arrangement constraints) for ip resources, nfs resources, and mysql resources) and sequential constraints mysql: crm (live) configure # primitive mysqlvip ocf: heartbeat: IPaddr params ip = '10. 1.1.200 'nic = 'eth1' cidr_netmask = '24' broadcast = '10. 1.1.0 'Op monitor interval = 30 s (startup delay time) timeout = 20 s (Monitoring timeout time) crm (live) configure # primitive mysqlnfs ocf: heartbeat: filesystem params device = '10. 1.1.100:/mysqldata 'Directory = '/mydata' fstype = 'nfs' op monitor interval = 20 s timeout = 40 s crm (live) configure # verify crm (live) configure # primitive mysqlserver lsb: mysqld op monitor interval = 30 s timeout = 15 s crm (live) configure # colocation myserver inf: mysqlvip mysqlnfs mysqlserver crm (live) configure # order mysqlnfs_before_mysqlserver mandatory: mysqlnfs mysqlserverhttpd: crm (live) configure # primitive httpdvip ocf: heartbeat: IPaddr params ip = '2017. 16.171.200 'nic = 'eth0' cidr_netmask = '24' broadcast = '2017. 16.171.0 'Op monitor interval = 30 s (startup delay time) timeout = 20 s (Monitoring timeout time) crm (live) configure # primitive httpdnfs ocf: heartbeat: filesystem params device = '2017. 16.171.100:/myhttpd 'Directory = '/var/www/html' fstype = 'nfs 'op monitor interval = 20 s timeout = 40 s crm (live) configure # verify crm (live) configure # primitive httpdserver lsb: httpd op monitor interval = 30 s timeout = 15 s crm (live) configure # colocation myapacheserver inf: httpdvip httpdnfs httpdserver crm (live) configure # order httpdnfs_before_httpdserver mandatory: httpdnfs httpdserver specific view such as: wKioL1YBf1-TpZ9EAAOqpvAua-Y334.jpg 12, view node information crm (live) # statusLast updated: wed Sep 23 00:08:39 2015 Last change: Wed Sep 23 00:08:33 2015 Stack: classic openais (with plugin) Current DC: openstack-control.example.com-partition with quorumVersion: 1.1.11-97629de3 Nodes configured, 3 expected votes6 Resources configured Online: [openstack-control.example.com openstack-neutron.example.com openstack-nova.example.com] mysqlnfs (ocf: heartbeat: Filesystem): Started openstack-control.example.com mysqlvip (ocf: heartbeat: IPaddr): Started openstack-control.example.com mysqlserver (lsb: mysqld): Started openstack-control.example.com httpdvip (ocf: heartbeat: IPaddr): Started openstack-control.example.com httpdnfs (ocf: heartbeat: Filesystem): Started openstack-control.example.com httpdserver (lsb: httpd ): the Started openstack-control.example.com performs a master-slave switchover by using the following: node online openstack-neutron.example.com node standby openstack-neutron.example.com