Comments on How to Set up Nginx High Availability with Pacemaker, Corosync, and Crmsh on Ubuntu 16.04

In this tutorial, I will show you step by step how to create a High Availability Clustered Nginx Web Server with Pacemaker, Corosync, and Crmsh. We will create an Active-Passive Cluster or Failover-cluster Nginx web server on Ubuntu 16.04.

9 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By: Alexander

The Corosync service is unable to start with such configuration (exit code 20)

I had to replace the hostnames (web01, web02, web03) to the corresponding IP-addresses (despite the fact that they are specified in /etc/hosts and name resolution works well). After that, the corosync service is able to start.

By: kdclaver

I've followed the tutorial and when I try to copy files from server1 to server2 and server3 via scp /etc/corosync/* root@phoebe:/etc/corosync/ I have an error:

root@emmanuel:/etc/corosync# scp /etc/corosync/* dkctechno@phoebe:/etc/corosync/dkctechno@phoebe's password:scp: /etc/corosync//authkey: Permission deniedscp: /etc/corosync//corosync.conf: Permission deniedscp: /etc/corosync//corosync.conf.backup: Permission denied

web01 = emmanuel

web02 = phoebe

web03 = moshe

root@phoebe:~# lsb_release -aNo LSB modules are available.Distributor ID: UbuntuDescription:    Ubuntu 16.04.4 LTSRelease:        16.04Codename:       xenialroot@phoebe:~#

Please help solve and follow the test of this solution.

 

By: Ravi Masaun

please enable remote root login.

sudo passwd root

sudo passwd -u root

sudo sed -i 's/prohibit-password/yes/' /etc/ssh/sshd_config

sudo systemctl restart sshd

 

This should resolve your problem

By: shankar kumar

Hi,Unable to start the virtual ip address and the nginx server, could you please tell me how to resolve this.Thanks in advance.

By: rajesh mishra

What is virtual ip address in cluster 

Also from where to get floating ip i am not getting.

 

please help

By: DimitriB

In the prerequisites is written:

A floating IP Address 10.0.15.15

And in the hosts file:

10.0.15.15      ha-web.co

Then the explanation is given from following line:

For our Nginx HA web server, we need to create two OCF resources: 'virtual_ip' for the floating IP and 'webserver' for nginx service.

If you know 

The virtual IP 10.0.15.15 is used to be able to access your web page via always the same IP even though the nginx web service behind may be on a different service. E.g. if the node on server web01 is active then the actual web server IP is 10.0.15.11.If you go in a browser to 10.0.15.15, ha-web.co, 10.0.15.11 or web01, the result will be the webpage of web01.

If the node on server web01 fails, web02 may take over but the web page will still be reachable via the virtual IP and corresponding DNS 10.0.15.15, ha-web.co.

For more info about virtual IP's, read the wiki or google virtual IP.

By: Shankar Kumar

I would like to know in this document where you have mentione in which node all the request will go by default or explicitly mentioned. can you tell me the configuartion part for this.Thanks

By: DimitriB

Thanks for this tutorial.

I wanted to create a HA cluster of 2 Ubuntu Server 18 machines. 1 machine is main server; the second machine is backup; only used in case machine 1 fails.

Unfortunately I didn't find any clear manual yet for an Ubuntu Server 18.But this tutorial helped me setup basic failover.

Maybe the following can help others trying the same.

Using corosync v2.4.3 which has a default conf already.

IP range is 192.168.1.0.

I changed only what I thought was necessary to make it work in the default:

totem {

        version: 2

        cluster_name: debian

        token: 3000

        token_retransmits_before_loss_const: 10

        clear_node_high_bit: yes

        crypto_cipher: none

        crypto_hash: none

        interface {

                ringnumber: 0

                bindnetaddr: 192.168.1.0

                mcastport: 5405

                ttl: 1

        }

}

 

nodelist {

        node {

                ring0_addr: web01

        }

        node {

                ring0_addr: web02

        }

}

 

logging {

        fileline: off

        to_stderr: no

        to_logfile: off

        to_syslog: yes

        syslog_facility: daemon

        debug: off

        timestamp: on

        logger_subsys {

                subsys: QUORUM

                debug: off

        }

}

 

quorum {

        provider: corosync_votequorum

        expected_votes: 2

}

By: Equbay Kiflay

Instead of configuring Nginx resource and creating the resource group, why not configure the Nginx server on the three nodes to listen to the floating ip address and setup the pacemaker cluster with the floating ip address resource only? What would be the difference between this and your setup from user/website visitor point of view?