SaltStack 之 快速安裝
阿新 • • 發佈:2018-06-09
saltsatckSaltStack 之 快速安裝
一、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,並設置開機自啟動 [root@SlatStack-Master ~]# /etc/init.d/salt-master start [root@SlatStack-Master ~]# chkconfig sal-master on
二、salt-minion安裝(被控制機器)
1.下載異步的yum源
[root@localhost ~]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
2.yum 安裝salt-minion
[root@localhost ~]# yum -y install salt-minion
3.修改salt-minion的配置文件,並指向master主機
[root@localhost ~]# vi /etc/salt/minion
4.啟動salt-minion,並設置開機自啟動 [root@localhost ~]# /etc/init.d/salt-minion start Starting salt-minion daemon: [確定] [root@localhost ~]# chkconfig salt-minion on
三、檢查從機是否與master主機互連
[root@SlatStack-Master salt]# salt-key Accepted Keys: Denied Keys: Unaccepted Keys: BackupServer #已發現從機:BackupServer Rejected Keys: [root@SlatStack-Master salt]# salt-key -A #允許所有主機加入控制 The following keys are going to be accepted: Unaccepted Keys: BackupServer Proceed? [n/Y] y Key for minion BackupServer accepted. [root@SlatStack-Master salt]# salt-key Accepted Keys: BackupServer #已成功 Denied Keys: Unaccepted Keys: Rejected Keys: [root@SlatStack-Master ~]# salt ‘*‘ test.ping BackupServer: True #通信正常
備註:salt ‘*‘ test.ping 解釋
*: 代表目標,所有主機,如單臺只填上id
test: 代表模塊
ping: 代表方法
[root@SlatStack-Master ~]# 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
SaltStack 之 快速安裝