ubuntu14.04.5 安装python+django开发环境安装 salt-minion 第三方模块版本升级(备忘)

系统版本 ubuntu14.04.5   python版本Python 2.7.6 

1.安装pip。

apt-get install python-pip

2.安装django==1.8。

pip install   django==1.8

3.安装django-suit==0.2.21

pip install  django-suit==0.2.21

4.安装celery==3.1.23 (定时任务需要)

pip install  celery==3.1.23

5.安装django-celery==3.1.17(定时任务需要)

pip install django-celery==3.1.17

扫描二维码关注公众号,回复: 1018160 查看本文章

6.安装mysql-python

aptitude install  python-dev

aptitude install  python-mysql

下载MySQL-python-1.2.3  解压python setup.py build  python setup.py install  

python >>> import MySQLdb    导入成功即为OK。

7.安装pycrypto

aptitude install  pycrypto

8.同步Django项目中的计划任务。

python manage.py makemigrations


ubuntu 安装salt-minion 第三方模块版本升级

问题背景:salt-master版本升级后,执行salt出错如下:

在salt master端执行salt ‘*’ test.ping时,某一节点出现如下报错:

    Minion did not return. [Not connected]

现象1:

登陆到这一节点查看minion的日志,发现如下的问题

tail -f /var/log/salt/minion
The master may need to be updated if it is a version of Salt lower than 2015.5.3, or
If you are confident that you are connecting to a valid Salt Master, then remove the master public key and restart the Salt Minion.
The master public key can be found at:
/etc/salt/pki/minion/minion_master.pub
2015-11-23 23:30:02,645 [salt.crypt                               ][ERROR   ][3530] The Salt Master has cached the public key for this node, this salt minion will wait for 10 seconds before attempting to re-authenticate
2015-11-23 23:30:05,108 [salt.crypt                               ][ERROR   ][3586] The Salt Master has cached the public key for this node, this salt minion will wait for 10 seconds before attempting to re-authenticate
2015-11-23 23:30:15,136 [salt.crypt                               ][ERROR   ][3586] The Salt Master has cached the public key for this node, this salt minion will wait for 10 seconds before attempting to re-authenticate

大概的意思就是,minion端拿到的key与master端的不符,验证无法通过。
解决方法是删除minion端的key,再重新与master进行连接和认证。

minion

$ cat /etc/salt/pki/minion/minion_master.pub
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtzq0AjuyQsVEgsx692GN
... ...
7fbuudp4yu5vcYcqksKIFcm0J3E+OR+rx/NUIHt0ZL8HLxcSn4Si/S6dVp/vE7Oc
swIDAQAB
-----END PUBLIC KEY-----
[root@localhost salt]# rm -fr /etc/salt/pki/minion/minion_master.pub

[root@localhost salt]# service salt-minion restart
Stopping salt-minion daemon:                               [  OK  ]
Starting salt-minion daemon:                               [  OK  ]


master
salt-key -A


minion

$ cat pki/minion/minion_master.pub 
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy46TJvK9BUqjvaYzmt5Q
... ...
ADw0hU6B/A1kRBeUbb6Fy+HljiSjD3O+mhoK7RE8rCnvJCHfuZSX/qMtLEyoh0vN
tQIDAQAB
-----END PUBLIC KEY-----


至此,master与minion端的通信正常


现象2:

tail -f /var/log/salt/minion

无法与saltmaster通信,原因系:minin的zmq版本太低

master


minion



关键问题是如何升级ubuntu系统下的salt的第三方模块zmq的版本呢?????

解决思路,由于zmq是salt的第三方模块,而salt本身也是基于python的 ,所以,只要通过python升级该python的模块就能解决salt的依赖模块。


通过如下命令查看相关python模块存在的具体位置。

python -c "import zmq;print zmq.zmq_version(),zmq.__path__"

然后找其他升级后的minion的对应路径下把zmq打包替换当前低版本的zmq就可以。


还可以通过尝试更新zmq的方法。

确保pip正确安装,如果更新时发现zmq版本一直不是最新版本,重新安装python-pip然后再升级。

pip install zmq --upgrade  这样会升级zmq的同时升级pyzmq


pip安装时可以查询到的最新版本是3.3.0,当前就是这个版本。所以,还得重装python-pip。

重新安装python-pip

apt-get  purge python-pip

apt-get  install  python-pip

更新salt的源。

vim  /etc/apt/sources.list.d/saltstack.list

deb https://repo.saltstack.com/apt/ubuntu/12.04/amd64/latest precise main、

apt-get update

修改/etc/resolv.conf  nameserver 223.5.5.5

打开网站http://zeromq.org/intro:get-the-software  下载zeromq-4.1.5.tar.gz或者zeromq-4.1.6.tar.gz然后解压编译安装。下载链接:wget   https://github.com/zeromq/zeromq4-1/releases/download/v4.1.6/zeromq-4.1.6.tar.gz

再运行pip install zmq  --upgrade


重启salt-minion

/usr/bin/python /usr/local/bin/salt-minion -d

然后再master上运行就OK啦。

问题 解决。

 备注:经过多次尝试发现,pip install zmq --upgrade  过程如下:






猜你喜欢

转载自blog.csdn.net/jinyuxiaoqiang/article/details/68066706