Initialize the cluster
The cluster nodes have all been added, so you can use the command init all to initialize the cluster. As shown below, you can see the steps inside init all.
postgres=# init all ;
operation type | nodename | status | description
-----------------------+----------+--------+-------------
init gtmcoord master | gc_1 | t | success
start gtmcoord master | gc_1 | t | success
init coordinator | cn1 | t | success
init coordinator | cn2 | t | success
start coordinator | cn1 | t | success
start coordinator | cn2 | t | success
init datanode master | dn1_1 | t | success
init datanode master | dn2_1 | t | success
start datanode master | dn1_1 | t | success
start datanode master | dn2_1 | t | success
init gtmcoord slave | gc_2 | t | success
start gtmcoord slave | gc_2 | t | success
init datanode slave | dn1_2 | t | success
init datanode slave | dn1_2 | t | success
start datanode slave | dn2_2 | t | success
start datanode slave | dn2_2 | t | success
config coordinator | cn1 | t | success
config coordinator | cn2 | t | success
(18 rows)
If there is an error in the middle of init all and some nodes fail to initiate and you want to reinitialize, you can execute the following command to clean up the environment and reinitialize.
stop all mode i; --Stop all nodes
clean all; --Empty the node directory
init all; --re-initialize
View the operation status of each node of the cluster through monitor all:
postgres=# monitor all ;
nodename | nodetype | status | description | host | port | recovery | boot time | nodezone
----------+-----------------+--------+-------------+--------------+------------ --------+----- --------+-------------+--------------+------------
cn1 | coordinator master | t | running | 10.1.226.201 | 5432 | false | 2020-09-01 10:09:30.123+08 | local
cn2 | coordinator master | t | running | 10.1.226.202 | 5432 | false | 2020-09-01 10:09:30.123+08 | local
dn1_1 | datanode master | t | running | 10.1.226.201 | 14332 | false | 2020-09-01 10:09:30.123+08 | local
dn1_2 | datanode slave | t | running | 10.1.226.202 | 14332 | true | 2020-09-01 10:09:30.123+08 | local
dn2_1 | datanode master | t | running | 10.1.226.202 | 24332 | false | 2020-09-01 10:09:30.123+08 | local
dn2_2 | datanode slave | t | running | 10.1.226.201 | 24332 | true | 2020-09-01 10:09:30.123+08 | local
gc_1 | gtmcoord master | t | running | 10.1.226.203 | 6655 | false | 2020-09-01 10:09:30.123+08 | local
gc_2 | gtmcoord slave | t | running | 10.1.226.202 | 6655 | true | 2020-09-01 10:09:30.123+08 | local
(8 rows)
At this point, AntDB cluster initialization is completed. The recovery field indicates whether the node is in recovery state, normally, the value of master node is false, and the value of slave node is true. Note: init all will include the start all operation, which is only used when initializing the cluster, if you want to start the cluster later, please use the start all command. You can log in to the gtmcoord master or the coord master node via the psql command:
psql -p 5432 #log into coord
psql -p 6655 #log into gtmcoord
Note: The application needs to connect to gtmcoord or coord for operations such as adding, deleting, and checking, not adbmgr, which is only used to manage the cluster.