1:操作系统环境
1
2
3
4
5
6
7
8
9
10
11
root@iZ23f6c5z8tZ:~# lsb_release -a
No LSB modules are available.
Distributor ID:Ubuntu
Description:Ubuntu 14.04.2 LTS
Release:14.04
Codename:trusty
root@iZ23f6c5z8tZ:/etc/apt# uname -m
x86_64
root@iZ23f6c5z8tZ:/etc/apt# uname -r
3.13.0-32-generic
注:机器操作系统均为ubuntu14.04 64bit
角色
1
2
192.168.1.10 salt-master
192.168.1.11 salt-minion-node1
2:安装salt-master
1
2
更新
root@iZ23f6c5z8tZ:~# apt-get update
1
2
root@iZ23f6c5z8tZ:~# apt-get install software-properties-common
注意从Ubuntu 12.10(Raring Ringtail)开始, add-apt-repository 在作为一部分包含在 software-properties-common 包里。
1
2
安装salt-master
root@iZ23f6c5z8tZ:~# apt-get install salt-master -y
查看salt-master程序
1
2
3
4
5
6
7
8
9
10
11
root@iZ23f6c5z8tZ:~# ps -ef|grep salt
root 4452 1 0 16:46 ? 00:00:02 /usr/bin/python /usr/bin/salt-master
root 4461 4452 0 16:46 ? 00:00:00 /usr/bin/python /usr/bin/salt-master
root 4468 4452 0 16:46 ? 00:00:00 /usr/bin/python /usr/bin/salt-master
root 4469 4452 0 16:46 ? 00:00:00 /usr/bin/python /usr/bin/salt-master
root 4470 4452 0 16:46 ? 00:00:00 /usr/bin/python /usr/bin/salt-master
root 4471 4452 0 16:46 ? 00:00:00 /usr/bin/python /usr/bin/salt-master
root 4476 4452 0 16:46 ? 00:00:00 /usr/bin/python /usr/bin/salt-master
root 4477 4452 0 16:46 ? 00:00:00 /usr/bin/python /usr/bin/salt-master
root 4478 4452 0 16:46 ? 00:00:00 /usr/bin/python /usr/bin/salt-master
root 4816 1376 0 17:04 pts/1 00:00:00 grep --color=auto salt
master启动后默认监听4505和4506两个端口。4505(publish_port)为salt的消息发布系统,4506(ret_port)为salt客户端与服务端通信的端口。
1
2
3
root@iZ23f6c5z8tZ:~# netstat -ntpl|grep python
tcp 0 0 0.0.0.0:4505 0.0.0.0:* LISTEN 4468/python
tcp 0 0 0.0.0.0:4506 0.0.0.0:* LISTEN 4452/python
salt-master配置文件
1
2
3
4
5
6
root@iZ23f6c5z8tZ:/etc/salt# pwd
/etc/salt
root@iZ23f6c5z8tZ:/etc/salt# ls
master master.bak master.d pki
root@iZ23f6c5z8tZ:/etc/salt# grep '^[a-Z]' /etc/salt/master
interface: 121.40.139.41 //监听IP
重启salt-master
1
2
3
root@iZ23f6c5z8tZ:/etc/salt# service salt-master restart
salt-master stop/waiting
salt-master start/running, process 5009
4:安装salt-minion
1
2
root@iZ2803zsab7Z:~# apt-get update
root@iZ2803zsab7Z:~# apt-get install salt-minion -y
salt-minion状态
1
2
root@iZ2803zsab7Z:~# service salt-minion status
salt-minion start/running, process 4305
salt-minion配置文件
1
2
3
4
5
6
7
root@iZ2803zsab7Z:/etc/salt# pwd
/etc/salt
root@iZ2803zsab7Z:/etc/salt# ls
minion minion.bak minion.d minion_id pki
root@iZ2803zsab7Z:/etc/salt# grep '^[a-z]' minion
master: 121.40.139.41//连接master端IP地址
注:id是客户端主机名(其实也就是认证key的名字)用来和master进行认证,如果没有更改的话。会找minion主机名作为
以上就是salt的master和minion安装
1
2
3
4
5
root@iZ23f6c5z8tZ:~# salt-key -L//查看minion列表
Accepted Keys:
Unaccepted Keys:
iZ2803zsab7Z
Rejected Keys:
1
2
3
4
5
6
root@iZ23f6c5z8tZ:~# salt-key -A//接受所有key,在提示中提示y确认即可.接下来便可以向minion发送命令了,-a 指定单个
The following keys are going to be accepted:
Unaccepted Keys:
iZ2803zsab7Z
Proceed? [n/Y] y
Key for minion iZ2803zsab7Z accepted.
1
2
3
root@iZ23f6c5z8tZ:~# salt '*' test.ping
iZ2803zsab7Z:
True
运维网声明
1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网 享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com