总结:python2.7下的salt,要把 mysql-python也安装,并不是python3环境,看清,看清
Returners组件,master自动把值写入mysql数据库中,出现的问题
1、本地环境
1、版本信息
[root@localhost ~]# salt-call --versions-report Salt Version: Salt: 2018.3.4 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.5.6 mysql-python: 1.2.5 pycparser: Not Installed pycrypto: 2.6.1 pycryptodome: Not Installed pygit2: Not Installed Python: 2.7.5 (default, Aug 7 2019, 00:51:29) 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.3.1611 Core locale: UTF-8 machine: x86_64 release: 3.10.0-514.el7.x86_64 system: Linux version: CentOS Linux 7.3.1611 Core
2、问题
minion报错
2019-11-29 00:49:19,893 [salt.minion :1758][ERROR ][52886] Returner mysql.returner could not be loaded: 'mysql' __virtual__ returned False: Could not import mysql returner; mysql python client is not installed.
master报错
2019-11-28 23:39:52,761 [salt.transport.zeromq:699 ][ERROR ][45236] Some exception handling a payload f rom minion Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/salt/transport/zeromq.py", line 695, in handle_message ret, req_opts = yield self.payload_handler(payload) File "/usr/lib64/python2.7/site-packages/tornado/gen.py", line 882, in run value = future.result() File "/usr/lib64/python2.7/site-packages/tornado/concurrent.py", line 214, in result raise_exc_info(self._exc_info) File "/usr/lib64/python2.7/site-packages/tornado/gen.py", line 217, in wrapper result = func(*args, **kwargs) File "/usr/lib/python2.7/site-packages/salt/master.py", line 1027, in _handle_payload 'clear': self._handle_clear}[key](load) File "/usr/lib/python2.7/site-packages/salt/master.py", line 1058, in _handle_clear ret = getattr(self.clear_funcs, cmd)(load), {'fun': 'send_clear'} File "/usr/lib/python2.7/site-packages/salt/master.py", line 2092, in publish payload = self._prep_pub(minions, jid, clear_load, extra, missing) File "/usr/lib/python2.7/site-packages/salt/master.py", line 2184, in _prep_pub self.event.fire_event({'minions': minions}, clear_load['jid']) File "/usr/lib/python2.7/site-packages/salt/utils/event.py", line 746, in fire_event salt.utils.stringutils.to_bytes(tag), ...skipping... File "/usr/lib/python2.7/site-packages/salt/master.py", line 1027, in _handle_payload 'clear': self._handle_clear}[key](load) File "/usr/lib/python2.7/site-packages/salt/master.py", line 1058, in _handle_clear ret = getattr(self.clear_funcs, cmd)(load), {'fun': 'send_clear'} File "/usr/lib/python2.7/site-packages/salt/master.py", line 2092, in publish payload = self._prep_pub(minions, jid, clear_load, extra, missing) File "/usr/lib/python2.7/site-packages/salt/master.py", line 2184, in _prep_pub self.event.fire_event({'minions': minions}, clear_load['jid']) File "/usr/lib/python2.7/site-packages/salt/utils/event.py", line 746, in fire_event salt.utils.stringutils.to_bytes(tag), File "/usr/lib/python2.7/site-packages/salt/utils/stringutils.py", line 63, in to_bytes return to_str(s, encoding, errors) File "/usr/lib/python2.7/site-packages/salt/utils/stringutils.py", line 118, in to_str raise TypeError('expected str, bytearray, or unicode') TypeError: expected str, bytearray, or unicode 2019-11-28 23:41:25,750 [tornado.general :452 ][ERROR ][46443] Uncaught exception, closing connection. Traceback (most recent call last): File "/usr/lib64/python2.7/site-packages/zmq/eventloop/zmqstream.py", line 444, in _handle_events self._handle_send() File "/usr/lib64/python2.7/site-packages/zmq/eventloop/zmqstream.py", line 487, in _handle_send status = self.socket.send_multipart(msg, **kwargs) File "/usr/lib64/python2.7/site-packages/zmq/sugar/socket.py", line 363, in send_multipart i, rmsg, TypeError: Frame 0 (u'Some exception handling minion...) does not support the buffer interface. 2019-11-28 23:41:25,750 [tornado.application:611 ][ERROR ][46443] Exception in callback None Traceback (most recent call last): File "/usr/lib64/python2.7/site-packages/tornado/ioloop.py", line 865, in start handler_func(fd_obj, events) File "/usr/lib64/python2.7/site-packages/tornado/stack_context.py", line 274, in null_wrapper return fn(*args, **kwargs) File "/usr/lib64/python2.7/site-packages/zmq/eventloop/zmqstream.py", line 444, in _handle_events self._handle_send() File "/usr/lib64/python2.7/site-packages/zmq/eventloop/zmqstream.py", line 487, in _handle_send status = self.socket.send_multipart(msg, **kwargs) File "/usr/lib64/python2.7/site-packages/zmq/sugar/socket.py", line 363, in send_multipart i, rmsg, TypeError: Frame 0 (u'Some exception handling minion...) does not support the buffer interface.
提示我未安装pymsql,但是我记得我安装l
3、原因:
用到的命令
# 查找文件 比如我要查看elasticsearch安装在哪了: # sudo find / -name elasticsearch -type d
难道是我的pymsql装错地方了
python第三方包位置
pymysql位置
位置不一样,会影响吗? (很重要,欲哭无泪)
salt位置。怎么是2.7的,难道说。。。
查看return.py源码位置
就是这样的
4、解决掉它
现在本地python2.7装mysqlpy测试
[root@localhost ~]# pip2 install mysql-python
重新来一次配置master ok
哈哈哈哈哈