Skip to content

Instantly share code, notes, and snippets.

@inv2004
Created August 10, 2019 01:58
Show Gist options
  • Save inv2004/b8cddd778291711f9f0183280fc7258d to your computer and use it in GitHub Desktop.
Save inv2004/b8cddd778291711f9f0183280fc7258d to your computer and use it in GitHub Desktop.
docker-compose.yml
# clone graphite-clickhouse-tldr
version: '2.0'
services:
zoo1:
image: zookeeper
restart: always
hostname: zoo1
ports:
- 2181:2181
environment:
ZOO_MY_ID: 1
ZOO_SERVERS: server.1=0.0.0.0:2888:3888;2181 server.2=zoo2:2888:3888;2181 server.3=zoo3:2888:3888;2181
zoo2:
image: zookeeper
restart: always
hostname: zoo2
ports:
- 2182:2181
environment:
ZOO_MY_ID: 2
ZOO_SERVERS: server.1=zoo1:2888:3888;2181 server.2=0.0.0.0:2888:3888;2181 server.3=zoo3:2888:3888;2181
zoo3:
image: zookeeper
restart: always
hostname: zoo3
ports:
- 2183:2181
environment:
ZOO_MY_ID: 3
ZOO_SERVERS: server.1=zoo1:2888:3888;2181 server.2=zoo2:2888:3888;2181 server.3=0.0.0.0:2888:3888;2181
ch1:
image: yandex/clickhouse-server
restart: always
hostname: ch1
ports:
- 9000:9000
- 8123:8123
environment:
- LAYER=01
- SHARD=01
volumes:
- ./local.xml:/etc/clickhouse-server/config.d/local.xml
- ./data/ch1:/var/lib/clickhouse
links:
- carbon-clickhouse
ch2:
image: yandex/clickhouse-server
restart: always
hostname: ch2
ports:
- 9001:9000
- 8124:8123
environment:
- LAYER=01
- SHARD=01
volumes:
- ./local.xml:/etc/clickhouse-server/config.d/local.xml
- ./data/ch2:/var/lib/clickhouse
links:
- carbon-clickhouse
clickhouse-metrics1:
image: yandex/clickhouse-server:19.6.2.11
environment:
- LAYER=01
- SHARD=01
volumes:
- "./rollup.xml:/etc/clickhouse-server/config.d/rollup.xml"
- "./local-metrics.xml:/etc/clickhouse-server/config.d/local.xml"
- "./init.sql:/docker-entrypoint-initdb.d/init.sql"
- "./data/ch-metrics1:/var/lib/clickhouse"
clickhouse-metrics2:
image: yandex/clickhouse-server:19.6.2.11
environment:
- LAYER=02
- SHARD=01
volumes:
- "./rollup.xml:/etc/clickhouse-server/config.d/rollup.xml"
- "./local-metrics.xml:/etc/clickhouse-server/config.d/local.xml"
- "./init.sql:/docker-entrypoint-initdb.d/init.sql"
- "./data/ch-metrics2:/var/lib/clickhouse"
carbon-clickhouse:
image: lomik/carbon-clickhouse:v0.10.2
volumes:
- "./data/carbon-clickhouse:/data/carbon-clickhouse"
- "./carbon-clickhouse.conf:/etc/carbon-clickhouse/carbon-clickhouse.conf"
ports:
- "2003:2003" # plain tcp
- "2003:2003/udp" # plain udp
- "2004:2004" # pickle
- "2006:2006" # prometheus remote write
links:
- clickhouse-metrics1:clickhouse
graphite-clickhouse:
image: lomik/graphite-clickhouse:v0.11.1
volumes:
- "./rollup.xml:/etc/graphite-clickhouse/rollup.xml"
- "./graphite-clickhouse.conf:/etc/graphite-clickhouse/graphite-clickhouse.conf"
links:
- clickhouse-metrics1:clickhouse
graphite-web:
image: graphiteapp/graphite-statsd:1.1.3
volumes:
- "./graphiteweb_entrypoint.sh:/entrypoint.sh"
- "./graphiteweb.conf:/opt/graphite/webapp/graphite/local_settings.py"
entrypoint: /entrypoint.sh
links:
- graphite-clickhouse
ports:
- "80:80" # http ui
### local.xml
<yandex>
<zookeeper>
<node index="1">
<host>zoo1</host>
<port>2181</port>
</node>
<node index="2">
<host>zoo2</host>
<port>2181</port>
</node>
<node index="3">
<host>zoo3</host>
<port>2181</port>
</node>
</zookeeper>
<remote_servers>
<replicated>
<shard>
<internal_replication>true</internal_replication>
<replica>
<host>ch1</host>
<port>9000</port>
</replica>
<replica>
<host>ch2</host>
<port>9000</port>
</replica>
</shard>
</replicated>
</remote_servers>
<macros>
<layer from_env="LAYER" />
<shard from_env="SHARD" />
<replica from_env="HOSTNAME" />
</macros>
<graphite>
<host>carbon-clickhouse</host>
<port>2003</port>
<timeout>0.1</timeout>
<interval>1</interval>
<root_path>one_sec</root_path>
<metrics>true</metrics>
<events>true</events>
<asynchronous_metrics>true</asynchronous_metrics>
</graphite>
</yandex>
### local-metrics.xml
<yandex>
<zookeeper>
<node index="1">
<host>zoo1</host>
<port>2181</port>
</node>
<node index="2">
<host>zoo2</host>
<port>2181</port>
</node>
<node index="3">
<host>zoo3</host>
<port>2181</port>
</node>
</zookeeper>
<remote_servers>
<replicated>
<shard>
<internal_replication>true</internal_replication>
<replica>
<host>clickhouse-metrics1</host>
<port>9000</port>
</replica>
<replica>
<host>clickhouse-metrics2</host>
<port>9000</port>
</replica>
</shard>
</replicated>
</remote_servers>
<macros>
<layer from_env="LAYER" />
<shard from_env="SHARD" />
<replica from_env="HOSTNAME" />
</macros>
<graphite>
<host>carbon-clickhouse</host>
<port>2003</port>
<timeout>0.1</timeout>
<interval>1</interval>
<root_path>one_sec</root_path>
<metrics>true</metrics>
<events>true</events>
<asynchronous_metrics>true</asynchronous_metrics>
</graphite>
</yandex>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment