sudo yum -y install bitmap bitmap-fonts Django pycairo python-devel python-ldap python-memcached mod_wsgi mod_python python-sqlite2 glibc-devel gcc gcc-c++ git openssl-devel httpd memcached python-hashlib django-tagging python-simplejson pip
Twisted需要配合zope.interface 3.6以上版本使用
wget --no-check-certificate https://pypi.python.org/packages/source/z/zope.interface/zope.interface-4.1.1.tar.gz
tar xvf zope.interface-4.1.1.tar.gz -C ../src/
cd ../src/zope.interface-4.1.1/
sudo python setup.py install
wget --no-check-certificate https://pypi.python.org/packages/source/T/Twisted/Twisted-14.0.1.tar.bz2
tar xvf Twisted-14.0.1.tar.bz2 -C ../src/
cd ../src/Twisted-14.0.1/
sudo python setup.py install
mkdir /home/test/graphite
cd /home/test/graphite
sudo pip install https://github.com/graphite-project/ceres/tarball/master
sudo pip install carbon --install-option="--prefix=/home/test/graphite" --install-option="--install-lib=/home/test/graphite/lib"
sudo pip install whisper (后面千万不要添加参数,否则会导致whisper安装失败的)
sudo pip install graphite-web --install-option="--prefix=/home/test/graphite" --install-option="--install-lib=/home/test/graphite/webapp"
sudo pip install daemonize
vi /home/test/graphite/lib/carbon/util.py
改from twisted.scripts._twistd_unix import daemonize 变成 import daemonize
cd /home/test/graphite/conf
cp carbon.conf.example carbon.conf
cp storage-schemas.conf.example storage-schemas.conf
cp graphite.wsgi.example graphite.wsgi
cp /home/test/graphite/examples/example-graphite-vhost.conf /etc/httpd/conf.d/graphite-vhost.conf
vi /etc/httpd/conf.d/graphite-vhost.conf
WSGISocketPrefix /home/test/graphite/wsgi
同时修改所有opt为home/test,并修改User和Group都为test
chown -R test.test /var/run/httpd/
mkdir /home/test/graphite/wsgi
vi /home/test/graphite/conf/graphite.wsgi
修改为sys.path.append('/home/test/graphite/webapp')
vi /home/test/graphite/conf/storage-schemas.conf
配置数据存储的时间点及数据保存时长
cd /home/test/graphite/storage/
mkdir -pv /data/whisper_new/
ln -s /data/whisper_new/ whisper
sudo chown -R test.test /home/test/graphite
cd /home/test/graphite/webapp/graphite/
cp local_settings.py.example local_settings.py
vi local_settings.py
# 修改GRAPHITE_ROOT、WHISPER_DIR、DATABASES等参数
GRAPHITE_ROOT = '/home/test/graphite'
WHISPER_DIR = '/home/test/graphite/storage/whisper'
DATABASES = {
'default': {
'NAME': '/home/test/graphite/storage/graphite.db',
'ENGINE': 'django.db.backends.sqlite3',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': ''
}
}
python manage.py syncdb # 注:初始化数据库时设定用户test,邮箱[email protected],密码test12345,这也是web界面的登录账号和密码
sudo /etc/init.d/httpd restart
cd /home/test/graphite/
./bin/carbon-cache.py start
echo "local.random.diceroll 4 `date +%s`" | nc -q0 127.0.0.1 2003
cd /home/test/graphite/examples/
python example-client.py
vi /home/test/graphite/conf/carbon.conf
添加instance-b和instance-c
[cache:b]
LINE_RECEIVER_PORT = 2103
PICKLE_RECEIVER_PORT = 2104
CACHE_QUERY_PORT = 7102
[cache:c]
LINE_RECEIVER_PORT = 2203
PICKLE_RECEIVER_PORT = 2204
CACHE_QUERY_PORT = 7202
cd /home/test/graphite
bin/carbon-cache.py --instance=b start
bin/carbon-cache.py --instance=c start
vi /home/test/graphite/conf/carbon.conf # 修改relay配置
[relay]
LINE_RECEIVER_INTERFACE = 0.0.0.0
LINE_RECEIVER_PORT = 2013
PICKLE_RECEIVER_INTERFACE = 0.0.0.0
PICKLE_RECEIVER_PORT = 2014
DESTINATIONS = 127.0.0.1:2004:a, 127.0.0.1:2104:b, 127.0.0.1:2204:c
vi /home/test/graphite/conf/relay-rules.conf
[servers]
pattern = ^servers\.
destinations = 127.0.0.1:2004:a, 127.0.0.1:2104:b, 127.0.0.1:2204:c
[default]
default = true
destinations = 127.0.0.1:2004:a, 127.0.0.1:2104:b, 127.0.0.1:2204:c
cd /home/test/graphite
./bin/carbon-relay.py start
然后修改各diamond.conf的配置文件中连接carbon的端口号为carbon-relay的端口2013和2014
wget http://launchpad.net/graphite/0.9/0.9.9/+download/graphite-web-0.9.9.tar.gz
tar zxvf graphite-web-0.9.9.tar.gz -C ../src
cd /home/test/software/src/graphite-web-0.9.9/
python check-dependencies.py