Monday, October 24, 2016

How to test pacemaker to create a Virtual IP for LB purpose for 3 nodes

sometimes, you need have more than one LBs for HA purpose.  and we always want to have one floatip virual IP cross all LB nodes. and we can use pacepaker/corosyncd to do this very easily.  for the testing purpose, I will use Vagrant to create 3 nodes (node1, node2, node3). once booted up , all 3 machine are well figured for hostname.

nodeone= 'node1'
nodetwo= 'node2'
nodethree= 'node3'

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
####  node 1###########
                 config.vm.define :"node1" do |node1|
                        node1.vm.box = BOX
                        node1.vm.box_url = BOX_URL
                        node1.vm.network :private_network, ip: "192.168.2.101"
                        node1.vm.hostname = nodeone
                        node1.vm.synced_folder ".", "/vagrant", disabled: true
               node1.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'"
                        node1.vm.provision "shell", path: "post-deploy.sh" ,run: "always"
                        node1.vm.provider "virtualbox" do |v|
                                v.customize ["modifyvm", :id, "--memory", "1300"]
                                v.name = nodeone
                    v.gui = true
                        end
                end

and post-deploy.sh
#!/bin/bash
value=$( grep -ic "entry" /etc/hosts )
if [ $value -eq 0 ]
then
echo "
################ hosts entry ############
192.168.2.101 node1
192.168.2.102 node2
192.168.2.103 node3
######################################################
" >> /etc/hosts
fi

once done, you can call vagrant up node1 node2 node3 to have 3 VMs ready.

now vagran ssh all nodes  to install the dependencies.

yum install -y pcsd pacemaker corosync

after done, enable all daemon to start automatically.
systemctl enable pcsd
systemctl enable pacemaker
systemctl enable corosync
//disable firewalld
systemctl disable firewalld

Now time to configure the corosync for nodes topology.

you can just copy the /etc/corosync/corosync.conf.example to /etc/corosync/corosync.conf
just change your ip and quorum settings (by dfault it use mcast to maintain the cluster membership)


then create a user named haclusteruser among 3 nodes

echo you_special_compliceted_password|passwd --stdin haclusteruser

once done, you can call pcs cluster auth to authorize eacy host using the shared credential
pcs cluster auth node1

after this. start the corosync and pacemaker on all nodes.

run crm_mon to see all the nodes

now we can create a floating vip to HA purpose.
pcs  resource create VIP2 IPaddr2 ip=192.168.2.100 cidr_netmask=32 nic=enp0s8 op monitor interval=30s

after that, you might see the status is always stopped. we need to disable the stonith
pcs  property set stonith-enabled=false

try the check again for the status, the VIP is bound to one node (node1 here)



to test the HA, shutdown node1. and run crm_mon again, the VIP was assigned on node2

15 comments:

Sathya said...

Excellent article.This is really very useful to students who are in the software field.Keep going..Thank you for your sharing.

Sugantha Raja said...

Nice Blog, When i was read this blog i learnt new things & its truly have well stuff related to developing technology, Thank you for sharing this blog.
Microsoft Azure Training in Chennai | Azure Training in Chennai

Smith John Live said...

HP LaserJet Pro MFP M428fdn Setup - If you would like to know more about the features of HP laserjet Pro MFP 428fdn, setup, we have a team certified to answer your queries and help you to execute the device setup. Among the most preferred HP Printer models available, HP Color LaserJet Pro MFP M479fdn is opted by customers as it delivers excellent print results. Features and specifications are many and suggest you to check out the reviews to get an idea

Rachel Bilson said...

Crackle, the most entertaining channel is now on Roku to entertain you. If you are new to this channel, use the page crackle.com/activate. Once if you activate the channel, the most interesting program collections are on its way. The categories include full-length movies, TV shows, and documentaries and much more.

marvinericksen said...

Hey, This is me Marvin Ericksen writing from Florida. So how’s life going-on, Feeling Enthusiastic or feeling dull. I felt boring with my life. So here I am and going to write my blogs. Actually I am really interested towards Reading and writing. But my all time hobbies are movies and TV Shows and Series.
My works:
psvue.com/activateroku

Rachel Bilson said...

It’s always my passion to write creative articles. Have worked on a lot of innovative and interesting topics. Read it and it’s informative. Recommend you to provide your feedback & suggestions to work on more titles. Contact me or reach me if you would like to know more about my profile.
My work:Pureflix on Roku

marvinericksen said...

Hey, This is me Marvin Ericksen writing from Florida. So how’s life going-on, Feeling Enthusiastic or feeling dull. I felt bored with my life. So here I am and going to write my blogs. Actually I am really interested in reading and writing. But my all-time hobbies are movies and TV Shows and Series.
My blog: cbs.com/roku

fullassignment said...

Online Assignment Help is the effective source of getting experts’ help for writing academic papers. By using assignment help services, students can complete their assignment on time. If you are stuck with your economics assignment and then you can opt for our economics assignment help. For more info please visit our website: https://fullassignment.com/
or reach out us on WhatsApp - (+1) 669-271-4848

Unknown said...

In the hysteria of social networks, free e-mail service remains the cornerstone of corporate internet communication. Therefore, it is only important to evaluate the best available email services and make the right choice for your needs. Many people are satisfied with the provider of email services they now use.
Additionally, for further queries about the best email service, feel free to interact with active customer care.

Be Tvastra | Digital Marketing Company in Chennai said...

Hi this is SaiVijay, I'am from Chennai. I'am a technical writer for a digital marketing company in Chennai for more than five years. And its my own passion to choose this field. I have to write a creative articles, novels, documents. My hobbies are drawing, playing foot ball and playing cricket also. My most favorite one is "Be Tvastra" which one is the most memorable one in my works. I have suggest you to read the articles.
Digital Marketing Company in Chennai
Digital Marketing Agency in Chennai
SEO services in Chennai
SEO company in Chennai
Web Design Company in Chennai
Web Development Company in Chennai
top 10 digital marketing companies in chennai
digital marketing companies in chennai
best digital marketing agency in chennai
digital marketing companies in anna nagar
seo services company in chennai
Best SEO Companies In Chennai
cheap seo in chennai

elena said...

Hello, Thanks for sharing the amazing blog. It's very interesting.
You need to have an Active Office Subscription to download Office on your PC to enjoy all the features. The office is one of the best software that will give you support for all your pen devices as well as flexibility. So, get your office setup at
office setup

Alex said...

Grunt is a remarkable and free creative one page website template for agencies and freelancers. Download it now at TemplateMonster.

Kuma Herbals said...

Thanks for this great information...
Unani Treatment in Bangalore

i Digital Academy said...

Thanks for sharing such a nice information with us...
Digital Marketing in Bangalore

Elliana Taylor said...

Thank you for sharing valuable information. Nice post. I enjoyed reading this post. The whole blog is very nice found some good stuff and good information here Thanks.
Software Testing Services
Independent Software Testing Services
Functional Testing Services
QA Automation Testing Services
eCommerce Testing Services
Performance Testing Services
Security Testing Services
API Testing Company
Regression Testing Services
Mobile App Testing Services

 
Locations of visitors to this page