Configure-Multiple-subnet-Always on-Availability-Group in Linux(CENTOS)

Hi Friends,

This post helps you in creating Multi Subnet Always ON in Linux Environment. Frankly speaking I had so many hurdles however I achieved this.

The problem is I don't have much knowledge on Linux unlike Windows where I do know how thinks workout. 

As this being multi subnet the problem is all about how to accomplish connectivity between nodes .

The ideas that popped in my mind are 

1) Achieving Routing between the 2 nodes using Router (another VM with Linux )-->It didn't work

2) using Azure VM's by configuring VNET to VNET (This will work but I don't have subscription)

3) Adding Linux machines to Windows Active Directory and then configuring Routing (It did work)

In the past I wrote a post on how to perform multi subnet in Windows and below is the link

https://www.chiranjeevivamsydba.com/2018/11/multi-subnet-always-on-scenarios.html

My post is truly inspired from   5 part series  (MSSQLTIPS.COM). This is however single subnet Always ON.

The Master (Edwin) has given almost all the details hence I don't want to go through all the details. I will share just the extra steps that are required to perform Multi Subnet.

As said I am not an Linux Expert hence I installed 3 VM's on my laptop

First VM: Windows Domain server with 2 network cards (192.168.81.1) and (192.168.82.1)

Second VM: Linux CENTOS 7 with GUI support

Third VM: Linux CENTOS 7 with GUI support

One problem is we need to configure Manual IP Address to get this work. But before doing this we need to download  below features. 

1) SQL Server 2019

2) SQL Server HA 

3) pacemaker  software

4) install Active directory related software's (As we need  to add our Linux Machines to Windows Domain server

5) Oracle Virtual Box Guest Additions (As we need to copy the commands between our Host and virtual machines)

Also I would like to warn you on one more thing at the time of creation of virtual machines (Linux) please make sure you create bigger partitions as I ran out space on root folder.

As the master(Edwin) explained everything in detail I will not reinvent the wheel .

 I will just share  my Environment details and the extra steps for Multi Subnet













As you can see I am on SQL server 2019 and when it comes to my IP configuration I have 

LINNODE1 with (192.168.81.10) and LINNODE2 with (192.168.82.10)

After you have configured all the steps mentioned by Edwin in his 5 part series we need to export Cluster Information Base in to a text file using the below command and 

sudo pcs cluster cib cib.txt

Then you need to make the changes highlighted(in red) and push it back by running 

sudo pcs cluster cib-push cib.txt

<primitive class="ocf" id="vip1" provider="heartbeat" type="IPaddr2">


        <instance_attributes id="vip1-instance_attributes1">


          <rule id="Subnet1-IP" score="INFINITY">


            <expression id="Subnet1-Node1" attribute="#uname" operation="eq" value="linnode1"/>


          </rule>


          <nvpair id="vip1-instance_attributes-ip" name="ip" value="192.168.81.20"/>


        </instance_attributes>


        <instance_attributes id="vip1-instance_attributes2">


          <rule id="Subnet2-IP" score="INFINITY">


            <expression id="Subnet2-Node1" attribute="#uname" operation="eq" value="linnode2"/>


          </rule>


          <nvpair id="vip1-instance_attributes-ip2" name="ip" value="192.168.82.20"/>


        </instance_attributes>


 <operations>


          <op id="vip1-monitor-interval-10s" interval="10s" name="monitor" timeout="20s"/>


          <op id="vip1-start-interval-0s" interval="0s" name="start" timeout="20s"/>


          <op id="vip1-stop-interval-0s" interval="0s" name="stop" timeout="20s"/>


        </operations>


      </primitive>

I will show you where my resources are running before the failover









Now perform a manual failover using the below command




As you can see now I got my resources from NODE2 to NODE1

Any time we can connect to only 1 IP Address just like windows.  Below are the IP Addresses for my Listener

192.168.81.20 (on LINNODE1)
192.168.82.20 (on LINNODE2




I felt really happy with this as it is perhaps first of it's kind( I have not seen any blog related to this apart from the official MS Documentation).


If any one is interested in getting this done I will help you for sure. Do reach me on my mobile +353894316824 or WhatsApp (+919739093905)


Comments

Aditya C said…
This is the first and most useful blog ever I am reading about Multi Subnet Always ON in Linux over the Internet..!! Thank you so much for sharing your knowledge ��