@llplmlyd
2019-09-30T16:28:05.000000Z
字数 2758
阅读 931
Linux
python2.6 pip升级后pip失效报错
Traceback (most recent call last):
File "/usr/bin/pip", line 7, in <module>
from pip._internal import main
File "/usr/lib/python2.6/site-packages/pip/_internal/__init__.py", line 19, in <module>
from pip._vendor.urllib3.exceptions import DependencyWarning
File "/usr/lib/python2.6/site-packages/pip/_vendor/urllib3/__init__.py", line 8, in <module>
from .connectionpool import (
File "/usr/lib/python2.6/site-packages/pip/_vendor/urllib3/connectionpool.py", line 92
_blocking_errnos = {errno.EAGAIN, errno.EWOULDBLOCK}
^
SyntaxError: invalid syntax
解决办法
# 1, 从官方github获取具体版本的pip
# https://github.com/pypa/get-pip
wget https://raw.githubusercontent.com/pypa/get-pip/master/2.6/get-pip.py
# 2,运行刚才获取的pip文件
python2.6 get-pip.py
测试
pip -V
pip
CentOS6
python2.6.6 天兔监控不支持python3
# 安装pip
yum install python-pip
# * 安装MySQLdb依赖包 必须
yum -y install mysql-devel
yum install gcc libffi-devel python-devel openssl-devel
referring to http://www.dbarun.com/docs/lepus/install/scripts/
cd /usr/local
git clone https://github.com/ruzuojun/lepus.git
对可执行文件授予执行权限,并创建软连接
cd lepus
chmod +x lepus*
ln -s /usr/local/lepus/lepus /usr/local/sbin/lepus
ln -s /usr/local/lepus/lepus_monitor /usr/local/sbin/lepus_mointor
# 安装 MySQLdb,MySQLdb for python,在pip list里卖弄的名字实际是 MySQL-python
pip install MySQL-python
cd /usr/local/lepus
python test_driver_mysql.py
# 返回MySQL python drivier is ok! 表示 MySQLdb安装成功
在监控机创建监控数据库,并授权
cd /usr/local/lepus
mysql
mysql> create database lepus default character set utf8;
mysql> grant select,insert,update,delete,create on lepus.* to 'lepus'@'localhost' identified by 'lepus';
mysql> flush privileges;
mysql> use lepus;
mysql> source sql/lepus_table.sql
mysql> source sql/lepus_data.sql
mysql> exit
vim etc/config.ini
修改监控机数据库连接地址
[monitor_server]
host="127.0.0.1"
port=3306
user=" lepus "
passwd="lepus"
dbname="lepus"
启动lepus
lepus start
配置web天兔监控nginx
cd /usr/local/lepus
cp -rf web/* /usr/local/nginx/html/
cd ../nginx
vim html/application/config/database.php
database.php:
$db['default']['hostname'] = '127.0.0.1';
$db['default']['username'] = 'lepus';
$db['default']['password'] = 'lepus';
$db['default']['database'] = lepus;
# php中安装的数据库驱动/连接器是mysqli,注意这里的dbdriver设置
$db['default']['dbdriver'] = 'mysqli';
修改其中一个nginx的include配置文件 conf.d/mysql.conf
server {
listen 10.32.82.21:81;
#server_name www.mysql.com;
root html;
location / {
# nginx重定向
if (!-e $request_filename)
{
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
# fastcgi.conf 位于/usr/local/nginx/fastcgi.conf
index index.php index.htm index.html;
include fastcgi.conf;
}
# css文件启用
location ~ \.css {
add_header Content-Type text/css;
}
# js文件启用
location ~ \.js {
add_header Content-Type application/x-javascript;
}
}
http://10.32.82.21:81
# 默认管理员账号密码admin/Lepusadmin
配置监控
在被监控的数据库端执行授权
mysql> grant select,process,super on *.* to 'lepus_monitor'@'ip' identified by 'password';
mysql> flush privilegesi
# 授权完成之后在web端进行监控数据库添加方可响应