Skip to content

Instantly share code, notes, and snippets.

@obfuscurity
Last active May 29, 2019 21:29
Show Gist options
  • Save obfuscurity/63399584ea4d95f921e4 to your computer and use it in GitHub Desktop.
Save obfuscurity/63399584ea4d95f921e4 to your computer and use it in GitHub Desktop.
haproxy and carbon configs at Dyn

Diagram of this architecture: http://cl.ly/image/2T1c050U3P1J

## haproxy.cfg

global
        user haproxy
        group haproxy
        daemon
        maxconn 16384
        pidfile /var/run/haproxy.pid

defaults
        balance roundrobin
        mode tcp
        retries 3
        option redispatch
        contimeout 300000
        clitimeout 1800000
        srvtimeout 1800000

# distribute across our replication carbon-relays
listen carbon_relay_2003 0.0.0.0:2003
        #balance leastconn
        mode tcp
        maxconn 1024
        server carbon_relay_2213 127.0.0.1:2213 check maxconn 1024
        server carbon_relay_2313 127.0.0.1:2313 check maxconn 1024

# distribute across our replication carbon-relays
listen carbon_relay_2004 0.0.0.0:2004
        #balance leastconn
        mode tcp
        maxconn 1024
        server carbon_relay_2214 127.0.0.1:2214 check maxconn 1024
        server carbon_relay_2314 127.0.0.1:2314 check maxconn 1024

# distribute across our fanout carbon-relays
listen carbon_relay_2113 0.0.0.0:2113
        #balance leastconn
        mode tcp
        maxconn 1024
        server carbon_relay_2413 127.0.0.1:2413 check maxconn 1024
        server carbon_relay_2513 127.0.0.1:2513 check maxconn 1024

# distribute across our fanout carbon-relays
listen carbon_relay_2114 0.0.0.0:2114
        #balance leastconn
        mode tcp
        maxconn 1024
        server carbon_relay_2414 127.0.0.1:2414 check maxconn 1024
        server carbon_relay_2514 127.0.0.1:2514 check maxconn 1024


## carbon.conf

[cache:1]
USER = carbon
CACHE_WRITE_STRATEGY = sorted
MAX_CACHE_SIZE = inf
USE_FLOW_CONTROL = True
WHISPER_FALLOCATE_CREATE = True
MAX_CREATES_PER_MINUTE = 3000
MAX_UPDATES_PER_SECOND = 10000
LINE_RECEIVER_INTERFACE = 0.0.0.0
LINE_RECEIVER_PORT = 2103
PICKLE_RECEIVER_INTERFACE = 0.0.0.0
PICKLE_RECEIVER_PORT = 2104
USE_INSECURE_UNPICKLER = False
CACHE_QUERY_INTERFACE = 0.0.0.0
CACHE_QUERY_PORT = 7102
LOG_CACHE_HITS = False
LOG_CACHE_QUEUE_SORTS = True
LOG_LISTENER_CONNECTIONS = True
LOG_UPDATES = False
ENABLE_LOGROTATION = True
WHISPER_AUTOFLUSH = False

[cache:2]
USER = carbon
CACHE_WRITE_STRATEGY = sorted
MAX_CACHE_SIZE = inf
USE_FLOW_CONTROL = True
WHISPER_FALLOCATE_CREATE = True
MAX_CREATES_PER_MINUTE = 3000
MAX_UPDATES_PER_SECOND = 10000
LINE_RECEIVER_INTERFACE = 0.0.0.0
LINE_RECEIVER_PORT = 2203
PICKLE_RECEIVER_INTERFACE = 0.0.0.0
PICKLE_RECEIVER_PORT = 2204
USE_INSECURE_UNPICKLER = False
CACHE_QUERY_INTERFACE = 0.0.0.0
CACHE_QUERY_PORT = 7202
LOG_CACHE_HITS = False
LOG_CACHE_QUEUE_SORTS = True
LOG_LISTENER_CONNECTIONS = True
LOG_UPDATES = False
ENABLE_LOGROTATION = True
WHISPER_AUTOFLUSH = False

[cache:3]
USER = carbon
CACHE_WRITE_STRATEGY = sorted
MAX_CACHE_SIZE = inf
USE_FLOW_CONTROL = True
WHISPER_FALLOCATE_CREATE = True
MAX_CREATES_PER_MINUTE = 3000
MAX_UPDATES_PER_SECOND = 10000
LINE_RECEIVER_INTERFACE = 0.0.0.0
LINE_RECEIVER_PORT = 2303
PICKLE_RECEIVER_INTERFACE = 0.0.0.0
PICKLE_RECEIVER_PORT = 2304
USE_INSECURE_UNPICKLER = False
CACHE_QUERY_INTERFACE = 0.0.0.0
CACHE_QUERY_PORT = 7302
LOG_CACHE_HITS = False
LOG_CACHE_QUEUE_SORTS = True
LOG_LISTENER_CONNECTIONS = True
LOG_UPDATES = False
ENABLE_LOGROTATION = True
WHISPER_AUTOFLUSH = False

[cache:4]
USER = carbon
CACHE_WRITE_STRATEGY = sorted
MAX_CACHE_SIZE = inf
USE_FLOW_CONTROL = True
WHISPER_FALLOCATE_CREATE = True
MAX_CREATES_PER_MINUTE = 3000
MAX_UPDATES_PER_SECOND = 10000
LINE_RECEIVER_INTERFACE = 0.0.0.0
LINE_RECEIVER_PORT = 2403
PICKLE_RECEIVER_INTERFACE = 0.0.0.0
PICKLE_RECEIVER_PORT = 2404
USE_INSECURE_UNPICKLER = False
CACHE_QUERY_INTERFACE = 0.0.0.0
CACHE_QUERY_PORT = 7402
LOG_CACHE_HITS = False
LOG_CACHE_QUEUE_SORTS = True
LOG_LISTENER_CONNECTIONS = True
LOG_UPDATES = False
ENABLE_LOGROTATION = True
WHISPER_AUTOFLUSH = False

[cache:5]
USER = carbon
CACHE_WRITE_STRATEGY = sorted
MAX_CACHE_SIZE = inf
USE_FLOW_CONTROL = True
WHISPER_FALLOCATE_CREATE = True
MAX_CREATES_PER_MINUTE = 3000
MAX_UPDATES_PER_SECOND = 10000
LINE_RECEIVER_INTERFACE = 0.0.0.0
LINE_RECEIVER_PORT = 2503
PICKLE_RECEIVER_INTERFACE = 0.0.0.0
PICKLE_RECEIVER_PORT = 2504
USE_INSECURE_UNPICKLER = False
CACHE_QUERY_INTERFACE = 0.0.0.0
CACHE_QUERY_PORT = 7502
LOG_CACHE_HITS = False
LOG_CACHE_QUEUE_SORTS = True
LOG_LISTENER_CONNECTIONS = True
LOG_UPDATES = False
ENABLE_LOGROTATION = True
WHISPER_AUTOFLUSH = False

[cache:6]
USER = carbon
CACHE_WRITE_STRATEGY = sorted
MAX_CACHE_SIZE = inf
USE_FLOW_CONTROL = True
WHISPER_FALLOCATE_CREATE = True
MAX_CREATES_PER_MINUTE = 3000
MAX_UPDATES_PER_SECOND = 10000
LINE_RECEIVER_INTERFACE = 0.0.0.0
LINE_RECEIVER_PORT = 2603
PICKLE_RECEIVER_INTERFACE = 0.0.0.0
PICKLE_RECEIVER_PORT = 2604
USE_INSECURE_UNPICKLER = False
CACHE_QUERY_INTERFACE = 0.0.0.0
CACHE_QUERY_PORT = 7602
LOG_CACHE_HITS = False
LOG_CACHE_QUEUE_SORTS = True
LOG_LISTENER_CONNECTIONS = True
LOG_UPDATES = False
ENABLE_LOGROTATION = True
WHISPER_AUTOFLUSH = False

[relay:1]
USER = carbon
LINE_RECEIVER_INTERFACE = 0.0.0.0
LINE_RECEIVER_PORT = 2213
PICKLE_RECEIVER_INTERFACE = 0.0.0.0
PICKLE_RECEIVER_PORT = 2214
RELAY_METHOD = consistent-hashing
REPLICATION_FACTOR = 2
DESTINATIONS = graphite-0:2114, graphite-1:2114
MAX_DATAPOINTS_PER_MESSAGE = 500
MAX_QUEUE_SIZE = 100000
USE_FLOW_CONTROL = True

[relay:2]
USER = carbon
LINE_RECEIVER_INTERFACE = 0.0.0.0
LINE_RECEIVER_PORT = 2313
PICKLE_RECEIVER_INTERFACE = 0.0.0.0
PICKLE_RECEIVER_PORT = 2314
RELAY_METHOD = consistent-hashing
REPLICATION_FACTOR = 2
DESTINATIONS = graphite-0:2114, graphite-1:2114
MAX_DATAPOINTS_PER_MESSAGE = 500
MAX_QUEUE_SIZE = 100000
USE_FLOW_CONTROL = True

[relay:3]
USER = carbon
LINE_RECEIVER_INTERFACE = 0.0.0.0
LINE_RECEIVER_PORT = 2413
PICKLE_RECEIVER_INTERFACE = 0.0.0.0
PICKLE_RECEIVER_PORT = 2414
RELAY_METHOD = consistent-hashing
MAX_DATAPOINTS_PER_MESSAGE = 500
MAX_QUEUE_SIZE = 100000
USE_FLOW_CONTROL = True
DESTINATIONS = 127.0.0.1:2104:1, 127.0.0.1:2204:2, 127.0.0.1:2304:3, 127.0.0.1:2404:4, 127.0.0.1:2504:5, 127.0.0.1:2604:6

[relay:4]
USER = carbon
LINE_RECEIVER_INTERFACE = 0.0.0.0
LINE_RECEIVER_PORT = 2513
PICKLE_RECEIVER_INTERFACE = 0.0.0.0
PICKLE_RECEIVER_PORT = 2514
RELAY_METHOD = consistent-hashing
MAX_DATAPOINTS_PER_MESSAGE = 500
MAX_QUEUE_SIZE = 100000
USE_FLOW_CONTROL = True
DESTINATIONS = 127.0.0.1:2104:1, 127.0.0.1:2204:2, 127.0.0.1:2304:3, 127.0.0.1:2404:4, 127.0.0.1:2504:5, 127.0.0.1:2604:6
@captnswing
Copy link

Hi, this is really great, thanks for sharing!!
how would carbon-aggregator fit into this? I guess downstream from carbon-relay, but I've never gotten this to work. Any experience with carbon-aggregator that you could share?
thanks!

@captnswing
Copy link

huh, never mind, I got bitten by this bug graphite-project/carbon#100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment