Linux 集群管理工具Clustershell,pssh
来源:互联网 发布:thinkphp sql注入漏洞 编辑:程序博客网 时间:2024/05/22 13:02
在集群的现在,管理成千上万的Linux机子成为了一个难题,不能再使用一台一台登录主机去进行管理了,工作量无疑是非常巨大的,这里我们可以借助Clustershell
与pssh
管理,它原理是自动登录主机集群帮我们将脚本进行执行,或者是文件的操作等。
演示Clustershell
使用的是Centos7如操作,我们只需要在一台主机上操作即可完成对集群机子的所有配置
master host.com #主机
cluster1 2.host.com #节点1
cluster2 3.host.com #节点2
cluster3 4.host.com #节点3
免密码登录
主机使用ssh登录1,2,3节点必须是免密码登录方式,不能是首次登录,因为Clustershell不会自动输入交互命令,例如第一次登录主机会有下面提示。
ssh root@2.host.comThe authenticity of host '2.host.com (192.168.0.20)' can't be established.ECDSA key fingerprint is d4:5d:d6:e6:bc:70:86:1b:42:32:aa:6b:86:a6:34:d4.Are you sure you want to continue connecting (yes/no)?
Clustershell不能处理会提示以下错误
[1] 11:32:17 [FAILURE] 2.host.com Exited with error code 255
生成密钥
ssh-keygen -t rsa
公钥内容复制到各个节点上
scp ~/.ssh/id_rsa.pub 192.168.0.20:/root/.ssh/authorized_keysscp ~/.ssh/id_rsa.pub 192.168.0.21:/root/.ssh/authorized_keysscp ~/.ssh/id_rsa.pub 192.168.0.22:/root/.ssh/authorized_keys
配置ClusterShell
vim /etc/clustershell/groups.d/local.cfg
内容如下
# ClusterShell groups config local.cfg## Replace /etc/clustershell/groups## Note: file auto-loaded unless /etc/clustershell/groups is present## See also groups.d/cluster.yaml.example for an example of multiple# sources single flat file setup using YAML syntax.## Feel free to edit to fit your needs.adm: example0oss: example4 example5mds: example6io: example[4-6]compute: example[32-159]gpu: example[156-159]all: example[4-6,32-159]demo: [1-3].host.com
以上我们定义了一个分组:demo,通过这个分组可连接1.host.com,2.host.com,3.host.com,如果此三个节点对应的IP地扯没有映射有连接失败,可设置/etc/hosts对应关系
cat /etc/hosts127.0.0.1 localhost::1 localhost localhost.localdomain localhost6 localhost6.localdomain6192.168.0.20 1.host.com192.168.0.21 2.host.com192.168.0.22 3.host.com
clush命令几个重要的参数
- -b : 相同输出结果合并
- -w : 指定节点
- -a : 所有节点
- -g : 指定组
- –copy : 群发文件
各个节点执行ls
命令
clush -g demo "ls"
创建文件
clush -g demo "touch /root/demo.txt"
群发文件
clush -g demo --copy groups --dest /root
演示pssh
安装
yum install pssh -y
编辑节点IP地扯
vim /root/hosts.txt
1.host.com2.host.com3.host.com
节点执行命令
pssh -H hosts.txt -P "ls"
阅读全文
1 0
- Linux 集群管理工具Clustershell,pssh
- 安装ClusterShell集群管理工具
- Linux集群管理工具pssh批量管理服务器
- Linux集群管理工具PSSH批量管理服务器
- 集群管理工具ClusterShell 安装手记
- 【Linux运维入门】PSSH-轻量集群管理工具
- 轻量集群管理工具PSSH
- Linux下批量管理工具pssh
- linux集群批量管理工具parallel-ssh(pssh)的安装与使用
- Hadoop-Linux集群批量部署管理工具parallel-ssh(PSSH)的安装与使用
- Linux集群批量管理工具parallel-ssh(PSSH)的安装与使用
- Linux系统之工具篇(二)集群管理软件clustershell
- 运维利器-ClusterShell集群管理
- Linux命令--pssh
- Linux运维利器之ClusterShell
- Linux运维利器之ClusterShell
- Linux运维利器之ClusterShell
- Linux运维利器之ClusterShell
- Linux查看和剔除当前登录用户
- php $_GET与$_POST
- c++单例模式(线程安全,没有内存泄漏)
- 嵌入式系统烧写
- C++函数模板(泛型编程一)
- Linux 集群管理工具Clustershell,pssh
- java-多态(概念、扩展、转型、示例、多态中成员的特点、)
- javaweb
- hdu3549—Flow Problem(FF模板)
- Streaming kakfa 扩展源码 指定起始offset和结束offset
- 一个支持高并发的jdbc,内置连接池
- Spark成长之路(6)-Correlation
- 查看 SELinux状态及关闭SELinux
- angular使用下拉框+表单