Tuesday, August 20, 2013

Multi-nodes graphite cluster

I done  set up a graphite cluster on 2 nodes:
- Each node have 1 webapp, 1 carbon-relay that relay to n carbon-cache.
- Each node talk to each other ONLY through webapp. You have to config in local_config at cluster section.
- Note that double check your graphite django url file. Do not require login to get metric, or you will get 302 error when webapp talk to each others.

On each node:
- Set up each carbon-cache listen on a separate port.
- All webapp must use exactly same database and memcached (if you use memcached)
- Then, in relay config, set DESTIONATIONS to a list of all local carbon-cache. Look like this:



[relay]
LINE_RECEIVER_INTERFACE = 0.0.0.0
LINE_RECEIVER_PORT = 2003
PICKLE_RECEIVER_INTERFACE = 0.0.0.0
PICKLE_RECEIVER_PORT = 2004
RELAY_METHOD = consistent-hashing
REPLICATION_FACTOR = 1

DESTINATIONS =127.0.0.1:2014:a, 127.0.0.1:2024:b, 127.0.0.1:2034:c, 127.0.0.1:2044:d

- Webapp need to config talk to all of local carbon-cache as relay do:
CARBONLINK_HOSTS = ["127.0.0.1:7012:a", "127.0.0.1:7022:b", "127.0.0.1:7032:c", "127.0.0.1:7042:d"]

#list all server in cluster (each server had 1 webapp)
CLUSTER_SERVERS = ['192.168.122.12', '192.168.122.93']
# and add same value to ALLOWED_HOSTS
ALLOWED_HOSTS = ['192.168.122.12', '192.168.122.93']

No comments: