Klustron Cluster Physical Backup and Restore Operation Guide
Klustron Cluster Physical Backup and Restore Operation Guide
Objective
This article assumes that the user is familiar with creating a cluster in Klustron-1.1.1 database and knows how to prepare backup storage targets (in this article, the backup target configured is HDFS) before the testing.
This article aims to guide users on adding backup storage targets, performing physical full backup of an existing cluster, restoring the complete backup set to another cluster, and detailing each step of the process. The main testing procedures in this article are all completed through the XPanel console.
The XPanel service is installed on a server with the IP address of 192.168.221.17. Open a browser on a computer that can access 192.168.221.17 and enter the address: http://192.168.221.17:18080/KunlunXPanel/#/login?redirect=%2Fdashboard.
(The initial login username and password are super_dba/super_dba, and the super_dba password needs to be changed on the first login.)
After logging in, navigate to "Cluster List" where a preconfigured cluster named "cluster1" with a computing node IP of 192.168.221.17 and service port of 47001, one storage shard node, and a storage master node IP of 192.168.221.18 and service port of 57003 is already set up.
1 Add backup storage target
1.1 Click "Backup Storage Target Management".
1.2 Click "New".
1.3 Enter the corresponding parameters (In this example, the HDFS service IP address is 192.168.221.16 and the port is 9000).
Click "Confirm".
1.4 The backup storage target is added.
2 Prepare test data
2.1 Open an ssh terminal window connected to 192.168.221.17, log in to the host as the kunlun user, and then use the PostgreSQL client to connect to the cluster, create a test table, and insert test data.
Use the following commands:
[kunlun@kunlun1 ~]$ id
[kunlun@kunlun1 ~]$ source /kunlun/env.sh
[kunlun@kunlun1 ~]$ psql -h 192.168.221.17 -p 47001 -U abc postgres
postgres=# CREATE TABLE testtable1 (id int primary key);
postgres=# insert into testtable1 values(1);
postgres=# select * from testtable1 ;
The output information is displayed as follows:
3 Perform a full backup operation on cluster "cluster1"
3.1 Go back to the browser window and in the "Cluster List", locate the "cluster1" cluster and click the "Settings" button on the right.
3.2 Click the "Settings" button.
3.3 Click "Full Backup".
3.4 Click "Initiate Full Backup".
3.5 Click "Full Backup Record" to check the status of the backup in progress.
The following figure shows the final status information.(The final status information will depend on the size of the database and the scale of the entire cluster, and the duration of the backup process will vary accordingly.)
4 Create another cluster, "cluster2", with the same configuration as "cluster1".
4.1 The "cluster2" cluster has a computing node with IP address 192.168.221.18 and service port 47001, 1 storage shard with a master node at IP address 192.168.221.19 and service port 57003.
5 Cluster restore (rollback) operation
5.1 Click the "Rollback" button on the right of cluster "cluster2".
5.2 Click the "Rollback" button and select the source cluster from the dropdown list of "Original Cluster Name". In this case, there is only one available cluster, select "cluser_1671517329_000001". Click "Now" in the date and time picker and then "Confirm".
After confirming that there are no errors, click on "Confirm".
Note: When selecting the rollback time, make sure the selected time point is between any full backup time and the current time.
5.3 In the prompt window, you can see a declaration message that if the rollback operation is executed, the data of the second cluster "cluster2" (internal ID: cluster_1671517549_000002) will be overwritten. Click "Confirm" to execute the full database restore (rollback) operation.
5.4 A system prompt indicates that the rollback operation is in progress.
5.5 After the cluster restore (rollback) is successful, the following prompt will be displayed.
6 Data restore check
6.1 Open an ssh terminal window connected to cluster "cluster2" (computing node IP: 192.168.221.18) and log in as user "kunlun". Then use the PostgreSQL client to connect to the cluster and execute a data query command:
[kunlun@kunlun2 ~]$ id
[kunlun@kunlun2 ~]$ source /kunlun/env.sh
[kunlun@kunlun2 ~]$ psql -h 192.168.221.18 -p 47001 -U abc postgres
postgres=#select * from testtable1;
The information is displayed as follows:
The cluster data restore is now complete.