服务器集群管理软件clustershell的安装和使用

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

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值