Corosync + pacemaker enables high-availability clusters.

Source: Internet
Author: User

Lab environment:

 

 

Install: Yum install corosync pacemaker-y

Copy the configuration file

  • CP corosync. conf. Example corosync. conf

  • Vim corosync. conf

Edit the configuration file:

Compatibility: whitetank
Compatible with corosync 0.8
Totem {
Defines the heartbeat information transfer layer between clusters
Version: 2 ---- version
Secauth: On --- whether to enable Security Authentication
Threads: 0 --- How many threads are enabled to process heartbeat information transmission, and 0 is automatic.
Interface {
Ringnumber: 0 -- number of message Loops
Bindnetaddr: 192.168.18.0 -- bound network address
Mcastaddr: 226.94.1.2 -- multicast address
Mcastport: 5405 --- multicast Port
TTL: 1
}
}

Logging {
Fileline: Off
To_stderr: No -- specifies whether the heartbeat information is output to the screen.
To_logfile: Yes
To_syslog: No --- whether to send to/var/log/messages
Logfile:/var/log/cluster/corosync. Log
Debug: off -- whether to enable debugging
Timestamp: On -- whether to enable the timestamp of the current system time.
Logger_subsys {
Subsys: AMF -- Define openais specifications
Debug: Off
}
}

AMF {
Mode: Disabled
}
Service {pacins that define pacemaker as corosync.
Ver: 0
Name: Pacemaker
}
Aisexec {
User: Root
GROUP: Root
}

To generate a Security Authentication file, this command requires a 1024-bit random number. We can reinstall a software on another terminal to generate a random number.

  • Corosync-keygen

Install the Resource Manager Configuration Interface Program:

Crmsh-1.2.6-4.el6.i686.rpm

Pssh-2.3.1-2.el6.i686.rpm

Disable NetworkManager and disable this service at startup.

/Etc/init. d/NetworkManager stop

Chkconfig NetworkManager off

Start the service:

  • Service corosync start

 

Use of CRM commands:

  • CRM status // display cluster status information

  • Crm_mon

  • Crm_verify-l // display whether the configuration file has a syntax error

  • CRM help

This is CRM shell, a pacemaker command line interface.

Available commands:

CIB manage shadow cibs-manage the cluster information library
Resource Resources Management-Resource Management
Configure CRM cluster configuration -- cluster configuration interface
Node nodes management-node Management
Options user preferences --
History CRM cluster history -- cluster history
Site geo-cluster support -- supports cross-region Clusters
RA resource agents Information Center -- Resource Agent
Status show cluster status
Help ,? Show Help (Help topics for list of topics)
End, CD, up go back one level -- Return
Quit, bye, exit the program -- exit the program

 

  • CRM resource help

At this level resources may be managed.

All (or almost all) commands are implemented with the CRM tools
Such as 'crm _ Resource (8 )'.

Available commands:

Status, show, list show status of resources -- display resource status information
Start start a resource -- start a resource
Stop stop a resource -- stop a resource
Restart restart a resource
Promote promote a master-slave resource -- wake up a master-slave Resource
Demote demote a master-slave resource -- downgrade a master-slave Resource
Manage put a resource into managed mode -- add resources to manageable Mode
Unmanage put a resource into unmanaged mode -- Non-Management Mode
Migrate, move migrate a resource to another node -- Resource migration
Unmigrate, unmove unmigrate a resource to another node
Param manage a parameter of a resource -- manage resource parameters
Secret manage sensitive parameters -- manage sensitive parameters
Meta manage a meta attribute -- manage the source data attributes of a resource
Utilization manage a utilization attribute
Failcount manage failcounts -- number of errors in resource management
Cleanup cleanup resource status -- clear resource status
Refresh refresh CIB from the lrm status -- refresh CIB
Reprobe probe for resources not started by the CRM probe resources not started
Trace start Ra Tracing
Untrace stop Ra Tracing
Help ,? Show Help (Help topics for list of topics)
End, CD, up go back one level
Quit, bye, exit the program

 

  • CRM node help

    Node management and status commands.

    Available commands:

    Status show nodes 'status as XML -- display node status
    Show, list show Node
    Standby put node into standby -- sets the current node as a slave Node
    Online set node online -- set the current node as an online Node
    Maintenance put node into maintenance mode
    Ready put node into ready mode
    Fence fence Node
    Clearstate clear node state
    Delete Delete Node
    Attribute manage attributes
    Utilization manage utilization attributes
    Status-ATTR manage status attributes
    Help ,? Show Help (Help topics for list of topics)
    End, CD, up go back one level
    Quit, bye, exit the program



  • CRM configure property stonith-Enabled = false -- disable the stonith Device

  • CRM Ra help

Classes list classes and providers -- list the provided Ra types

List list RA for a class (and provider) -- display the resource proxy provided by an RA type

Meta show meta data for a ra -- displays basic information about an RA.


Define a resource:

CRM configure

Primitive webip OCF: ipaddr Params IP = 192.168.18.200

After definition, you can use show to view

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/3E/F6/wKiom1PIVmKwSDIEAAJPhUpOQ88761.jpg "Title =" Z ~ Omcr5ww1_5ym0w(oe1_1_k0l.jpg "alt =" wkiom1pivmkwsdieaajphupoq88761.jpg "/>

If there is no error, you can use commit to submit it later.

View status:

  • CRM status

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/3E/F6/wKioL1PIWQnxSUKrAAI8r8VpnT8337.jpg "Title =" s%h0n%r%2@utr_j(%lmk4@y.jpg "alt =" wkiol1piwqnxsukraai8r8vpnt8337.jpg "/>

  • CRM Resource Status

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/3E/F6/wKiom1PIWBGA3UL6AAExozv3sSY882.jpg "Title =" 4g056 ~) X(uopolicy=poze_o165.jpg "alt =" wkiom1piwbga3ul6aaexozv3ssy882.jpg "/>

Stop resources:

  • CRM resource stop webip

Start resources:

  • CRM resource start webip

Set the current node as standby, and then the resource will be transferred to node 2.

  • CRM node standby

We add httpd to managed resources:

  • CRM configure primitive webserver LSB: httpd

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/3E/F8/wKioL1PIYDbjpD1UAAQ9VQcnF4g479.jpg "Title =" _ j {g3smuv 'iqxzlv % nnk ~ Fn.jpg "alt =" wkiol1piydbjpd1uaaq9vqcnf4g479.jpg "/>



This article is from the blog of "bad guys". For more information, contact the author!

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.