SaltStack 之 快速安装
一、salt-master 安装(控制服务器)
1.下载异步的yum源
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
2.通过yum源安装salt-master
yum -y install salt-master
3.设置salt-master的配置文件
vi /etc/salt/master
4.启动salt-master,并设置开机自启动
[[email protected] ~]# /etc/init.d/salt-master start
[[email protected] ~]# chkconfig sal-master on
二、salt-minion安装(被控制机器)
1.下载异步的yum源
[[email protected] ~]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
2.yum 安装salt-minion
[[email protected] ~]# yum -y install salt-minion
3.修改salt-minion的配置文件,并指向master主机
[[email protected] ~]# vi /etc/salt/minion
4.启动salt-minion,并设置开机自启动
[[email protected] ~]# /etc/init.d/salt-minion start
Starting salt-minion daemon: [确定]
[[email protected] ~]# chkconfig salt-minion on
三、检查从机是否与master主机互连
[[email protected] salt]# salt-key
Accepted Keys:
Denied Keys:
Unaccepted Keys:
BackupServer #已发现从机:BackupServer
Rejected Keys:
[[email protected] salt]# salt-key -A #允许所有主机加入控制
The following keys are going to be accepted:
Unaccepted Keys:
BackupServer
Proceed? [n/Y] y
Key for minion BackupServer accepted.
[[email protected] salt]# salt-key
Accepted Keys:
BackupServer #已成功
Denied Keys:
Unaccepted Keys:
Rejected Keys:
[[email protected] ~]# salt ‘*‘ test.ping
BackupServer:
True #通信正常
备注:salt ‘*‘ test.ping 解释
*: 代表目标,所有主机,如单台只填上id
test: 代表模块
ping: 代表方法
[[email protected] ~]# salt ‘BackupServer‘ cmd.run ‘df -h‘
BackupServer:
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 95G 6.8G 83G 8% /
tmpfs 5.9G 12K 5.9G 1% /dev/shm
/dev/sda1 190M 103M 78M 57% /boot
/dev/mapper/vg-data 99G 1.3G 93G 2% /app
/dev/mapper/vg_server-backup
1.3T 798G 440G 65% /backup
原文地址:http://blog.51cto.com/12965094/2126761
时间: 2024-10-10 22:58:55