Performing Batch Operations on Nodes
This section describes how to use the gpssh tool provided by Greenplum to run commands in batches on multiple nodes in the Greenplum cluster. gpssh is a tool provided by Greenplum for running remote commands on all (or specified) nodes in a cluster. It allows the master node to efficiently manage the entire Greenplum cluster without logging in to each node and running the same command. Perform the operations in this section on the master node.
The procedure is as follows:
- Log in to the Greenplum master node gp-mdw as the gpadmin user.
- Use the all_hosts file that contains the host names of all nodes to connect all nodes to the master node. Then, operations on other nodes can be performed in batches through the master node.
gpssh -f /data/gpdb/all_hosts
- Create a master directory.
mkdir -p /data/gpdb/master
This command creates a directory named master on each node in the cluster. If the name of each node is returned, the command is successfully executed on the corresponding node. Expected result:
[gp-mdw] [gp-sdw]
- Create a segment data directory, which is used to store the data of segment instances.
mkdir -p /data/gpdb/segdata
This command creates a directory named segment on each node in the cluster. If the name of each node is returned, the command is successfully executed on the corresponding node. Expected result:[gp-mdw] [gp-sdw]
Parent topic: Connecting All Nodes