Corosync and pacemaker implement HTTPD and MySQL dual cluster

Source: Internet
Author: User
Tags time zones free ssh


First, the environment introduction:


Three are dual network cards:

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:10.1.1.110

Openstack-neutron.example.com Openstack-neutron

eth0:172.16.171.120

eth1:10.1.1.120


Second, Corosync and pacemaker configuration steps are as follows:

1. Configure time zones and sync times

2. Configure the cluster nodes to communicate with each other by host name

3. Configure the cluster host to enable the root user to communicate based on the password-free SSH secret key mode

4. Turn off selinux and iptables

5. Install corosync and pacemaker Package

6. Modifying the 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.255.1.1
mcastport:5405
Ttl:1
}
interface {
Ringnumber:1
bindnetaddr:172.16.171.0
mcastaddr:238.255.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 Authentication file: Authkey and pass to other cluster server

8. Start the Corosync service and view the log

9, installation 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-MD
baseurl=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.key
Enabled=1


10. Configure global properties using the Crmsh tool

CRM (Live) #configure
CRM (live) Configure#property Stonith-enabled=false
CRM (live) Configure#property No-quorum-policy=ignore
CRM (live) Configure#property default-resource-stickiness=100


11. Use the CRMSH tool to configure IP Resources, NFS resources, and MySQL resources and configure the coordination constraints (permutation constraints), order constraints for both resources

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=30s (startup delay time) timeout=20s (monitoring timeout)

CRM (Live) configure#primitive mysqlnfs ocf:heartbeat:Filesystem params device= ' 10.1.1.100:/mysqldata ' directory= '/ MyData ' Fstype= ' NFS ' OP monitor interval=20s timeout=40s

CRM (Live) Configure#verify

CRM (Live) Configure#primitive mysqlserver lsb:mysqld op monitor interval=30s timeout=15s

CRM (Live) configure#colocation myserver INF:MYSQLVIP Mysqlnfs MySQLServer

CRM (Live) Configure#order mysqlnfs_before_mysqlserver Mandatory:mysqlnfs MySQLServer

httpd

CRM (Live) configure#primitive httpdvip ocf:heartbeat:IPaddr params ip= ' 172.16.171.200 ' nic= ' eth0 ' cidr_netmask= ' 24 ' Broadcast= ' 172.16.171.0 ' OP monitor interval=30s (startup delay time) timeout=20s (monitoring timeout)

CRM (Live) configure#primitive httpdnfs ocf:heartbeat:Filesystem params device= ' 172.16.171.100:/myhttpd ' directory= '/ Var/www/html ' Fstype= ' NFS ' OP monitor interval=20s timeout=40s

CRM (Live) Configure#verify

CRM (Live) Configure#primitive httpdserver lsb:httpd op monitor interval=30s timeout=15s

CRM (Live) configure#colocation myapacheserver inf:httpdvip Httpdnfs httpdserver

CRM (Live) Configure#order httpdnfs_before_httpdserver Mandatory:httpdnfs httpdserver


See details such as:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/95/wKioL1YBf1-TpZ9EAAOqpvAua-Y334.jpg "title=" aa.png "alt=" Wkiol1ybf1-tpz9eaaoqpvaua-y334.jpg "/>


12. View node Status


CRM (live) # Status
Last 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 Quorum
Version:1.1.11-97629de
3 Nodes configured, 3 expected votes
6 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): Started openstack-control.example.com


The main standby switch is as follows:

Node Online openstack-neutron.example.com

Node Standby openstack-neutron.example.com


This article is from the "Autumn Fairy tale" blog, please be sure to keep this source http://wushank.blog.51cto.com/3489095/1697290

Corosync and pacemaker implement HTTPD and MySQL dual cluster

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.