Updated on 2024-08-20 GMT+08:00

CREATE NODE GROUP

Description

Creates a cluster node group.

Precautions

  • CREATE NODE GROUP is an API of the cluster management tool.
  • Only a system administrator has the permission.

Syntax

1
2
3
CREATE NODE GROUP groupname
    WITH ( nodename [, ... ] ) 
    [ BUCKETS [ ( bucketnumber [, ... ] ) ] ];

Parameters

  • groupname

    Specifies the name of a node group.

    Value range: a string. It must comply with the naming convention. A value can contain a maximum of 63 characters.

    A node group name supports all ASCII characters, but you are advised to name a node group according to the naming convention.

  • nodename

    Node name.

    Value range: a string. It must comply with the naming convention. A value can contain a maximum of 63 characters.

  • BUCKETS [ ( bucketnumber [, ... ] ) ]

    The BUCKETS clause is an internal use of the cluster management tool and can be called only during scale-out.

Examples

-- 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
-----------+------------------
 dn_6001_6002_6003 | f
 dn_6004_6005_6006 | f
 dn_6007_6008_6009 | f
(3 rows)

-- Create a node group and replace dn_6001_6002_6003 with the actual node name obtained in the previous step.
gaussdb=# CREATE NODE GROUP test_group WITH ( dn_6001_6002_6003 );

-- Query the node group.
gaussdb=# SELECT group_name, group_members FROM pgxc_group;

-- Delete the node group.
gaussdb=# DROP NODE GROUP test_group;

Helpful Links

ALTER NODE GROUP and DROP NODE GROUP