CREATE NODE
CREATE NODE
7
SQL - Language Statements
CREATE NODE
create a new cluster node
CREATE NODE nodename WITH
(
[ TYPE = nodetype,]
[ HOST = hostname,]
[ PORT = portnum,]
[ PRIMARY [ = boolean ],]
[ PREFERRED [ = boolean ] ]
)
Description
CREATE NODE is a SQL command specific
to Postgres-XL that creates
a new entry in catalog table pgxc_node with node data.
This node data is directly used by a Coordinator session and its
corresponding Datanode sessions when connecting
to build connection data to cluster nodes through Postgres-XL
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 false>.
To avoid deadlocks and make update consistent, you should specify the same PRIMARY
node at all the nodes.
PREFERRED
Defines if the cluster node is used as a preferred node for replicated
read operations if no node is determined. A boolean
value can be specified. In case no value is specified, PREFERRED
acts like false>.
You can specify different PREFERRED nodes at
different Coordinators. This parameter affects performance of your
Postgres-XL cluster. If you configure a Datanode
where you configure a Coordinator, you should specify
PREFERRED for the Coordinator to such a local
Datanode. This will save network communication and improve cluster-wide
performance.
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.
When using a cluster with 1 Coordinator and 1 Datanode on each server,
defining the local Datanode as PREFERRED can greatly
improve the performance of a system by avoiding any network overhead for
replicated reads, as in this case a local socket is used for communication
between nodes. This has even more effects when the application frequently uses
replicated tables for remote join operations and that those operations can
be operated on the local PREFERRED node.
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-XL specific command.