Tutorial: Add a node to SQL cluster on RHEL
In this video,
I demonstrated how to create a two nodes SQL Cluster instance.
I’m going to show you how to add another node to existing
SQL Cluster.
Topology
1.ISCSI
target server configuration
1.Add
the new node (node3) to the ACLs list.
This
is the existing setting.
Here
are the commands I used.
2.
Enable and restart the target service.
systemctl enable target.service
systemctl restart target.service
2.ISCSI
initiator configuration.
Configure ISCSI initiator in the new node (node3)
1.Install
iscsi-initiator-utils in all nodes.
sudo yum install iscsi-initiator-utils -y
2.Edit
the /etc/iscsi/initiatorname.iscsi , replace the existing value with following
keywords, the one I used in step 4 of section[ISCSI target server
configuration]
InitiatorName=iqn.2020-08.com.contoso:node3
3.Discover
iSCSI disk of the target.
iscsiadm -m discovery -t st -p <ip of
iscsi target server>
Here
is the command in this tutorial.
iscsiadm -m discovery -t st -p 10.1.0.7
5.
(Optional step)After the discovery below database is updated.
ls -l /var/lib/iscsi/nodes
6.Make
the connection to iscsi target.
iscsiadm --mode node --targetname
iqn.2020-08.com.contoso.servers --login
7.
(Optional step)After logging in, a session with the iSCSI target is
established.
iscsiadm --mode node -P 1
8.
(Optional step)If you review the messages file, you will see following keywords
sudo grep "Attached SCSI"
/var/log/messages
Aug 9 14:38:43 localhost kernel: sd 3:0:1:0:
[sdb] Attached SCSI disk
Aug 9 14:38:43 localhost kernel: sd 2:0:0:0:
[sda] Attached SCSI disk
Aug 10 02:13:23
localhost kernel: sd 6:0:0:0: [sdc] Attached SCSI disk
Check the device
3.SQL
Server configuration.
1.Stop
SQL Server in the new node(node3)
sudo systemctl stop mssql-server
2.Copy
the /var/opt/mssql/secrets/machine-key of node1 to node3.
3.Delete
the files from the existing SQL Server data directory in node1.
rm -f /var/opt/mssql/data/*
4.Configure
auto mount to make the OS mount the devices automatically.
1)
makeGet the UUID. Please downdown the UUID ,TYPE and directory
blkid /dev/FCIDataVG1/FCIDataLV1
/dev/FCIDataVG1/FCIDataLV1:
UUID="727bdb53-d2c3-4799-8fbf-1b138244bc92" TYPE="xfs"
2).Edit
/etc/fstab to configure auto mount in node3.
Please
review this article for more detail
4.Cluster configuration.
1.Edit /etc/hosts to specify the node and ips in node1,node2 and node3.
The hosts files on three nodes should
have same setting
2.Create a file to
store the SQL Server username and password for the Pacemaker login. Run the
following command in node3 (The same login name and password used in node1 and
node2)
sudo touch
/var/opt/mssql/secrets/passwd
sudo echo
'sqlpackmaker' >> /var/opt/mssql/secrets/passwd
sudo echo
'YourStrongP@ssword1' >> /var/opt/mssql/secrets/passwd
sudo chown root:root
/var/opt/mssql/secrets/passwd
sudo chmod 600
/var/opt/mssql/secrets/passwd
3.On both cluster
nodes, open the Pacemaker firewall ports. To open these ports with firewalld, run the following
command in node 1 and node2
sudo firewall-cmd
--permanent --add-service=high-availability
sudo firewall-cmd
--reload
7.Install Pacemaker
packages in node 1 and node2
sudo yum install
pacemaker pcs fence-agents-all resource-agents
8.Set the password
for the default user that is created when installing Pacemaker and Corosync
packages. Use the same password in node1,node2 and node3
sudo passwd hacluster
9.To allow nodes to
rejoin the cluster after the reboot, enable and start pcsd service
and Pacemaker. Run the following command in node3
sudo systemctl enable
pcsd
sudo systemctl start
pcsd
sudo systemctl enable
pacemaker
10.Add the node3 in
cluster. Run following commands in active node(node1 in this case)
sudo pcs host
auth node3
sudo pcs cluster node
add node3
sudo pcs cluster
start --all
sudo pcs cluster
enable --all
11.
Install the FCI resource agent for SQL Server. Run the following commands in node1
and node2
sudo yum install
mssql-server-ha
Failover
===
sudo pcs resource move sqlvirtualname1 <NodeName>
Comments
Post a Comment