Skip to content

Instantly share code, notes, and snippets.

@joemiller
Created February 21, 2012 18:44
Show Gist options
  • Save joemiller/1878067 to your computer and use it in GitHub Desktop.
Save joemiller/1878067 to your computer and use it in GitHub Desktop.
graphite install on cent5 (with amqp support)
{panel}{toc}{panel}
----
h2. Purpose
The purpose of this document is to document the procedure for installing Graphite and its components on a graphite server.
Reference: [http://graphite.readthedocs.org/en/latest/install.html]
History: 
* This doc updated on 12/17/2011 for graphite 0.9.9 and python26 (via EPEL). Python26 makes the installation a bit harder, but it is needed for AMQP support.
h2. Install
h3. Install python2.6
Python 2.6 is only needed if you want AMQP support. We do, so install it from EPEL.
{code}yum install python26 python26-devel python26-distribute{code}
h3. Download
{code}
wget http://launchpad.net/graphite/0.9/0.9.9/+download/whisper-0.9.9.tar.gz
wget http://launchpad.net/graphite/0.9/0.9.9/+download/carbon-0.9.9.tar.gz
wget http://launchpad.net/graphite/0.9/0.9.9/+download/graphite-web-0.9.9.tar.gz
wget http://pypi.python.org/packages/source/T/Twisted/Twisted-10.2.0.tar.bz2
{code}
h3. Install Twisted
{code}
tar xfvj Twisted-10.2.0.tar.bz2
cd Twisted-10.2.0
sudo python26 setup.py install
{code}
h3. Install Whisper
Whisper should be installed first.
{code}
tar xfvz whisper-0.9.9.tar.gz
cd whisper-0.9.9
sudo python26 setup.py install
{code}
h3. Install carbon
Carbon will be installed to /opt/graphite
{code}
tar xfvz carbon-0.9.8.tar.gz
cd carbon-0.9.8
sudo python26 setup.py install
{code}
h4. create /etc/init.d/graphite-carbon startup script:
* Download and Install [^graphite-carbon.init.sh] to /etc/init.d/graphite-carbon
* Register the init script
{code}
sudo chmod +x /etc/init.d/graphite-carbon
sudo /sbin/chkconfig graphite-carbon on
{code}
h4. Chown  /opt/graphite/storage  to apache user
Since we are running carbon as user 'apache', we need to give that user readwrite access to the graphite storage directory. We're using the apache user because the graphite-web app also needs access to this directory.
{code}sudo chown -R apache:apache /opt/graphite/storage {code}
h3. Install graphite-web
graphite-web will be installed to /opt/graphite/webapp
{code}
tar xfvz graphite-web-0.9.8.tgz
cd graphite-web-0.9.8/
python26 ./check-dependencies.py
# should be able to use the following RPMs:
sudo yum install bitmap-fonts python26-devel python26-ldap python26-memcached python26-mod_wsgi python26-simplejson
# and these installed via setuptools/easy_install:
sudo easy_install-2.6 django
sudo easy_install-2.6 django-tagging
sudo easy_install-2.6 txamqp
sudo easy_install-2.6 zope.interface
# need to install an old version of cairo + pycairo manually
sudo yum install cairo cairo-devel
wget http://cairographics.org/releases/pycairo-1.2.0.tar.gz
tar xfvz py2cairo-1.2.0.tar.gz
cd pycairo-1.2.0
./configure
make
make install
python26 setup.py install
# once all dependencies are met... (note: you only really need to resolve the FATAL deps, unless you want to use an optional module like AMQP)
sudo python setup.py install
{code}
h3. Generate Twisted cache files (as root)
Do this step before starting /etc/init.d/graphite-carbon. If you forget, carbon will start but it will spit out a bunch of
warnings about permission denied while updating cache files.
{code}
python26
from twisted.plugin import IPlugin, getPlugins
list(getPlugins(IPlugin))
{code}
h2. Configure
h3. Prepare rabbitMQ
Create a vhost and user for graphite on the rabbitmq server:
{code}
rabbitmqctl add_vhost /graphite
rabbitmqctl add_user graphite l0gm3trics11
rabbitmqctl set_permissions -p /graphite graphite '.*' '.*' '.*'
{code}
The settings for graphite to connect to this rabbit server are in carbon.conf, see below.
h3. Configure Carbon
Reference: [http://graphite.readthedocs.org/en/latest/config-carbon.html]
* Create /opt/graphite/conf/carbon.conf (use the .example file to get started)
** [^carbon.conf]
* Create /opt/graphite/conf/storage-schemas.conf (use the .example file to get started)
** [^storage-schemas.conf]
h3. Configure Graphite-web
* Create /opt/graphite/conf/dashboard.conf (use the .example file to get started)
** [^dashboard.conf]
* Create /opt/graphite/webapp/graphite/local_settings.py (use the .example file to get started)
** [^local_settings.py]
* Create /opt/graphite/conf/graphite.wsgi
{code}sudo cp /opt/graphite/conf/graphite.wsgi.example /opt/graphite/conf/graphite.wsgi{code}
* Create self-signed SSL certs for graphite:
{code}openssl req -newkey rsa:2048 -keyout /etc/pki/tls/private/graphite.key -nodes -x509 -days 40000 -out /etc/pki/tls/certs/graphite.cert{code}
* install mod_ssl
{code}yum -y install mod_ssl{code}
* Create /etc/httpd/conf.d/graphite.conf
**  [^graphite.conf]
* Run syncdb to setup the db and prime the authentication
{code}sudo -u apache python /opt/graphite/webapp/graphite/manage.py syncdb{code}
You will be prompted to create an initial user for the graphite-web app. Set one up and remember the user/email/password\!
h2. Run
Start up carbon-cache and apache (graphite-web):
{code}
/etc/init.d/graphite-carbon start
/etc/init.d/httpd start # or restart
{code}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment