clush --user=root -g web "uptime" ### --user指明了ssh登录的用户;-g指明了组名;最后是批量执行的命令,将会在组下面所有节点执行该命令。
附录1:clustershell命令使用方法:
Usage: clush [options] command
Options: --version show program's version number and exit -h, --help show this help message and exit -s GROUPSOURCE, --groupsource=GROUPSOURCE optional groups.conf(5) group source to use --nostdin don't watch for possible input from stdin
Selecting target nodes: -w NODES nodes where to run the command -x EXCLUDE exclude nodes from the node list -a, --all run command on all nodes -g GROUP, --group=GROUP run command on a group of nodes -X EXGROUP exclude nodes from this group
Output behaviour: -q, --quiet be quiet, print essential output only -v, --verbose be verbose, print informative messages -d, --debug output more messages for debugging purpose -G, --groupbase do not display group source prefix -L disable header block and order output by nodes -N disable labeling of command line -b, --dshbak gather nodes with same output -B like -b but including standard error -r, --regroup fold nodeset using node groups -S return the largest of command return codes --color=WHENCOLOR whether to use ANSI colors (never, always or auto)
File copying: -c, --copy copy local file or directory to remote nodes --rcopy copy file or directory from remote nodes --dest=DEST_PATH destination file or directory on the nodes -p preserve modification times and modes
Ssh options: -f FANOUT, --fanout=FANOUT use a specified fanout -l USER, --user=USER execute remote command as user -o OPTIONS, --options=OPTIONS can be used to give ssh options -t CONNECT_TIMEOUT, --connect_timeout=CONNECT_TIMEOUT limit time to connect to a node -u COMMAND_TIMEOUT, --command_timeout=COMMAND_TIMEOUT limit time for command to run on the node