LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Two RHEL servers sharing one Virtual IP - How to...? (https://www.linuxquestions.org/questions/linux-server-73/two-rhel-servers-sharing-one-virtual-ip-how-to-4175497760/)

xenner 03-10-2014 11:18 PM

Two RHEL servers sharing one Virtual IP - How to...?
 
Hi,

This should be incredibly easy, but I can't seem to find the easiest and most elegant way to do it online.

Basically, I'm after a very simple method to share one IP across two machines.

ie.
Primary - 192.168.0.1 - 192.168.0.3
Secondary - 192.168.0.2

So, when Primary goes down, Secondary starts up an eth0:1 with the IP of 192.168.0.3, and serves content, but when Primary comes back, Secondary shuts down the eth0:1.

I have googled, and searched here, but either my criteria is incorrect, or there's no 'easy' method with the least amount of config out there.

I appreciate your time!

Xen.

kirukan 03-11-2014 01:55 AM

Hi Xenner,
You can go through the corosync/pacemaker to setup Linux cluster. OR if you have licensed RHEL you can try RHEL cluster suite also
http://www.linuxquestions.org/questi...er-4175425129/

xenner 03-11-2014 05:18 PM

Thanks Kirukan,

I'll check it out.

Xen.

xenner 03-12-2014 05:42 PM

Hi,

I got this working very simply. Thanks for the assist.

I used 'cman', which includes corosync. And I added pacemaker also.

I only added the two nodes into the /etc/cluster.conf file:

<clusternode name="rhel6-01.business.com" nodeid="1">
and
<clusternode name="rhel6-02.business.com" nodeid="2">

I ran these, where the ip on line one is the shared ip between the two nodes:
Code:

pcs resource create livefrontendIP0 ocf:heartbeat:IPaddr2 ip=192.168.0.70 cidr_netmask=32 op monitor interval=30s
pcs constraint location livefronendIP0 prefers rhel6-01.business.com=INFINITY
pcs constraint location livefrontendIP0 prefers rhel6-02.business.com=INFINITY
pcs property set no-quorum-policy=ignore
pcs property set stonith-enabled=false

And I changed /etc/corosync/corosync.conf slightly, as in, I added the bindnetaddr: to the network I was on... So, if you're doing this, and you have an ip of 192.168.0.55/24 You would change your bindnetaddr to 192.168.0.0 on both machines.
I also hashed out the "mcastport" and placed a new line "broadcast: yes". I'm not sure that's required, I saw it in the man page.

Once everything was configured, I ran "ccs_config_validate" and all the settings were 'okay'.

I replicated the config to the secondary node, then started cman and pacemaker.

Code:

service cman start
service pacemaker start

Then, ensure they started at logon, 'chkconfig <bothservices> on'.

Once everything's running, you can check it all out using.
Code:

cman_tool status
or
Code:

cman_tool nodes
I hope that helps anyone in the future. And if I've missed anything, feel free to add it in anyone!

Xen.


All times are GMT -5. The time now is 07:53 AM.