https://clustershell.readthedocs.io/en/latest/tools/index.html
clush nodeset
clustershell安装
yum --enablerepo=extras install epel-release
yum install clustershell python2-clustershell
ClusterShell的Python 3子软件包(非必须)
yum install python34-clustershell
clustershell配置
mkdir /root/.config
cp -a /etc/clustershell /root/.config/
[root@xxx ~]# pwd
/root
[root@xxx ~]# tree .config/
.config/
└── clustershell
├── clush.conf
├── groups.conf
├── groups.conf.d
│ ├── genders.conf.example
│ ├── README
│ └── slurm.conf.example
├── groups.d
│ ├── cluster.yaml
│ ├── local.cfg
│ └── README
└── topology.conf.example
vim /root/.config/clustershell/groups.conf
confdir: /root/.config/clustershell/groups.conf.d $CFGDIR/groups.conf.d
autodir: /root/.config/clustershell/groups.d $CFGDIR/groups.d
vim /root/.config/clustershell/groups.d/cluster.yaml
xxx:
all.all.all: '172.17.0.[2,5-6,9,12,15]'
a: '
172.17.0.[2,5,9,12]
'
a.b: '
172.17.0.2
172.17.0.9
172.17.0.12
'
a.d: '
172.17.0.2
172.17.0.5
172.17.0.12
'
说明:
all.all.all a a.b a.d 都是自定义
nodeset
查看所有的组
nodeset -LL
查看组下面所有的机器ip
nodeset -e @组名
clush
执行命令
clush -g 组名 "echo ok"
clush -g 组名 "echo 'rd*PHy8K9BcE' |passwd --stdin dev"
clush --hostfile ssh_err.iplist "echo ok"
clush -w 10.127.21.16 "echo ok"
本地拷贝文件到远程节点上
clush -w ops-server4 --copy test.file --dest /root/
将所有节点的/etc/passwd文件拷贝到本机的/tmp目录下
clush -a --rcopy /etc/passwd --dest=/tmp