SaltStack 之 快速安装

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

SaltStack 之 快速安装

SaltStack 之 快速安装

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 

SaltStack 之 快速安装

SaltStack 之 快速安装

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

转载于:https://blog.51cto.com/12965094/2126761

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值