Graphite是一个Django的项目,所以必须有基础的Python环境,并推荐使用pip作为Python模块的管理工具,我这里安装的Python版本是Python2.7.6。
按照Graphite官网(http://graphite.wikidot.com/installation)安装graphite依赖,特别强调Django的安装版本是Django1.5.x(1.6以上版本会有一些模块变更,导致不兼容)
yum install -y pycairo,mod_python,python-ldap,python-memcached,python-sqlite2,bitmap,bitmap-fonts,python-devel,mod_wsgi pip install Django==1.5.1 pip install django-tagging pip install twisted
tar -zxvf whisper-0.9.12.tar.gz cd whisper-0.9.12 python setup.py install
[root@VMS04798 graphite]# ls -l /usr/bin/whisper* -rwxr-xr-x 1 root root 1658 Apr 13 14:48 /usr/bin/whisper-create.py -rwxr-xr-x 1 root root 2902 Apr 13 14:48 /usr/bin/whisper-dump.py -rwxr-xr-x 1 root root 1780 Apr 13 14:48 /usr/bin/whisper-fetch.py -rwxr-xr-x 1 root root 1071 Apr 13 14:48 /usr/bin/whisper-info.py -rwxr-xr-x 1 root root 675 Apr 13 14:48 /usr/bin/whisper-merge.py -rwxr-xr-x 1 root root 5984 Apr 13 14:48 /usr/bin/whisper-resize.py -rwxr-xr-x 1 root root 919 Apr 13 14:48 /usr/bin/whisper-set-aggregation-method.py -rwxr-xr-x 1 root root 970 Apr 13 14:48 /usr/bin/whisper-update.py
tar -zxvf carbon-0.9.12.tar.gz cd carbon-0.9.12 python setup.py install
[root@VMS04798 graphite]# ls -l /opt/graphite total 48 drwxr-xr-x 2 apache apache 4096 Apr 13 14:48 bin drwxrwxrwx 2 apache apache 4096 Apr 15 18:34 conf drwxr-xr-x 2 apache apache 4096 Apr 13 15:40 examples drwxr-xr-x 4 apache apache 4096 Apr 13 14:47 lib drwxr-xr-x 6 apache apache 4096 Apr 15 16:19 storage
tar -zxvf graphite-web-0.9.12.tar.gz cd graphite-web-0.9.12 python check-dependencies.py python setup.py install
cp graphite.wsgi.example graphite.wsgi cd /opt/graphite/webapp/graphite cp local_settings.py.example local_settings.py
Carbon安装自带了默认的端口和很多其他的配置文件,拷贝已经存在的示例文件。
cd /opt/graphite/conf cp carbon.conf.example carbon.conf cp storage-schemas.conf.example storage-schemas.conf cp storage-aggregation.conf.example storage-aggregation.conf
$ vim /opt/graphite/conf/carbon.conf [cache] LINE_RECEIVER_INTERFACE = 0.0.0.0 LINE_RECEIVER_PORT = 2003 PICKLE_RECEIVER_INTERFACE = 0.0.0.0 PICKLE_RECEIVER_PORT = 2004 CACHE_QUERY_INTERFACE = 0.0.0.0 CACHE_QUERY_PORT = 7002
vim storage-schemas.conf [system_1min] pattern = ^system\..* priority = 100 retentions = 60s:31d,5m:90d
vim storage-aggregation.conf [system_1min] pattern = ^system\..* xFilesFactor = 0.5 aggregationMethod = sum
cd /opt/graphite/bin ./carbon-cache.py start cd /opt/graphite/examples python example-client.py
[root@VMS04798 examples]# whisper-info.py /opt/graphite/storage/whisper/system/loadavg_1min.wsp maxRetention: 604800 xFilesFactor: 0.5 aggregationMethod: sum fileSize: 120988 Archive 0 retention: 604800 secondsPerPoint: 60 points: 10080 size: 120960 offset: 28
[root@VMS04798 examples]#whisper-dump.py /opt/graphite/storage/whisper/system/loadavg_1min.wsp Meta data: aggregation method: sum max retention: 86400 xFilesFactor: 0.5 Archive 0 info: offset: 28 seconds per point: 60 points: 1440 retention: 86400 size: 17280 Archive 0 data: 0: 1400609220, 1 1: 0, 0 2: 0, 0 3: 0, 0 4: 0, 0 5: 0, 0 ... 1437: 0, 0 1438: 0, 0 1439: 0, 0
graphite-web是基于django开发的
tar -zxvf nginx-1.2.8.tar.gz cd nginx-1.2.8 ./configure --prefix=/usr/local/nginx make make install
pip install uwsgi
/opt/graphite/webapp vim graphite.ini
[uwsgi] post-buffering = 32768 buffer-size = 32768 chdir=/opt/graphite/conf/ module=graphite.wsgi master=true pidfile=/tmp/graphite.pid vacuum=true max-requests=10000 daemonize=/var/log/graphite/access_graphite.log processes=15 socket=127.0.0.1:49156 stats=127.0.0.1:1716 listen=1024
cd /usr/local/nginx/conf/sites-enabled vim graphite.conf
server { listen 8080; server_name 127.0.0.1 charset utf-8; access_log /var/log/nginx/graphite.access.log; error_log /var/log/nginx/graphite.error.log; location / { include uwsgi_params; uwsgi_pass 127.0.0.1:49156; } }
/opt/graphite/bin/carbon-cache.py start /opt/graphite/webapp uwsgi graphite.ini /usr/local/nginx/sbin/nginx