Node table
The node table is used to store information about each node in the deployed AntDB cluster, including the same/asynchronous relationship between slave and master nodes, etc.
The following is the data in the node table as viewed using the list node command: For example: Connect to adbmgr and execute:
postgres=# list node;
name | host | type | mastername | port | sync_state | path | initialized | incluster | readonly |
coord1 | localhost1 | coordinator master |
| 6604 |
| /data/antdb/data/coord1 | t | t | f |
coord2 | localhost2 | coordinator master |
| 6604 |
| /data/antdb/data/coord1 | t | t | f |
db1 | localhost1 | datanode master |
| 16323 |
| /data/antdb/data/db1 | t | t | f |
db2 | localhost2 | datanode master |
| 16323 |
| /data/antdb/data/db2 | t | t | f |
gc | localhost1 | gtmcoord master |
| 7693 |
| /data/antdb/data/gc | t | t | f |
The output is listed in the following table with a selection of 5 items:
Each column in the node table is explained as follows:
Column name | Description |
name | The name of the node in the AntDB cluster, for example, coord2 is the name of one of the coordinators. |
host | The host where the node is located, for example, the coord2 node is deployed on the localhost2 host. |
type | The types of node, for example, the coord2 is one of the coordinators in the AntDB cluster. |
mastername | The name of master node. This column is only valid to slave node, but not valid to master node. |
port | Port number. The port number deployed by the node to use on the host. |
sync_state | Synchronous/ asynchronous relation. Valid only to slave node. The value “sync” means the slave node is a synchronous one, “potential” means the slave node is a potential synchronous node, and “async” means the slave node is an asynchronous one. |
path | The path where the node stores data files on the host. |
initialized | Whether this node is initialized. “t” represents it is initialized, “f” represents it is not. |
incluster | Whether this node is in the cluster. “t” represents it belongs to the cluster, “f” represents it doesn’t belong. |
readonly | Whether this node is read-only. Only valid to coordinator nodes. “t” represents it is read-only, “f” represents it is read-write. |
The following are examples of commands commonly used to operate the node table (refer to Chapter 4 for more details on how to use the commands related to the node table).
-- Add node information for the AntDB cluster to the node table:
add gtmcoord master gc_1 (host=localhost1,port=6768,path='/home/antdb/data/gc1');
add gtmcoord slave gc_2 for gtm_1 (host=localhost2,port=6768,path='/home/antdb/data/gc2');
add coordinator master coord1(host=localhost1, port=5532,path='/home/antdb/data/coord1');
add coordinator master coord2(host=localhost2, port=5532,path='/home/antdb/data/coord2');
add datanode master db1_1 (host=localhost1, port=15533,path='/home/antdb/data/db1');
add datanode slave db1_2 for db1_1 (host=localhost2, port=15533,path='/home/antdb/data/db1');
add datanode slave db1_3 for db1_1 (host=localhost3, port=15533,path='/home/antdb/data/db1');
add datanode master db2_1(host=localhost2, port=15436,path='/home/antdb/data/db2');
add datanode slave db2_2 for db2_1 (host=localhost1, port=15436,path='/home/antdb/data/db2');
add datanode slave db2_3 for db2_1 (host=loModify a column in the node table (feel free to modify values in the node table until the cluster is init):calhost3, port=15436,path='/home/antdb/data/db2');
--
alter datanode slave db1_2(port=34332);
alter datanode master db1_1(port=8899);
-- Delete a row from the node table (feel free to add and delete values from the node table until the cluster is init):
drop datanode slave db1_2;
drop datanode master db1_1;
drop coordinator master coord1;
drop gtmcoord slave gc_2;
-- Displays information about all nodes in the node table:
list node;