Installing Clustershell
Install from https://github.com/cea-hpc/clustershell/downloads below source or binary package.
The following is an example of CentOS6.6 using RPM installation:
wget https://github.com/downloads/cea-hpc/clustershell/clustershell-1.5.1-1.el6.noarch.rpm
RPM-IVH clustershell-1.5.1-1.el6.noarch.rpm
Source Installation Method:
wget https://github.com/downloads/cea-hpc/clustershell/clustershell-1.5.1.tar.gz
TAR-XVF clustershell-1.5.1.tar.gz
CD clustershell-1.5.1
sudo python setup.py install
Mkdir/etc/clustershell
CP conf/*/etc/clustershell
Using Clustershell
First, create a group for the node that we want to manage. If we need to manage 10 Web servers, the hostname is WEB1-WEB10, then we first create a file/etc/clustershell/groups, the following:
Web:web1 web2 web3 web4 web5 web6 web7 web8 web9 WEB10 |
Where: The Web is the group name, and Web1-10 is the name of all the hosts under the group.
You can then use Clustershell to execute commands in bulk:
Clush--user=root-g Web "Uptime" # # # #--user indicates the user of SSH login;-G indicates the group name, and finally the command executed in bulk, which executes the command at all nodes below the group.
650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; border-bottom:0px; border-left:0px; Display:inline "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/6C/D1/ Wkiom1vst-hyuyxwaamaf05wp38910.jpg "" 820 "height=" 266 "/>
Appendix 1:clustershell How to use the command:
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 & nbsp; 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 the this group Output behaviour: -Q,--quiet is 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 is 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 |
Clustershell Bulk execution of shell commands