首页 > 其他 > 详细

SaltStack 之 快速安装

时间:2018-06-09 18:48:56      阅读:209      评论:0      收藏:0      [点我收藏+]
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,并设置开机自启动
[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 之 快速安装

原文:http://blog.51cto.com/12965094/2126761

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!