Skip to content

Commit

Permalink
Merge pull request #107 from ritmas/carbon-cache
Browse files Browse the repository at this point in the history
Automate carbon-cache instances
  • Loading branch information
deniszh authored Jul 1, 2019
2 parents fb5db61 + 55da274 commit a2f0e2e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ Graphite stores tag information in a separate tag database (TagDB). Please check
## Collectd
Use `COLLECTD=1` environment variable to enable local collectd instance

## Carbon-cache
If custom environment `GRAPHITE_CARBONLINK_HOSTS` variable is setup `carbon-cache` instances as daemons/services are [managed](./conf/etc/run_once/carbon-cache) based on the that, otherwise default instance (`127.0.0.1:7002`) is used.

**Note**: if default port `7002` is used among the hosts, need to setup `CARBON_DISABLED=1` in the environment.

## Carbon-relay
Use `RELAY=1` environment variable to enable carbon relay instance. Use `[relay]` section of carbon.conf to configure it.

Expand Down
18 changes: 18 additions & 0 deletions conf/etc/run_once/carbon-cache
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh

if [ -z "$GRAPHITE_CARBONLINK_HOSTS" ]; then
exit 0
fi

IFS=","
for i in $GRAPHITE_CARBONLINK_HOSTS; do
INSTANCE_ID=$(echo $i | tr -d '[:space:]' | awk -F ':' '{print $3}')

[ -z $INSTANCE_ID ] && continue
S=/etc/service/carbon-$INSTANCE_ID
[ -d $S ] && continue
mkdir -p $S/log
sed "s/start/--instance=$INSTANCE_ID start/" /etc/service/carbon/run > $S/run
sed "s/carbon.log/carbon-$INSTANCE_ID.log/" /etc/service/carbon/log/run > $S/log/run
chmod +x $S/run $S/log/run
done

0 comments on commit a2f0e2e

Please sign in to comment.