1. 软件及版本
clustershell 1.7.3
2. 功能
集群管理工具,把一台服务器作为主控,建立到其他服务器的免密,则可以在这台服务器上统一管理其他服务器。
3. 安装
3.1. 下载软件
3.2. 解压到当前目录,执行安装指令
tar -xvf clustershell-1.7.3.tar.gz
python setup.py install
3.3. 添加配置文件
在/etc/clustershell中添加配置文件groups.conf,内容如下:
# Configuration file for ClusterShell node groups
# This is an example file, please edit to fit your needs!
#
# Please see man groups.conf(5).
#
# $Id: groups.conf 457 2011-02-06 22:35:49Z st-cea $
[Main]
default: local
[local]
map: awk -F: '/^$GROUP:/ {print $2}' /etc/clustershell/groups
all: awk -F: '/^all:/ {print $2}' /etc/clustershell/groups
list: awk -F: '/^[[:alnum:]_]/ {print $1}' /etc/clustershell/groups
[genders]
map: nodeattr -n $GROUP
all: nodeattr -n ALL
list: nodeattr -l
[slurm]
map: sinfo -h -o "%N" -p $GROUP
all: sinfo -h -o "%N"
list: sinfo -h -o "%P"
reverse: sinfo -h -N -o "%P" -n $NODE
3.4. 配置服务器组
在/etc/clustershell目录添加配置文件group,参考下面的配置:
# xxx系统服务器,2021/05/13
xxx: 1.1.1.1 2.2.2.2 3.3.3.[14-19]
3.5. 建立到配置服务器的免密登录
4. 使用
clush -g xxx “your command”
clush -w 1.1.1.1,2.2.2.2 “you command”
使用帮助如下:
[root@10 clustershell]# clush -h
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
787

被折叠的 条评论
为什么被折叠?



