Uqbar Management
After Uqbar is installed using PTK, you can operate with the database cluster, including starting, stopping, or restarting the database cluster, and checking the database cluster status.
Note: The following uses the cluster uqbar110 as an example.
Start a Database Cluster
After the database is installed using PTK, it is started by default.
You can run cluster start
to start the database cluster, and you need to specify the cluster name.
# ptk cluster -n uqbar110 start
INFO[2022-12-02T10:22:56.957] operation: start
INFO[2022-12-02T10:22:56.957] ========================================
INFO[2022-12-02T10:22:56.957] start db [172.16.0.127:27009] ...
INFO[2022-12-02T10:22:58.058] start db [172.16.0.127:27009] successfully
INFO[2022-12-02T10:22:58.203] ========================================
INFO[2022-12-02T10:22:58.203] start cluster successfully
All instances in the database cluster are started by default. PTK also support startup of a single instance and you need to specify the IP address of the instance.
# ptk cluster -n uqbar110 start -H 192.168.122.101
Stop a Database Cluster
If you need to stop a database cluster, run cluster stop
to stop all instances in the database cluster by default.
# ptk cluster -n uqbar110 stop
INFO[2022-12-02T10:16:28.092] operation: stop
INFO[2022-12-02T10:16:28.092] ========================================
INFO[2022-12-02T10:16:28.092] stop db [172.16.0.127:27009] ...
INFO[2022-12-02T10:16:29.157] stop db [172.16.0.127:27009] successfully
INFO[2022-12-02T10:16:29.157] ========================================
INFO[2022-12-02T10:16:29.158] stop successfully
If you need to stop an instance in the cluster, you need to use -H
to specify the IP address of the instance. For example,
ptk cluster -n uqbar110 stop -H 192.168.122.101
Restart a Database Cluster
Restarting a database cluster is to stop the database first and then start the database.
You can run cluster restart
to restart a database cluster.
# ptk cluster -n uqbar110 restart
INFO[2022-12-02T10:01:09.013] operation: stop
INFO[2022-12-02T10:01:09.014] ========================================
INFO[2022-12-02T10:01:09.014] stop db [172.16.0.127:27009] ...
INFO[2022-12-02T10:01:10.079] stop db [172.16.0.127:27009] successfully
INFO[2022-12-02T10:01:10.079] ========================================
INFO[2022-12-02T10:01:10.079] stop successfully
INFO[2022-12-02T10:01:10.080] operation: start
INFO[2022-12-02T10:01:10.080] ========================================
INFO[2022-12-02T10:01:10.080] start db [172.16.0.127:27009] ...
INFO[2022-12-02T10:01:11.185] start db [172.16.0.127:27009] successfully
INFO[2022-12-02T10:01:11.329] ========================================
INFO[2022-12-02T10:01:11.329] start cluster successfully
Check the Database Status
You can query the database status by specifying the cluster name (-n) or configuration file (-f) in the following command.
Note: If you specify the configuration file to query the database status, run the command in the directory where the configuration file is located.
[root@hostname]# ptk cluster status -f config.yaml
[ Cluster State ]
database_version : Uqbar-Uqbar
cluster_name : uqbar110
cluster_state : Normal
current_az : AZ_ALL
[ Datanode State ]
id | ip | port | user | instance | db_role | state
-------+--------------+-------+-------+----------+---------+---------
6001 | 172.16.0.245 | 27000 | omm01 | dn_6001 | Normal | Normal