博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
第一天salt stack 笔记
阅读量:6983 次
发布时间:2019-06-27

本文共 2166 字,大约阅读时间需要 7 分钟。

        Saltstack是一个大型分布式的配置管理系统(安装升级卸载软件,检测环境),也是一个远程命令执行系统。通过c/s的模型实现。服务器端对远程客户机的操作:

Saltstack部署:

master:192.168.63.163     

minion:192.168.63.129     

部署要求:两台机器网络互通,最好关闭防火墙。关闭selinux.

1、修改/etc/hosts

[root@www salt]# cat /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.63.129  www.omsclient.com
192.168.63.163  www.oms.com

2、安装服务端:

rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

yum install 

yum install salt-master -y

启动:

/etc/init.d/salt-master start

3、安装客户端:

yum install salt-minion -y

修改配置文件指向服务器:

[root@www salt]# vi /etc/salt/minion

master: 

启动:

[root@www salt]# /etc/init.d/salt-minion start

到此,安装已经完成。服务器端执行 .salt-key list就可以查看到客户端了,但是我实验的时候遇到几个问题这里点出来一下:

一、[root@www ~]# salt-key list

Accepted Keys:
ip-50-63-202-30.ip.secureserver.net
Unaccepted Keys:
Rejected Keys:

这里显然没有加载到,看日志文件发现客户端,有这样一行报错:

二、[root@www salt]# cat /var/log/salt/minion

[salt.crypt   ][CRITICAL] The Salt Master has rejected this 

minion's public key!
To repair this issue, delete the public key for this minion on the Salt Master and 
restart this minion.
Or restart the Salt Master in open mode to clean out the keys. The Salt Minion will now 
exit.

三、不知道什么意思、debug查看情况:

[root@www salt]# salt-minion -l debug

[INFO    ] Setting up the Salt Minion "ip-50-63-202-30.ip.secureserver.net"
[DEBUG   ] Created pidfile: /var/run/salt-minion.pid
[DEBUG   ] Reading configuration from /etc/salt/minion_id:ip-50-63-202-30.ip.secureserver.net

#看到这里应该明白为什么我们主机名那里不知道了,因为salt是从/etc/salt/mimion_id去读取主机名:

四、修改主机名、情况缓存:

[root@www salt]# vi /etc/salt/minion_id 

[root@www salt]# rm -rf minion.d

五、执行命令试试:还是报错。原来是还没有加载key导致:

[root@www ~]# salt 'www.omsclient.com' test ping

No minions matched the target. No command was sent, no jid was assigned.

六、客户端开启debug、master加载key;

[root@www ~]# salt-key -A

The following keys are going to be accepted:
Unaccepted Keys:
www.oms.com
www.omsclient.com
Proceed? [n/Y] y
Key for minion www.oms.com accepted.
Key for minion www.omsclient.com accepted.

七、完成,测试一下命令:

本文转自 小罗ge11 51CTO博客,原文链接:http://blog.51cto.com/xiaoluoge/1597889,如需转载请自行联系原作者
你可能感兴趣的文章
使用docker commit 来扩展一个image
查看>>
jsp 防止sql注入 之 preparestatement篇(转载)
查看>>
Linux之Ansible入门用法(实验解析)
查看>>
Linux系统如何在开机时修改root密码
查看>>
共济失调对我们的危害你知道吗
查看>>
Anychat的绝对路径与相对路径
查看>>
我的友情链接
查看>>
如何使用网络库实现应用级消息收发
查看>>
Single Area OSPF
查看>>
rhel6之yum
查看>>
selenium+ant+testng测试框架简单介绍
查看>>
自己写的DBUtil数据库连接工具类
查看>>
登录多实例MySQL失败,修改密码临时解决,原因不明
查看>>
SCCM 2007 R2部署、操作详解系列之部署篇
查看>>
hystrix thread pool Metrics
查看>>
MDT2012部署问题,MDT中的驱动是如何工作的
查看>>
注意;
查看>>
Selenium 使用要点记录<二>
查看>>
Windows与Linux系统拷贝文件之pscp的使用
查看>>
_xmlXPathNewContext", referenced from
查看>>