Clusterctl
From ISPWiki
Contents |
Functions
The utility can be used for:
- executing a command on multiple nodes.
- managing the node roles.
Please note! You must have root privileges to run the commands.
Operating modes
There are 3 operating modes: specified commands will run on all the nodes either in parallel (in this case the result will output as long as they are processed), or successively with time delay. A required mode is set by the --runmode key:
--runmode parallel Run in parallel --runmode 0 Run successively without time delay (default mode) --runmode N Run with N sec delay
Choosing nodes to start a command
In order to choose a node on which you wish to start a command, you can provide either a role or the exact node:
--role HTTP Start on all the nodes that have the HTTP role. You just need to provide the role's name. --role all Select all roles (by default).
You can provide the exact node.
--node 12.34.56.78 Run on node 12.34.56.78 --node LOCAL Run on the local node --node ALL Run on all nodes (by default)
Examples
- clusterctl --role MASTER
- Use all the node that have the MASTER role
- clusterctl --node LOCAL
- Use a local node
- clusterctl --node LOCAL --role MASTER
- Use a local node, only if it has the MASTER role
- clusterctl --node ALL --role MASTER
- See clusterctl --role MASTER
Special commands
The following special commands are available:
my_roles Show all the roles for the node, on which the command was run. All the local IP-addresses will be located. role_executors Show all the IP-addresses that have the specified role. bind_local_ip Bind the IP-address of all the local node web-servers to the "bind_interface" interface that is specified by the configuration file parameter.
Managing the roles
There is a number of special commands that can be used for managing the role start scripts:
start Run the start script of the specified role and/or node stop Run the stop scripts of the specified role and/or node start_scripts Show all start scripts of the specified role and/or node stop_scripts Show all stop scripts of the specified role and/or node
For example:
- clusterctl --role HTTP --node LOCAL start
- Run the HTTP role scripts on the local node (if any)
- clusterctl --role HTTP start
- Run the HTTP role scripts on all the nodes where it is present
- clusterctl --role HTTP --runmode parallel start
- Run the HTTP role scripts on all the nodes where this role is present in the parallel mode.
Result
The command execution results from different servers are separated by the following lines:
#clusterctl -- 127.0.0.1 ------------------
Everything that the program logged in STDOUT and STDERR will be locally displayed in STDOUT and STDERR. The status of the command execution is specified in a separate line as follows:
#clusterctl Exit with code: 127
Or:
#clusterctl Exit with signal: 9
Or:
#clusterctl Stopped with signal: 5
Examples
Run "uname -a" on all the servers:
clusterctl --role all "uname -a"
First run "uname -a" on all the servers, then run "date":
clusterctl --role all "uname -a" "date"
Monitor the Apache processes on all the worker HTTP:
clusterctl --role HTTP "ps auxw | grep apache"
Find out the roles of the current node:
clusterctl --role all my_roles
Find out the nodes that process the HTTP role
clusterctl --role HTTP role_executors
Bind the local IP-addresses:
clusterctl bind_local_ip
Use an alternative configuration file:
clusterctl --conf /other/path/oproxy.conf ...
Help:
clusterctl --help
Version:
clusterctl --version
Examples on how to manage the role start scripts are described in the corresponding section given above.
