Use Corosync+pacemaker in Linux under the detailed and installation

Source: Internet
Author: User

Corosync detailed

Openais Overview

Openais is an application interface specification for the SA Forum-based cluster framework. Openais provides a cluster mode, which includes cluster framework, cluster member management, communication mode, cluster monitoring and so on, can provide cluster interface for cluster Software or tool to meet AIS standard, but it does not have cluster resource management function and cannot form a cluster independently. Openais components, including Amf,clm,ckpt,evt,lck,msg,tmr,cpg,evs, vary slightly depending on the Openais branch. Openais mainly consists of three branches: Picacho,whitetank,wilson. Wilson puts the Openais core architecture components out of the Corosync (Corosync is a cluster management engine). (See official documentation for details)

Corosync Overview

Corosync is an open cluster engine project that Openais developed to the Wilson version (which can be said to be part of the Openais project). Corosync contains Openais's core framework for the use and management of Wilson's standard interfaces. It provides a cluster execution framework for commercial or open-source clusters. Currently Corosync is divided into 1 versions and 2 versions, 1 does not have a voting function, and the 2 version has a voting function.

Pacemaker Overview

Pacemaker Overview

Pacemaker is a cluster resource manager that leverages the message and member capabilities provided by the preferred cluster infrastructure (OpenAIS or heartbeat) for fault detection and recycling by secondary nodes and systems, enabling high availability of clustered services (also known as resources). Pacemaker is a cram component that is split from the heartbeat V3 release and is designed to provide a highly available cluster.

Pacemaker Features

    1. Host and application-level fault detection and recovery

    2. Support for virtually any redundant configuration

    3. Supports multiple cluster configuration modes at the same time

    4. Configuration policy handles quorum loss (when multiple machines fail)

    5. Support app startup/shutdown sequence

    6. Supported, must/must run on the same machine application

    7. Applications that support multiple modes (such as master/slave)

    8. You can test for any failure or cluster status

Pacemaker Internal Components

650) this.width=650; "Src=" http://img.blog.csdn.net/20170801083507460?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqva2fpcnvpmtiz/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/ Southeast "alt=" here to write a picture describing "title=" "/>

    1. CRMD (Resource Management daemon): primarily as a message broker for Pengine and LRM, it also has to elect a leader to coordinate the activities of cluster management (including the stop and start of cluster resources)

    2. STONITHD (Heartbeat System): In Pacemaker, the stonith device is easily monitored as a resource (and configured in the CIB), but STONITHD is aware of the stonith topology, such as its client requests to isolate a node, which restarts that machine.

    3. CIB (Cluster information Base): The CIB in the system is the current cluster of resources in the original configuration and then dynamically changed state, statistical information collection Distribution center, is a constantly updated repository (including all cluster options, nodes, resources and their interrelationships and the current status of the definition). When he collects changes in any resource, and changes in node statistics, it integrates together the latest information from the current cluster and distributes it to each node of the cluster.

    4. Pengine (Policy engine): it is primarily responsible for the information sent by CRM to calculate the next state of the cluster according to the various settings in the configuration file (based on the current state and configuration). Generate a transition map that includes a series of actions and dependencies.

Corosync+pacemaker Combination

650) this.width=650; "Src=" http://img.blog.csdn.net/20170801090304670?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqva2fpcnvpmtiz/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/ Southeast "alt=" here to write a picture describing "title=" "/>

Installation of Corosync and Pacemake

structure Deployment Diagram
650) this.width=650; "Src=" http://img.blog.csdn.net/20170801095215034?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqva2fpcnvpmtiz/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/ Southeast "alt=" here to write a picture describing "title=" "/>

Pre-preparation

1. Check for the same hostname and uname-n results in/etc/sysconfig/network

[Email protected] ~]# Cat/etc/sysconfig/network | grep "HOSTNAME" | cut-d "="-f2 > Network.txt[[email protected] ~]# uname-n > Hostname.txt[[email protected] ~]# diff Network.txt Ho Stname.txt

2. Configure DNS

A. Modify/ETC/RESOLV.CONFB. modify/etc/hosts.conf [[email protected] ~]# vim/etc/hosts 127.0.0.1 localhost Localhost.locald         Omain localhost4 localhost4.localdomain4:: 1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.80.130 Clone2 192.168.80.131 Clone3 192.168.80.132 Clone4

3. Configure Trusted SSH

Generate SSH's public key and key     [[email protected] ~]# ssh-keygen -t rsa      Generating public/private rsa key pair.     enter file in which to save the key  (/ROOT/.SSH/ID_RSA):      Created directory  '/root/.ssh ' .    enter passphrase  (empty for no passphrase):     enter same passphrase  again:     your identification has been saved in /root/ . ssh/id_rsa.    your public key has been saved in /root /.ssh/id_rsa.pub.    the key fingerprint is:66:03:85:51:93:de:e9:7b:ed:b1 : 42:36:d6:05:bc:17 [email protected]    the key ' S randomart image  is:  &nBSP; +--[ RSA 2048]----+    |      .++.    .   |    |      ....     OE |    |     &NBSP, ....  . .   o.|     |      &NBSP, ....  o   . o|    |        s.    . O |    |       O&NBSP, ....  = .  |    |            = o.  |    |           . o .o |    |            . oo  |    +-----------------+ Copy the Convention to his node     [[email protected] ~]#  ssh-copy-id -i .ssh/id_rsa.pub [email protected]    the  authenticity of host  ' clone2  (192.168.80.130) '  can ' t be established.     rsa key fingerprint is d7:64:9b:c6:a0:81:61:70:8a:df:d4:b4:a4:01:54:08.     Are you sure you want to continue connecting  ( yes/no)? yes    warning: permanently added  ' clone2,192.168.80.130 '   (RSA)  to the list of known hosts.    [email  Protected] ' s password:     now try logging into the  machine, with  "ssh  ' [email protected] '", and check in:       .ssh/authorized_keys        to make sure we haven ' T added extra  keys that you weren ' t expecting.

Corosync Installation
1.yum Source Installation

[email protected] ~]# Yum install Corosync

2. Compiling the installation

Download: [[email protected] ~]# wget http://build.clusterlabs.org/corosync/releases/corosync-2.4.2.tar.gz extract: [Email prot Ected] ~]# tar-xzf corosync-2.4.2.tar.gz Install the necessary software: [[email protected] ~]# Yum install gcc ncc-devel libqb libqb-devel Compile security Install: [[email protected] ~]# CD corosync-2.4.2 [[email protected] corosync-2.4.2]#./configure--prefix=/usr/local/cor Osync--sbindir=/usr/local/sbin--bindir=/usr/local/bin--sysconfdir=/etc [[email protected] corosync-2.4.2]# make &am p;& make Install

Corosync configuration file Detailed

[[email protected] ~]# vim /etc/corosync/corosync.conftotem {         version: 2                 //Version number         crypto_cipher: none                 crypto_hash:  none        secauth:on      // Whether to turn on certification         thread:0         When implementing authentication, the number of concurrent threads, 0 means default         interface {                 ringnumber: 0       //ring number, define a unique ring number for this network card to avoid heartbeat message ring send                   bindnetaddr: 192.168.1.0    //Bound Network address                  mcastaddr: 239.255.1.1       //Broadcast Address                  mcastport: 5405            //Broadcast Port                 ttl: 1                       //only once to the outside         }}logging {         fileline: off        to_stderr:  no        to_logfile: yes         logfile: /var/log/cluster/corosync.log        to_syslog: yes         debug: off        timestamp:  on        logger_subsys {                 subsys: QUORUM                 debug: off         }       }  service {                //define a service to start pacemaker     ver: 0              // Define version     name: pacemaker    //This means that the Corosync will start automatically when you start the pacemaker} aisexec {                 //indicates which user to run the      user: root    group: root          }

Yum Source Installation

[email protected] ~]# Yum install pacemaker

Next Steps
1. Use the command to generate the Corosync key and copy it to each node

[Email protected] ~]# corosync-keygen[[email protected] ~]# scp/etc/corosync/authkey [email protected]:/etc/corosync/

2. Copy the Corosync configuration file to each node

[Email protected] ~]# scp/etc/corosync/corosync.conf [email protected]:/etc/corosync/corosync.conf

3. Download and install Crmsh,pssh

[Email protected] ~]# wget [[email protected] ~]# wget [[email protected] ~]# Yum install pssh-2.3.1-2.el6.x86_64.rpm CRM sh-1.2.6-4.el6.x86_64.rpm

Start and test
650) this.width=650; "Src=" http://img.blog.csdn.net/20170801153031939?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqva2fpcnvpmtiz/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/ Southeast "alt=" here to write a picture describing "title=" "/>

[Email protected] ~]# Crm_mon
650) this.width=650; "Src=" http://img.blog.csdn.net/20170801153252647?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqva2fpcnvpmtiz/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/ Southeast "alt=" here to write a picture describing "title=" "/>

Note: Because pacemaker is more configured, I will focus on CRMSH in the next blog to configure highly available resources, as well as the high availability of common servers using Corosync+pacemaker


Hearbeat for high availability: http://www.crazyrui.pw:8088/index.php/2017/07/31/heartbeat/

Or: http://lnsane784.blog.51cto.com/1226518/1952393

Automated Deployment Tools ansible:http://www.crazyrui.pw:8088/index.php/2017/07/27/linux_ansiable/

Or: http://lnsane784.blog.51cto.com/1226518/1951496

LVS Load Balancer: http://www.crazyrui.pw:8088/index.php/2017/07/24/linux_lvs/

Or: http://lnsane784.blog.51cto.com/1226518/1950589

Dhcp,httpd,tomcat Construction: http://www.crazyrui.pw:8088/index.php/category/linux-server/

Using Corosync+pacemaker in Linux and installation

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.