CREATE NODE nodename WITH ( [ TYPE = nodetype,] [ HOST = hostname,] [ PORT = portnum,] [ PRIMARY,] [ PREFERRED ] )
Note: The following description applies only to Postgres-XC
CREATE NODE is new SQL query specific to Postgres-XC since 0.9.7 that creates a new entry in catalog table pgxc_node with node data.
This node data is directly used by a Coordinator session when connecting to build connection data to cluster nodes through Postgres-XC pooler.
Node connection information is created on pooler only if it has not been the case yet on Coordinator connected at the moment of connection.
CREATE NODE only runs on the local node where it is launched.
The name of the selected cluster node.
The type of the cluster node. It is possible to specify a Coordinator node or a Datanode node.
Defines if the cluster node is used as a primary for replicated write operations.
Defines if the cluster node is used as a preferely for replicated read operations.
The node type for given cluster node. Possible values are: 'coordinator' for a Coordinator node and 'datanode' for a Datanode node.
The hostname or IP used to connect to the cluster node.
The port number used to connect to the cluster node.
nodename remains constant as long as it is in use.
A slave Datanode cannot be defined as PRIMARY but it can be defined as PREFERRED.
Create a Coordinator node located on local machine using port 6543
CREATE NODE node2 WITH (TYPE = 'coordinator', HOST = 'localhost', PORT = 6543);
Create a Datanode which is a preferred and primary node located on remote machine with IP '192.168.0.3' on port 8888.
CREATE NODE node2 WITH (TYPE = 'datanode', HOST = '192.168.0.3', PORT = 8888, PRIMARY, PREFERRED);