设为首页 收藏本站
查看: 1053|回复: 0

[经验分享] saltstack简单介绍和安装

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2016-11-25 08:21:59 | 显示全部楼层 |阅读模式
saltstack是一个新的基础平台管理工具; C/S架构
https://docs.saltstack.com/en/la ... allation/index.html
优点:
1.安装、部署简单,可快速启动服务
2.可支撑管理上万台服务器的规模
3.传输数据基于ZeroMQ(轻量级消息队列),传输数据并发、快速
4.支持API及自定义模块,可以通过Python轻松扩展
依赖:
DEPENDENCIES
Salt should run on any Unix-like platform so long as the dependencies are met.

Python 2.6 >= 2.6 <3.0
msgpack-python - High-performance message interchange format
YAML - Python YAML bindings
Jinja2 - parsing Salt States (configurable in the master settings)
MarkupSafe - Implements a XML/HTML/XHTML Markup safe string for Python
apache-libcloud - Python lib for interacting with many of the popular cloud service providers using a unified API
Requests - HTTP library
Tornado - Web framework and asynchronous networking library
futures - Backport of the concurrent.futures package from Python 3.2

端口:
4505:为salt的消息发布专用端口    //在monion端ss -e会发现一直和master的4505端口保持链接,用于和客户端的长连接,保证master端和minion端的消息通信正常
4506:用于文件服务的传输端口,进行认证等

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
环境:
[iyunv@salt-master salt]# salt '*' grains.item  os osrelease
salt-master:
    ----------
    os:
        CentOS
    osrelease:
        7.2.1511
hddcluster3:
    ----------
    os:
        RedHat
    osrelease:
        7.3
hddcluster2:
    ----------
    os:
        RedHat
    osrelease:
        7.2
hddcluster4:
    ----------
    os:
        RedHat
    osrelease:
        7.2
salt-minion01:
    ----------
    os:
        CentOS
    osrelease:
        6.7
hddcluster1:
    ----------
    os:
        RedHat
    osrelease:
        7.2
[iyunv@salt-master salt]#



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
salt-master服务端主机:
详细安装请参考官网,正常情况yum是可以安装saltstack的、
服务器端安装master和minion:
yum install salt-master
yum install salt-minion
查看服务端安装了什么:
[iyunv@salt-master ~]# rpm -ql salt-master
/etc/salt/master
/etc/salt/master.d
/etc/salt/pki/master
/usr/bin/salt
/usr/bin/salt-cp
/usr/bin/salt-key
/usr/bin/salt-master
/usr/bin/salt-run
/usr/bin/salt-unity
/usr/lib/systemd/system/salt-master.service
/usr/share/man/man1/salt-cp.1.gz
/usr/share/man/man1/salt-key.1.gz
/usr/share/man/man1/salt-master.1.gz
/usr/share/man/man1/salt-run.1.gz
/usr/share/man/man1/salt-unity.1.gz
/usr/share/man/man7/salt.7.gz
/var/log/salt/master
[iyunv@salt-master ~]# rpm -ql salt-minion
/etc/salt/minion
/etc/salt/minion.d
/etc/salt/pki/minion
/etc/salt/proxy
/usr/bin/salt-call
/usr/bin/salt-minion
/usr/bin/salt-proxy
/usr/lib/systemd/system/salt-minion.service
/usr/share/man/man1/salt-call.1.gz
/usr/share/man/man1/salt-minion.1.gz
/usr/share/man/man1/salt-proxy.1.gz
/var/log/salt/minion
修改简单的配置:
vi /etc/salt/master
#interface: 0.0.0.0
改为
interface: 10.0.0.177    //10.0.0.177为服务器的本机地址
到此入门的安装配置就已经完毕,下面说minion端的安装配置了



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
客户端只安装minion包括hddcluster1、hddcluster2、hddcluster3、hddcluster4、salt-minion01:
yum install salt-minion
[iyunv@salt-minion01 ~]# rpm -ql salt-minion
/etc/rc.d/init.d/salt-minion
/etc/salt/minion
/etc/salt/minion.d
/etc/salt/pki/minion
/etc/salt/proxy
/usr/bin/salt-call
/usr/bin/salt-minion
/usr/bin/salt-proxy
/usr/share/man/man1/salt-call.1.gz
/usr/share/man/man1/salt-minion.1.gz
/usr/share/man/man1/salt-proxy.1.gz
/var/log/salt/minion
root@salt-minion01 ~]#
vim /etc/salt/minion
#master: salt
改为:
master: 10.0.0.177



------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------
1
2
3
4
5
6
7
8
9
10
11
12
13
启动服务:
   服务端:
    systemctl enable salt-master.service
    systemctl start salt-master.service
    systemctl enbale salt-minion.service
    systemctl start salt-minion.service
   客户端:
        centos7,redhat7:
                systemctl enbale salt-minion.service
                systemctl start salt-minion.service
        centos6:
                /etc/init.d/salt-minion   start  
                chkconfig salt-minion on



1
2
3
4
5
6
7
8
查看端口:
    服务端:
        [iyunv@salt-master ~]# ss -l |grep 450
tcp    LISTEN     0      100    10.0.0.177:4505                  *:*                    
tcp    LISTEN     0      100    10.0.0.177:4506                  *:*                    
    客户端:   
        telnet 10.0.0.177 4505
        telnet 10.0.0.177 4506



-----------------------------------------------------------------------------------------

-----------------------------------------------------------------------------------------
测试阶段:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
查看未接受的key
[iyunv@salt-master ~]# salt-key -L
Accepted Keys:
Denied Keys:
Unaccepted Keys:
hddcluster1
hddcluster2
hddcluster4
salt-master
salt-minion01
Rejected Keys:

一键接受所有key:
[iyunv@salt-master ~]# salt-key -A -y
The following keys are going to be accepted:
Unaccepted Keys:
hddcluster1
hddcluster2
hddcluster3
hddcluster4
salt-master
salt-minion01
Key for minion hddcluster1 accepted.
Key for minion hddcluster2 accepted.
Key for minion hddcluster3 accepted.
Key for minion hddcluster4 accepted.
Key for minion salt-master accepted.
Key for minion salt-minion01 accepted.
[iyunv@salt-master ~]# salt-key -L
Accepted Keys:
hddcluster1
hddcluster2
hddcluster3
hddcluster4
salt-master
salt-minion01
Denied Keys:
Unaccepted Keys:
Rejected Keys:
测试一下:
[iyunv@salt-master ~]# salt  '*' grains.item fqdn_ip4
salt-master:
    ----------
    fqdn_ip4:
        - 10.0.0.177
hddcluster4:
    ----------
    fqdn_ip4:
        - 10.0.0.181
hddcluster3:
    ----------
    fqdn_ip4:
        - 10.0.0.202
hddcluster1:
    ----------
    fqdn_ip4:
        - 10.0.0.197
hddcluster2:
    ----------
    fqdn_ip4:
        - 10.0.0.102
salt-minion01:
    ----------
    fqdn_ip4:
        - 10.0.0.199



1
2
[iyunv@salt-master ~]# salt-master --version   
salt-master 2016.3.4 (Boron)






运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-305162-1-1.html 上篇帖子: SaltStck 搭建Web集群运用示例 (二) 下篇帖子: SaltStck无Master和多Master架构
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表