The Guru College

Setting up Carbon and Whisper

As a note: the author of Graphite decided to put everything into /opt/graphite, which is sensible and unlikely to get overwritten by anyone else. You must figure out your storage stack before you go much further. Whisper and carbon have pretty high I/O needs, mostly for IOPS, and the graphite webapp is read heavy. There are ways to speed things up and make them more efficient, but you really want a dedicated disk or LUN for /opt/graphite. This way, you don’t overwhelm the rest of your system when you bulk-load data into Graphite, or add 200 new hosts with service checks and suddenly need to create thousands small files as fast as you can while still doing your usual read/write workload.

Back to the install process.

The pre-requisite is pycairo. When you use the bdist_rpm magic from the last post on Nagios and Graphite to get a reliable RPM installer of the whisper and graphite packages, make sure to have them require python24 (or greater) and pycairo. Alternatively, you can do it as a one-off and hate yourself for it in a few months when you look at your notes which aren’t explicit enough, and you can’t remember what it was you needed to install. Your choice.

Once everything is installed, head into /opt/graphite/conf, and you will find a bunch of configuration files. Right now, we are worrying about carbon.conf, relay-rules.conf, and storage-schemas.conf. These files will determine how and where data is written, how long it’s retained for, and set you up for multi-server storage of data sets. Remember folks, scale is good for you, and it makes you sleep better at night.

We are going to run carbon-cache and carbon-relay. carbon-cache is responsible for writing the incoming data to the files on disk, and carbon-relay is what you use to relay data to multiple carbon-cache instances (on the same host or on other hosts). While you can have carbon-cache listen directly to incoming traffic, being able to multiplex the data to multiple servers requires carbon-relay, so we may as well just set that up now.

First, setup data retention policies in storage-schemas.conf:

[everything_1min_13months]

priority = 1

pattern = .*

retentions = 60:43200,900:105120

This tells carbon to create whisper files with 60 second precision for 30 days (43200 60-second intervals) and with 15 minute precision for three years (105120 900-second intervals).

Next, setup relay-rules.conf:

# You must have exactly one section with ‘default = true’

[default]

default = true

servers = 127.0.0.1

destinations = 127.0.0.1:2014

All the traffic is going to localhost. It’s trivial to add more servers and destinations to this file as you add more nodes. Keep it simple at first, as you learn and debug the system, but it will serve you well over the long haul.

The final file to edit is the carbon.conf file, and it’s a bit of a bear. The graphite webapp reads this file, as do the carbon daemons, and there’s just about a million options to choose from. The good news the the only changes you have to make are to reverse the ports for the carbon-cache and carbon-relay daemons, so the generic clients can have a stock configuration. Once the config files are set up, launch the carbon-cache and carbon-relay daemons by issuing

/opt/graphite/bin/carbon-cache.py start

/opt/graphite/bin/carbon-relay.py start

Log files are in /opt/graphite/storage/log, which should be enough to get started with debugging and testing the carbon client applications. There is an example client application in /opt/graphite/bin called carbon-client.py, which can be used to test the setup.

Comments | Home | Aperture, I Give Up