问题:

官网方式yum安装完saltstack之后,master与minion都成功启动后,但是却发现怎么都收不到minion的key。(zmq版本不一致所致,困扰了我好几天,希望能帮到大家。)

分析:

master上的状态:

# 查看master 上的配置文件,只修改了interface:
[root@master doubles]# cat /etc/salt/master interface: 192.168.188.128 [root@master doubles]# systemctl status salt-master
● salt-master.service - The Salt Master Server
Loaded: loaded (/usr/lib/systemd/system/salt-master.service; disabled; vendor preset: disabled)
Active: active (running) since Tue 2019-01-08 09:55:59 HKT; 7min ago
Docs: man:salt-master(1)
file:///usr/share/doc/salt/html/contents.html
https://docs.saltstack.com/en/latest/contents.html
Main PID: 9331 (salt-master)
CGroup: /system.slice/salt-master.service
├─9331 /usr/bin/python /usr/bin/salt-master
├─9340 /usr/bin/python /usr/bin/salt-master
├─9345 /usr/bin/python /usr/bin/salt-master
├─9348 /usr/bin/python /usr/bin/salt-master
├─9349 /usr/bin/python /usr/bin/salt-master
├─9350 /usr/bin/python /usr/bin/salt-master
├─9351 /usr/bin/python /usr/bin/salt-master
├─9352 /usr/bin/python /usr/bin/salt-master
├─9353 /usr/bin/python /usr/bin/salt-master
├─9354 /usr/bin/python /usr/bin/salt-master
├─9361 /usr/bin/python /usr/bin/salt-master
├─9362 /usr/bin/python /usr/bin/salt-master
└─9364 /usr/bin/python /usr/bin/salt-master Jan 08 09:55:54 master.doubles.cn systemd[1]: Starting The Salt Master Server...
Jan 08 09:55:59 master.doubles.cn systemd[1]: Started The Salt Master Server. [root@master doubles]# salt-key -L
Accepted Keys:
Denied Keys:
Unaccepted Keys:
Rejected Keys:
# 始终看不到minion的key。
[root@master doubles]# salt-key -a 192.168.188.129
The key glob '192.168.188.129' does not match any unaccepted keys.
[root@master doubles]# salt '*' test.ping
Salt request timed out. The master is not responding. You may need to run your command with `--async` in order to bypass the congested event bus. With `--async`, the CLI tool will print the job id (jid) and exit immediately without listening for responses. You can then use `salt-run jobs.lookup_jid` to look up the results of the job in the job cache later.

看下minion上的salt状态:

# 查看minion上的配置文件,发现只修改了master与id如下:
[root@slave doubles]# vim /etc/salt/minion master: 192.168.188.128 id: 192.168.188.129 # salt-minion开启调试模式
[root@slave doubles]# salt-minion -l debug
...
[DEBUG ] SaltReqTimeoutError, retrying. (1/7)
[DEBUG ] SaltReqTimeoutError, retrying. (2/7)
[DEBUG ] SaltReqTimeoutError, retrying. (3/7)
[DEBUG ] SaltReqTimeoutError, retrying. (4/7)
[DEBUG ] SaltReqTimeoutError, retrying. (5/7)
[DEBUG ] SaltReqTimeoutError, retrying. (6/7)
[DEBUG ] SaltReqTimeoutError, retrying. (7/7)
[DEBUG ] Re-init ZMQ socket: Message timed out
[DEBUG ] Trying to connect to: tcp://192.168.188.128:4506
[ERROR ] Error while bringing up minion for multi-master. Is master at 192.168.188.128 responding?
[DEBUG ] Connecting to master. Attempt 1 of 1
[DEBUG ] Master URI: tcp://192.168.188.128:4506
[DEBUG ] Re-using AsyncAuth for (u'/etc/salt/pki/minion', u'192.168.188.129', u'tcp://192.168.188.128:4506')
[DEBUG ] Generated random reconnect delay between '1000ms' and '11000ms' (7456)
[DEBUG ] Setting zmq_reconnect_ivl to '7456ms'
[DEBUG ] Setting zmq_reconnect_ivl_max to '11000ms'
[DEBUG ] Re-using AsyncZeroMQReqChannel for (u'/etc/salt/pki/minion', u'192.168.188.129', u'tcp://192.168.188.128:4506', 'clear')
[DEBUG ] salt.crypt.get_rsa_pub_key: Loading public key
[DEBUG ] SaltReqTimeoutError, retrying. (1/7)
[DEBUG ] SaltReqTimeoutError, retrying. (2/7)
[DEBUG ] SaltReqTimeoutError, retrying. (3/7)
[DEBUG ] SaltReqTimeoutError, retrying. (4/7)
[DEBUG ] SaltReqTimeoutError, retrying. (5/7)
[DEBUG ] SaltReqTimeoutError, retrying. (6/7)
[DEBUG ] SaltReqTimeoutError, retrying. (7/7)
[DEBUG ] Re-init ZMQ socket: Message timed out
[DEBUG ] Trying to connect to: tcp://192.168.188.128:4506
[ERROR ] Error while bringing up minion for multi-master. Is master at 192.168.188.128 responding?
...

在这里,本机上的master也是无法收到本机上的minion的key。找了好久,有的说是配置里的master与id没有配对,有的说是增大线程数,有的说是防火墙,有的说是删掉pki下的id,试了都没有用。最后,认真思考一下,其实是minion无法与master 通信,偶然对比了一下minion与master的版本:

master上:

[root@master doubles]# salt-master --versions-report
Salt Version:
Salt: 2018.3.3 Dependency Versions:
cffi: 1.6.0
cherrypy: Not Installed
dateutil: Not Installed
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
Jinja2: 2.7.2
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: 0.21.1
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.5.6
mysql-python: Not Installed
pycparser: 2.14
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 2.7.5 (default, Oct 30 2018, 23:45:53)
python-gnupg: Not Installed
PyYAML: 3.10
PyZMQ: 14.3.1
RAET: Not Installed
smmap: Not Installed
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 3.2.2 System Versions:
dist: centos 7.6.1810 Core
locale: UTF-8
machine: x86_64
release: 3.10.0-957.1.3.el7.x86_64
system: Linux
version: CentOS Linux 7.6.1810 Core

minion上:

[root@slave doubles]# salt-minion --versions-report
Salt Version:
Salt: 2018.3.3 Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: Not Installed
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
Jinja2: 2.7.2
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.6
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 2.7.5 (default, Oct 30 2018, 23:45:53)
python-gnupg: Not Installed
PyYAML: 3.11
PyZMQ: 15.3.0
RAET: Not Installed
smmap: Not Installed
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.1.4 System Versions:
dist: centos 7.6.1810 Core
locale: UTF-8
machine: x86_64
release: 3.10.0-957.1.3.el7.x86_64
system: Linux
version: CentOS Linux 7.6.1810 Core

发现master与minion上的ZMQ版本不一样,这应该就是问题所在了。

解决:

尝试更新master上的zmq版本。

master上:

[root@master doubles]# yum install *zmq* –y
# 再对比版本
[root@master doubles]# salt-master --versions-report
Salt Version:
Salt: 2018.3.3 Dependency Versions:
cffi: 1.6.0
cherrypy: Not Installed
dateutil: Not Installed
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
Jinja2: 2.7.2
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: 0.21.1
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.5.6
mysql-python: Not Installed
pycparser: 2.14
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 2.7.5 (default, Oct 30 2018, 23:45:53)
python-gnupg: Not Installed
PyYAML: 3.10
PyZMQ: 15.3.0
RAET: Not Installed
smmap: Not Installed
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.1.4 System Versions:
dist: centos 7.6.1810 Core
locale: UTF-8
machine: x86_64
release: 3.10.0-957.1.3.el7.x86_64
system: Linux
version: CentOS Linux 7.6.1810 Core

此时发现zmq版本已经和minion一致了。重启master再试一下:

master:

[root@master doubles]# systemctl restart salt-master
[root@master doubles]# systemctl status salt-master
● salt-master.service - The Salt Master Server
Loaded: loaded (/usr/lib/systemd/system/salt-master.service; disabled; vendor preset: disabled)
Active: active (running) since Tue 2019-01-08 11:01:43 HKT; 17s ago
Docs: man:salt-master(1)
file:///usr/share/doc/salt/html/contents.html
https://docs.saltstack.com/en/latest/contents.html
Main PID: 15436 (salt-master)
CGroup: /system.slice/salt-master.service
├─15436 /usr/bin/python /usr/bin/salt-master
├─15445 /usr/bin/python /usr/bin/salt-master
├─15450 /usr/bin/python /usr/bin/salt-master
├─15453 /usr/bin/python /usr/bin/salt-master
├─15454 /usr/bin/python /usr/bin/salt-master
├─15455 /usr/bin/python /usr/bin/salt-master
├─15456 /usr/bin/python /usr/bin/salt-master
├─15457 /usr/bin/python /usr/bin/salt-master
├─15458 /usr/bin/python /usr/bin/salt-master
├─15459 /usr/bin/python /usr/bin/salt-master
├─15460 /usr/bin/python /usr/bin/salt-master
├─15461 /usr/bin/python /usr/bin/salt-master
└─15462 /usr/bin/python /usr/bin/salt-master Jan 08 11:01:42 master.doubles.cn systemd[1]: Stopped The Salt Master Server.
Jan 08 11:01:42 master.doubles.cn systemd[1]: Starting The Salt Master Server...
Jan 08 11:01:43 master.doubles.cn systemd[1]: Started The Salt Master Server.

minion上,重启:

[root@slave doubles]# salt-minion -l debug
...
[DEBUG ] Trying to connect to: tcp://192.168.188.128:4506
[DEBUG ] Initializing new AsyncZeroMQReqChannel for (u'/etc/salt/pki/minion', u'192.168.188.129', u'tcp://192.168.188.128:4506', u'aes')
[DEBUG ] Initializing new AsyncAuth for (u'/etc/salt/pki/minion', u'192.168.188.129', u'tcp://192.168.188.128:4506')
[DEBUG ] Connecting the Minion to the Master URI (for the return server): tcp://192.168.188.128:4506
[DEBUG ] Trying to connect to: tcp://192.168.188.128:4506
[INFO ] Minion is ready to receive requests!
[DEBUG ] Minion of '192.168.188.128' is handling event tag '/salt/minion/minion_schedule_delete_complete'
[DEBUG ] Minion of '192.168.188.128' is handling event tag '/salt/minion/minion_schedule_add_complete'
[DEBUG ] Minion of '192.168.188.128' is handling event tag '/salt/minion/minion_schedule_delete_complete'
[DEBUG ] Minion of '192.168.188.128' is handling event tag '/salt/minion/minion_schedule_delete_complete'
...
# 跟之前不一样了

看下master上能否收到key了。

master上:

[root@master doubles]# salt-key -L
Accepted Keys:
Denied Keys:
Unaccepted Keys:
192.168.188.129
Rejected Keys:
[root@master doubles]# salt-key -a 192.168.188.129
The following keys are going to be accepted:
Unaccepted Keys:
192.168.188.129
Proceed? [n/Y] y
Key for minion 192.168.188.129 accepted.
[root@master doubles]# salt-key -L
Accepted Keys:
192.168.188.129
Denied Keys:
Unaccepted Keys:
Rejected Keys:
[root@master doubles]# salt "*" test.ping
192.168.188.129:
True

发现已经OK了。

zmq导致master收不到minion的key的更多相关文章

  1. The Salt Master has rejected this minion's public key!

    salt查看日志: salt --log-level=all "10.199.165.244" state.highstate 进入调试模式: salt-minion -l deb ...

  2. 记录一个奇葩的问题:k8s集群中master节点上部署一个单节点的nacos,导致master节点状态不在线

    情况详细描述; k8s集群,一台master,两台worker 在master节点上部署一个单节点的nacos,导致master节点状态不在线(不论是否修改nacos的默认端口号都会导致master节 ...

  3. 自动化运维工具saltstack01 -- 之SaltStack介绍、安装与基础使用

    SaltStack介绍 官网地址:http://www.saltstack.com 官方文档地址:http://docs.saltstack.com Github:http://Github.com/ ...

  4. Linux记录-salt分析

    salt-master建立分组 如dn: 'L@dnxxx,dyyy' salt -N dn  state.apply  hadoop test=true salt -N dn  cmd.run  ' ...

  5. 学习saltstack (一)

    salt介绍 Salt是一个基础平台管理工具 Salt是一个配置管理系统,能够维护预定义状态的远程节点 Salt是一个分布式远程执行系统,用来在远程节点上执行命令和查询数据 salt的核心功能 是命令 ...

  6. jquery插件 源码

    下面是对Jquery几个经常用到的地方进行的增强. 功能是参考百度七巧板JS框架来完成的. 一.页面属性 $.page.getHeight():获取页面高度 $.page.getWidth():获取页 ...

  7. SaltStack Syndic配置

    参考URL: http://www.ttlsa.com/saltstack/saltstack-syndic-example/ 虽然中心master看不到 minion的key 但是还是可以直接指导m ...

  8. Salt初识和安装

    Salt Salt是一个配置管理系统,能够根据定义的状态,配置远程节点,比如保证远程节点上指定的安装包安装,运行指定的服务.Salt也是一个分布式远程执行系统,用于在远程节点上执行命令和请求数据,不论 ...

  9. saltstack中如何实现多个master来管理minion

    背景: 公司有多个部门,有一些机器有本部门的业务,这些机器也有其他部门的业务,所以本部门需要一个master服务器来管理这批机器,其他部门也需要一个master服务器来管理这个机器,所以就需要多个ma ...

随机推荐

  1. GridControl 隐藏Drag a column header here to group by that column

    解决方案: 打开设计器,找到OptionsView,往下拉设置showGroupPanel为false 

  2. win 10 提升权限

    问题:每次打开Visual Studio 提示,需要重启以获取管理员权限 解决: 1.Win+R 2.输入:gpedit.msc 3.windows设置->安全设置->本地策略->安 ...

  3. hadoop再次集群搭建(5)-CDH Install

       登录 http://node1.com:7180/.用户名和密码都是admin.启动服务命令是 service  cloudera-scm-server start 最开始两个页面直接conti ...

  4. ActiveMQ (一) 介绍与安装

    ActiveMQ是消息中间件的一种 ActiveMQ 是Apache出品,最流行的,能力强劲的开源消息总线.ActiveMQ 是一个完全支持JMS1.1和J2EE 1.4规范的 JMS Provide ...

  5. [转]PHP部分常见算法

    1. 用户密码六位数,不能大于六位而不能小于六数,数字值正则为[0-9],请用PHP写出有几种可能性,并做暴力破解; function dePassword($pwd) { $tmp = array( ...

  6. Eclipse安装Web/JavaEE插件、Eclipse编写HTML代码

    1 Eclipse没有Web插件和JavaEE插件咋整 1.1 在Eclipse中菜单help选项中选择install new software选项 1.2 在work with 栏中输入 http: ...

  7. tr td th是什么的缩写

    tr是 table row 表格的行 td是table data th是table heading表格标题 ,一般表格第一行的数据都是table heading

  8. SQLite操作

    创建有主键的表: create table test (pkey varchar(16) primary key, value varchar(10)); 创建有复合(即key由多个字段联合组成)主键 ...

  9. Android之九宫格解锁的实现

        <ignore_js_op>                                                  下面是最重要的那个LocusPassWordView ...

  10. 类的继承与super()的意义以即如何写一个正确的异常类

    这些东西都是我看了许多名师课程和自己研究的成果,严禁转载,这里指出了如何正确的自己定义一个异常类并看一看sun写的java的源代码话题一:子类的构造器执行是否一定会伴随着父类的构造执行? 1.this ...