在调用MySQL第三方工具mysqlrplsync是报错
mysqlrplsync --master=checksum:checksum@master_ip:3306 --slave=checksum:checksum@slave_ip:3306 --checksum-timeout=10 --verbose Traceback (most recent call last): File "/usr/bin/mysqlrplsync", line 25, in <module> from mysql.utilities.common.tools import check_python_version ImportError: No module named mysql.utilities.common.tools
mysqlrplsync工具是通过rpm安装的,查看Python版本及验证模块是否存在
# python --version Python 2.7.9 # ll /usr/lib/python2.6/site-packages/mysql/utilities/common/tools.py -rw-r--r-- 1 root root 21465 Aug 5 2015 /usr/lib/python2.6/site-packages/mysql/utilities/common/tools.py # which python /usr/local/bin/python # /usr/local/bin/python --version Python 2.7.9
以上验证系统中有两个版本的MySQL并存,并且Python2.6版本中的库下已存在所报的不存在的模块
查看Python2.7的库文件,没有发现
]# ll /usr/local/lib/python2.7/site-packages/mysql ls: cannot access /usr/local/lib/python2.7/site-packages/mysql: No such file or directory
总结问题就是通过rpm安装的模块默认安装在了Python2.6版本的库下,通过pip才会安装在Python2.7下,目前Python2.7是默认的程序,所以才会报错
解决问题:
# cp -r /usr/lib/python2.6/site-packages/mysql /usr/local/lib/python2.7/