一、升级python2.7:
0、准备:
1)需要先安装openssl:(解决Python ImportError: cannot import name HTTPSHandler)
yum install openssl openssl-devel -y
2)安装sqlite-devel:
解决在安装graphite-web时报错:Error loading either pysqlite2 or sqlite3 modules
需要安装sqlite-devel之后,重新编译安装Python即可。
yum install sqlite-devel
重新编译安装Python:
./configure
make
make install
3)安装zlib:
yum install zlib zlib-devel openssl openssl-devel readline readline-devel -y
1、安装python2.7.3
1)下载、编译
wget http://python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2
tar -jxvf Python-2.7.3.tar.bz2
cd Python-2.7.3
./configure
make
make install
#make clean
#make distclean
2)建立软连接,使系统默认的 python指向 python2.7
mv /usr/bin/python /usr/bin/python2.6.6
ln -s /usr/local/bin/python2.7 /usr/bin/python
3)修改yum
vi /usr/bin/yum
#!/usr/bin/python
改成
#!/usr/bin/python2.6.6
2、安装2.7.3的easy_install、pip
1)easy_install:
wget https://pypi.python.org/packages/source/s/setuptools/setuptools-7.0.zip --no-check-certificate
unzip setuptools-7.0.zip
cd setuptools-7.0
python setup.py install
2)pip:
wget --no-check-certificate https://github.com/pypa/pip/archive/1.5.5.tar.gz
tar zvxf 1.5.5 #解压文件
cd pip-1.5.5/
python setup.py install
检验:(需要重新登录)
# pip -V
pip 1.5.5 from /usr/local/lib/python2.7/site-packages/pip-1.5.5-py2.7.egg (python 2.7)
# easy_install --version
setuptools 7.0
3、坑
1)安装2.7.3对应的django
django-admin.py syncdb --settings=graphite.settings
pip install Django==1.8
2)pip install django-tagging
3)ImportError: No module named cairocffi
pip install cairocffi
4)CompressionError: bz2 module is not available
wget https://pypi.python.org/packages/source/T/Twisted/Twisted-14.0.0.tar.bz2#md5=9625c094e0a18da77faa4627b98c9815 --no-check-certificate
tar -jxf Twisted-14.0.0.tar.bz2
cd Twisted-14.0.0;
python setup.py install
http://www.ithao123.cn/content-1273730.html
5)error: command 'gcc' failed with exit status 1
yum install libffi-devel
yum -y install gcc*
二、安装、配置graphite:
1、安装:
1)pip安装:(默认安装到了/opt下面)
pip install https://github.com/graphite-project/ceres/tarball/master
pip install whisper
pip install carbon
#可能会报错CompressionError: bz2 module is not available
pip install graphite-web
2)修改配置文件:
cd /opt/graphite/conf
# cp aggregation-rules.conf.example aggregation-rules.conf
# cp blacklist.conf.example blacklist.conf
# cp carbon.conf.example carbon.conf
# cp carbon.amqp.conf.example carbon.amqp.conf
# cp relay-rules.conf.example relay-rules.conf
# cp rewrite-rules.conf.example rewrite-rules.conf
# cp storage-schemas.conf.example storage-schemas.conf
# cp storage-aggregation.conf.example storage-aggregation.conf
# cp whitelist.conf.example whitelist.conf
3)启动carbon-cache:
#cd /opt/graphite/bin
#./carbon-cache.py start
#netstat -nap | grep 2003
4)安装graphite-web:
cd /opt/graphite/webapp/graphite
cp local_settings.py.example local_settings.py
cd /opt/graphite/webapp/graphite/
python manage.py syncdb
#可能会报错:Django==1.8
pip install Django==1.8
#可能会报错: Error loading either pysqlite2 or sqlite3 modules
yum install sqlite-devel
# 可能会报错:No module named tagging
pip install django-tagging
5)启动:
cd /opt/graphite
# PYTHONPATH=`pwd`/storage/whisper ./bin/run-graphite-devel-server.py --port=8085 --libs=`pwd`/webapp /opt/graphite 1>/opt/graphite/storage/log/webapp/process.log 2>&1 &
# tail -f /opt/graphite/storage/log/webapp/process.log
可能会没有图片,报错:ImportError: No module named cairocffi
pip install cairocffi
#安装cairocffi时可能报错:error: command 'gcc' failed with exit status 1
yum install libffi-devel