In the previous article, we completed the initial configuration of the GBase 8s HAC cluster. This article will focus on configuring trust relationships between the primary and secondary nodes and how to set up and verify the HAC cluster status.
1. Configuring Trust
Trust is the foundation for communication between cluster nodes. We can achieve this by configuring the .rhosts
file or using the REMOTE_SERVER_CFG
parameter. Choose the appropriate trust configuration method based on your enterprise's security requirements.
Configuring Trust with the .rhosts File
The .rhosts
file in the user's home directory contains trusted {host ~ user}
relationships, granting trust to a specific account on a specific host. Simply put, .rhosts
is about the trust of the same user across different hosts, only trusting a specific user on a trusted host. This method is suitable for environments with low security requirements for the operating system, where trust needs to be specified at the user level. The gbasedbt
user can modify the .rhosts
file to configure trust.
Configuration Steps:
-
First, modify the
/etc/hosts
file. Execute the following as the root user on both the primary and secondary nodes:vi /etc/hosts
. Add the IP addresses and hostnames of the primary and secondary nodes. The configuration should be the same on both servers.
[root@localhost opt]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.16.128 prim 192.168.16.129 hac
-
After modifying the
/etc/hosts
file, create a.rhosts
file in thegbasedbt
user's home directory. Add the hostnames and the trusted usergbasedbt
for both nodes in the file.
[gbasedbt@hac ~]$ cat .rhosts prim gbasedbt hac gbasedbt
Finally, configure the correct
sqlhosts
file to complete the trust setup. The configuration of thesqlhosts
file was covered in the previous article. This completes the trust configuration.
Configuring Trust with the REMOTE_SERVER_CFG Parameter
The REMOTE_SERVER_CFG
parameter specifies a file that lists trusted remote hostnames or IP addresses. This file must be located in the $GBASEDBTDIR/etc
directory. If this parameter is set, the /etc/hosts.equiv
file will not be used. This method is suitable for environments with high-security requirements for the operating system, where the operating system checks for trust files like hosts.equiv
and prohibits trust at the OS level. In this case, trust can be configured using the REMOTE_SERVER_CFG
parameter within the database.
Configuration Steps:
-
First, create a
hosts.trust
file in theetc
directory of the database installation directory. Do this on both the primary and secondary nodes.
[gbasedbt@hac ~]$ cd $GBASEDBTDIR/etc [gbasedbt@hac ~]$ vi hosts.trust [gbasedbt@hac ~]$ cat hosts.trust + gbasedbt
-
Next, modify the
REMOTE_SERVER_CFG
parameter. Usegadmin -wf
to dynamically modify the parameter or modify theonconfig
file and restart the database. The default value ofREMOTE_SERVER_CFG
is empty; change it tohosts.trust
. Do this on both the primary and secondary nodes.
[gbasedbt@hac ~]$ gstat -g cfg | grep REMOTE_SERVER_CFG Your evaluation license will expire on 2025-07-06 00:00:00 REMOTE_SERVER_CFG hosts.trust S6_USE_REMOTE_SERVER_CFG 0
Finally, configure the correct
sqlhosts
file to complete the trust setup. The configuration of thesqlhosts
file was covered in the previous article. This completes the trust configuration.
2. Setting Up the HAC Cluster
After completing the preparation work, we can set up the cluster relationship.
-
First, set the primary node. In the command,
HAC
is the name of the secondary node instance. Afterward, check the cluster status. You will find thatHAC
is in aDisconnected
state.
[gbasedbt@prim ~]$ onmode -d primary hac Your evaluation license will expire on 2025-07-06 00:00:00 [gbasedbt@prim ~]$ gstat -g cluster Your evaluation license will expire on 2025-07-06 00:00:00 On-Line (Prim) -- Up 00:04:57 -- 674664 Kbytes Primary Server:prim Current Log Page:7,4078 Index page logging status: Enabled Index page logging was enabled at: 2024/07/07 14:28:24 Server ACKed Log Applied Log Supports Status (log, page) (log, page) Updates hac 0,0 0,0 No ASYNC(HDR),Disconnected,Off
-
Next, perform data recovery. Ensure that the secondary node is in a
shutdown
state before executing the following command. Execute the command on the primary node:
[gbasedbt@prim gbase_dbs]$ ontape-s -L 0 -t STDIO | ssh 192.168.16.129 "source /home/gbasedbt/profile.hac && ontape-p -t STDIO" Your evaluation license will expire on 2025-07-06 00:00:00 The authenticity of host '192.168.16.129 (192.168.16.129)' can't be established. ECDSA key fingerprint is SHA256:XH0PY7Yz01qxcIYvvhfH/9++RyQDPiKfjTntyQ1CpSw. ECDSA key fingerprint is MD5:5d:aa:64:0e:13:1f:f0:26:f8:34:a2:49:f2:bf:8c:e5. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.16.129' (ECDSA) to the list of known hosts. gbasedbt@192.168.16.129's password: Your evaluation license will expire on 2025-07-06 00:00:00 Your evaluation license will expire on 2025-07-06 00:00:00
-
After executing this command on the primary node, check the status of the secondary node. The secondary node will now be in
Fast Recovery
state.
[gbasedbt@hac gbase_dbs]$ gstat - Your evaluation license will expire on 2025-07-06 00:00:00 Fast Recovery -- Up 00:00:50 -- 597864 Kbytes
-
Now, set the secondary node. Execute the following commands on the secondary node. After execution, check the status of the secondary node. The secondary node status will first change to
Fast Recovery (Sec)
and then toRead-Only (Sec)
. At this point, check the cluster status. Thehac
node will be inConnected
state. This completes the HAC cluster setup.
[gbasedbt@hac gbase_dbs]$ gadmin -d secondary prim Your evaluation license will expire on 2025-07-06 00:00:00 [gbasedbt@hac gbase_dbs]$ gstat - Your evaluation license will expire on 2025-07-06 00:00:00 Fast Recovery (Sec) -- Up 00:01:40 -- 1135464 Kbytes [gbasedbt@hac gbase_dbs]$ gstat - Your evaluation license will expire on 2025-07-06 00:00:00 Read-Only (Sec) -- Up 00:02:12 -- 1135464 Kbytes [gbasedbt@hac ~]$ gstat -g cluster Your evaluation license will expire on 2025-07-06 00:00:00 Read-Only (Sec) -- Up 03:23:00 -- 1135464 Kbytes Primary Server:prim Index page logging status: Enabled Index page logging was enabled at: 2024/07/07 14:28:24 Server ACKed Log Supports Status (log, page) Updates hac 7,4111 No ASYNC(HDR),Connected,On
With this article and the previous one, we have covered the entire process of setting up and deploying the GBase 8s HAC cluster. Building a high-availability cluster is crucial for ensuring the stable operation of enterprise databases. I hope this article helps you better understand and apply the HAC features of GBase 8s.
Top comments (0)