0% found this document useful (0 votes)
58 views

Pacemaker Corosync Nginx Cluster - Linux Tutorial

This document provides instructions for setting up a high availability Nginx cluster using Pacemaker, Corosync, and PCS on two CentOS nodes. It describes steps to install the required packages, enable the services, authenticate the nodes, create resources for the virtual IP and Nginx, and add constraints to control failover behavior. Troubleshooting commands are also provided.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views

Pacemaker Corosync Nginx Cluster - Linux Tutorial

This document provides instructions for setting up a high availability Nginx cluster using Pacemaker, Corosync, and PCS on two CentOS nodes. It describes steps to install the required packages, enable the services, authenticate the nodes, create resources for the virtual IP and Nginx, and add constraints to control failover behavior. Troubleshooting commands are also provided.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

ThisisGoogle'scacheofhttp://www.alexlinux.com/pacemakercorosyncnginxcluster/.

Itisasnapshotofthe
pageasitappearedon28May201607:36:02GMT.
Thecurrentpagecouldhavechangedinthemeantime.Learnmore
Fullversion

Textonlyversion

Viewsource

Tip:Toquicklyfindyoursearchtermonthispage,pressCtrl+ForF(Mac)andusethefindbar.

pacemaker corosync nginx cluster


Disable SELINUX
Disable IPv6
Pacemaker installation
[alex@test01~]$sudoyuminstallcorosyncpcspacemakernginx
[alex@test02~]$sudoyuminstallcorosyncpcspacemakernginx

Enable autostart
[alex@test01~]$systemctlenablepcsdsystemctlenablecorosyncsystemctlenable
pacemaker
[alex@test02~]$systemctlenablepcsdsystemctlenablecorosyncsystemctlenable
pacemaker

Start pacemaker
[alex@test01~]$systemctlstartpcsd
[alex@test02~]$systemctlstartpcsd

Add nginx as cluster resource:


[alex@test01~]$cd/usr/lib/ocf/resource.d/heartbeat
[alex@test01~]$wgethttps://raw.githubusercontent.com/ClusterLabs/resource

agents/master/heartbeat/nginx
[alex@test01~]$chmod755nginx
[alex@test02~]$cd/usr/lib/ocf/resource.d/heartbeat
[alex@test02~]$wgethttps://raw.githubusercontent.com/ClusterLabs/resource
agents/master/heartbeat/nginx
[alex@test02~]$chmod755nginx

Set password
[alex@test01~]$sudopasswdhacluster
[alex@test02~]$sudopasswdhacluster

Authenti cate nodes:


[alex@test01~]$sudopcsclusterauthtest01test02

Setup and start cluster


[alex@test01~]$sudopcsclustersetupnamecluster_webtest01test02
[alex@test01~]$systemctlstartpacemakersystemctlstartcorosync
[alex@test02~]$systemctlstartpacemakersystemctlstartcorosync
[alex@test01~]$sudopcsclusterstartall

Disable STONITH
[alex@test01~]$sudopcspropertysetstonithenabled=false
[alex@test01~]$sudopcspropertysetnoquorumpolicy=ignore

Add cluster ip address


[alex@test01~]$sudopcsresourcecreatevirtual_ipocf:heartbeat:IPaddr2ip=10.1.1.10
cidr_netmask=32opmonitorinterval=30s

Create web server resource:


[alex@test01~]$sudopcsresourcecreatewebserverocf:heartbeat:nginx
configfile=/etc/nginx/nginx.confopmonitortimeout="5s"interval="5s"

Add rules:
[alex@test01~]$sudopcsconstraintcolocationaddwebservervirtual_ipINFINITY

[alex@test01~]$sudopcsconstraintordervirtual_ipthenwebserver
[alex@test01~]$sudopcsconstraintlocationwebserverpreferstest01=50
[alex@test01~]$sudopcsclusterstopall&&sudopcsclusterstartall

troubleshooting
[alex@test01~]$sudopcsstatusnodes

[alex@test01~]$sudocorosynccmapctl|grepmembers

[alex@test01~]$sudopcsstatuscorosync

[alex@test01~]$sudocrm_verifyLV

[alex@test01~]$sudopcsstatuscluster

This entry was posted in install tutorial on October 21, 2015 [http://www.alexlinux.com/pacemakercorosync-nginx-cluster/] .

You might also like