CREATE NODE
Description
Creates a cluster node.
Precautions
CREATE NODE is an API of the cluster management tool. You are advised not to use this API, because doing so affects the cluster. Only the administrator has the permission to use this API.
Syntax
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
CREATE NODE nodename WITH ( [ TYPE = nodetype,] [ HOST = hostname,] [ PORT = portnum,] [ HOST1 = 'hostname',] [ PORT1 = portnum,] [ HOSTPRIMARY [ = boolean ],] [ PRIMARY [ = boolean ],] [ PREFERRED [ = boolean ],] [ SCTP_PORT = portnum,] [ CONTROL_PORT = portnum,] [ SCTP_PORT1 = portnum,] [ CONTROL_PORT1 = portnum, ] [ NODEIS_CENTRAL [= boolean], ] [ NODEIS_ACTIVE [= boolean] ] ); |

The port whose number is specified by PORT is used for internal communications between nodes. Unlike the port connecting to an external client, it can be queried in the pgxc_node table.
Parameters
- nodename
Specifies the node name.
Value range: a string. It must comply with the naming convention.
- TYPE = nodetype
Specifies the type of a node.
Value range:
- 'coordinator'
- 'datanode'
- HOST = hostname
Specifies the host name or IP address of a node.
- PORT = portnum
Specifies the port number of the primary node to which a node is bound.
- HOST1 = hostname
Specifies the name or IP address of the standby node corresponding to a node.
- PORT1 = portnum
Specifies the port number of the standby node to which a node is bound.
- HOSTPRIMARY
Specifies whether the host name or IP address is the primary one.
Value range:
- true
- false (default value)
- PRIMARY = boolean
Specifies whether the node is a primary node or not. A primary node allows read/write operations. A non-primary node allows only read operations.
Value range:
- true
- false (default value)
- PREFERRED = boolean
Specifies whether the node is a preferred node for read operations.
Value range:
- true
- false (default value)
- SCTP_PORT = portnum
Specifies the port used by the TCP proxy communications library of the primary node to listen on the data transmission channel. TCP is used to listen on connections.
- CONTROL_PORT = portnum
Specifies the port used by the TCP proxy communications library of the primary node to listen on the control transmission channel. The TCP protocol is used to listen on connections.
- SCTP_PORT1 = portnum
Specifies the port used by the TCP proxy communications library of the standby node to listen on the data transmission channel. TCP is used to listen on connections.
- CONTROL_PORT 1= portnum
Specifies the port used by the TCP proxy communications library of the standby node to listen on the control transmission channel. The TCP protocol is used to listen on connections.
- NODEIS_CENTRAL
Specifies whether the current node is a central control node. It is used only for CNs and is invalid for DNs.
- true
- false (default value)
- NODEIS_ACTIVE
Specifies whether the current node is normal. It is used to mark whether the CN is removed and is invalid for DNs.
- true
- false (default value)

If there are multiple CNs, cluster nodes are created only on the currently connected CNs and will not be synchronized to other CNs. Cluster nodes must be created on all CNs. To drop a cluster node, you only need to connect to one CN. If cluster nodes are created on only one CN, you need to define the current CN name and drop the cluster node on the current CN. For details, see DROP NODE.
Examples
-- Create cluster nodes and execute them on all CNs. gaussdb=# CREATE NODE datanode1 WITH( TYPE = datanode, PREFERRED = false ); gaussdb=# CREATE NODE datanode2 WITH( TYPE = datanode, PREFERRED = false ); -- Query the initial cluster DN status. gaussdb=# SELECT node_name, nodeis_preferred FROM pgxc_node WHERE node_type = 'D' ORDER BY 1; node_name | nodeis_preferred -----------+------------------ datanode1 | f datanode2 | f (2 rows) -- Set datanode1 as the preferred DN. gaussdb=# ALTER NODE datanode1 WITH(preferred = true); -- Query the cluster DN status after the change. gaussdb=# SELECT node_name, nodeis_preferred FROM pgxc_node WHERE node_type = 'D' ORDER BY 1; node_name | nodeis_preferred -----------+------------------ datanode1 | t datanode2 | f (2 rows) -- Connect to only one CN to drop cluster nodes. gaussdb=# DROP NODE datanode1; gaussdb=# DROP NODE datanode2;
Helpful Links
ALTER NODE and DROP NODE
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot