CREATE NODE

Name

CREATE NODE -- create a new cluster node

Synopsis

CREATE NODE nodename WITH
  (
    [ TYPE = nodetype,]
    [ HOST = hostname,]
    [ PORT = portnum,]
    [ PRIMARY [ = boolean ],]
    [ PREFERRED [ = boolean ] ]
  )

Description

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.

Parameters

nodename

The name of the selected cluster node.

TYPE

The type of the cluster node. It is possible to specify a Coordinator node or a Datanode node.

PRIMARY

Defines if the cluster node is used as a primary node for replicated write operations. A boolean value can be specified. In case no value is specified, PRIMARY acts like true.

PREFERRED

Defines if the cluster node is used as a preferred node for replicated read operations. A boolean value can be specified. In case no value is specified, PREFERRED acts like true.

nodetype

The node type for given cluster node. Possible values are: 'coordinator' for a Coordinator node and 'datanode' for a Datanode node.

hostname

The hostname or IP used to connect to the cluster node.

portnum

The port number used to connect to the cluster node.

Notes

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.

Examples

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);

Compatibility

CREATE NODE does not conform to the SQL standards, it is a Postgres-XC specific command.