Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip] iss #16: upgrade to influxdb 1.1 #35

Merged
merged 2 commits into from
Dec 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions influxdb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ cd ambient7/influxdb/docker
docker logs ambient7-influxdb
docker logs -f ambient7-influxdb
```

### [Upgrade from influxdb 0.9 to 1.1 (ambient7 0.2 -> 0.3)](upgrade_0-9_1-1/README.md)

2 changes: 1 addition & 1 deletion influxdb/clean_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ echo -n "Are you sure to remove all value from measurement '${MEASUREMENT}' [N/y
read Y

if [[ $Y == "Y" || $Y == "y" ]];then
curl -v -f --get "http://${HOST}/query?db=ambient7" \
curl -v -f -XPOST "http://${HOST}/query?db=ambient7" \
"$AUTH_PARAM" \
--data-urlencode "q=DROP SERIES FROM ${MEASUREMENT}" \
&& echo -e "\nDone"
Expand Down
4 changes: 2 additions & 2 deletions influxdb/create_ambient7_users.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ function create_user() {
perms=$2
echo "Password for user $user "
read pass
curl -v -f --get "http://${HOST}/query" \
curl -v -f -XPOST "http://${HOST}/query" \
--data-urlencode 'q=CREATE USER "'$user'" WITH PASSWORD '"'"$pass"'" \
"$AUTH_PARAM"
curl -v -f --get "http://${HOST}/query" \
curl -v -f -XPOST "http://${HOST}/query" \
--data-urlencode 'q=GRANT '$perms' ON '$DB' TO "'$user'"' \
"$AUTH_PARAM"
echo -e "\n\n"
Expand Down
5 changes: 2 additions & 3 deletions influxdb/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ FROM phusion/baseimage:latest
MAINTAINER Nikita Kovalev <nikita@maizy.ru>

# Install InfluxDB
ENV INFLUXDB_VERSION 0.9.5.1
RUN curl -s -o /tmp/influxdb_latest_amd64.deb https://s3.amazonaws.com/influxdb/influxdb_${INFLUXDB_VERSION}_amd64.deb && \
ENV INFLUXDB_VERSION 1.1.0
RUN curl -s -o /tmp/influxdb_latest_amd64.deb https://dl.influxdata.com/influxdb/releases/influxdb_${INFLUXDB_VERSION}_amd64.deb && \
dpkg -i /tmp/influxdb_latest_amd64.deb && \
rm /tmp/influxdb_latest_amd64.deb && \
rm -rf /var/lib/apt/lists/*

ADD types.db /usr/share/collectd/types.db
ADD config.toml /config/config.toml

RUN mkdir -p /etc/service/influxdb
Expand Down
210 changes: 1 addition & 209 deletions influxdb/docker/config.toml
Original file line number Diff line number Diff line change
@@ -1,235 +1,27 @@
### Welcome to the InfluxDB configuration file.

# Once every 24 hours InfluxDB will report anonymous data to m.influxdb.com
# The data includes raft id (random 8 bytes), os, arch, version, and metadata.
# We don't track ip addresses of servers reporting. This is only used
# to track the number of instances running and the versions, which
# is very helpful for us.
# Change this option to true to disable reporting.
reporting-disabled = false

###
### [meta]
###
### Controls the parameters for the Raft consensus group that stores metadata
### about the InfluxDB cluster.
###
hostname = "localhost"

[meta]
dir = "/data/meta"
hostname = "localhost"
bind-address = ":8088"
retention-autocreate = true
election-timeout = "1s"
heartbeat-timeout = "1s"
leader-lease-timeout = "500ms"
commit-timeout = "50ms"

###
### [data]
###
### Controls where the actual shard data for InfluxDB lives and how it is
### flushed from the WAL. "dir" may need to be changed to a suitable place
### for your system, but the WAL settings are an advanced configuration. The
### defaults should work for most systems.
###

[data]
dir = "/data/db"

# The following WAL settings are for the b1 storage engine used in 0.9.2. They won't
# apply to any new shards created after upgrading to a version > 0.9.3.
max-wal-size = 104857600 # Maximum size the WAL can reach before a flush. Defaults to 100MB.
wal-flush-interval = "10m0s" # Maximum time data can sit in WAL before a flush.
wal-partition-flush-delay = "2s" # The delay time between each WAL partition being flushed.

# These are the WAL settings for the storage engine >= 0.9.3
wal-dir = "/data/wal"
wal-enable-logging = true

# When a series in the WAL in-memory cache reaches this size in bytes it is marked as ready to
# flush to the index
# wal-ready-series-size = 25600

# Flush and compact a partition once this ratio of series are over the ready size
# wal-compaction-threshold = 0.6

# Force a flush and compaction if any series in a partition gets above this size in bytes
# wal-max-series-size = 2097152

# Force a flush of all series and full compaction if there have been no writes in this
# amount of time. This is useful for ensuring that shards that are cold for writes don't
# keep a bunch of data cached in memory and in the WAL.
# wal-flush-cold-interval = "10m"

# Force a partition to flush its largest series if it reaches this approximate size in
# bytes. Remember there are 5 partitions so you'll need at least 5x this amount of memory.
# The more memory you have, the bigger this can be.
# wal-partition-size-threshold = 20971520

###
### [cluster]
###
### Controls non-Raft cluster behavior, which generally includes how data is
### shared across shards.
###
[cluster]
write-timeout = "5s" # The time within which a write operation must complete on the cluster.
shard-writer-timeout = "5s" # The time within which a shard must respond to write.

###
### [retention]
###
### Controls the enforcement of retention policies for evicting old data.
###
[retention]
enabled = true
check-interval = "10m0s"

###
### [admin]
###
### Controls the availability of the built-in, web-based admin interface. If HTTPS is
### enabled for the admin interface, HTTPS must also be enabled on the [http] service.
###
[admin]
enabled = true
bind-address = ":8083"
https-enabled = false
https-certificate = "/etc/ssl/influxdb.pem"

###
### [http]
###
### Controls how the HTTP endpoints are configured. These are the primary
### mechanism for getting data into and out of InfluxDB.
###
[http]
enabled = true
bind-address = ":8086"
auth-enabled = true
log-enabled = true
write-tracing = false
pprof-enabled = false
https-enabled = false
https-certificate = "/etc/ssl/influxdb.pem"

###
### [[graphite]]
###
### Controls one or many listeners for Graphite data.
###
[[graphite]]
enabled = false
bind-address = ":2003"
protocol = "tcp"
consistency-level = "one"
separator = "."
database = "graphitedb"

# These next lines control how batching works. You should have this enabled
# otherwise you could get dropped metrics or poor performance. Batching
# will buffer points in memory if you have many coming in.

# batch-size = 1000 # will flush if this many points get buffered
# batch-timeout = "1s" # will flush at least this often even if we haven't hit buffer limit
batch-size = 1000
batch-timeout = "1s"
templates = [
# filter + template
#"*.app env.service.resource.measurement",

# filter + template + extra tag
#"stats.* .host.measurement* region=us-west,agent=sensu",

# default template. Ignore the first graphite component "servers"
"instance.profile.measurement*"
]

###
### [collectd]
###
### Controls the listener for collectd data.
###
[collectd]
enabled = false
# bind-address = ":25826"
# database = "collectd"
# retention-policy = ""
# typesdb = "/usr/share/collectd/types.db"

# These next lines control how batching works. You should have this enabled
# otherwise you could get dropped metrics or poor performance. Batching
# will buffer points in memory if you have many coming in.

# batch-size = 1000 # will flush if this many points get buffered
# batch-timeout = "1s" # will flush at least this often even if we haven't hit buffer limit

###
### [opentsdb]
###
### Controls the listener for OpenTSDB data.
###
[opentsdb]
enabled = false
# bind-address = ":4242"
# database = "opentsdb"
# retention-policy = ""
# consistency-level = "one"

###
### [[udp]]
###
### Controls the listeners for InfluxDB line protocol data via UDP.
###

[[udp]]
enabled = false
bind-address = ":4444"
database = "udpdb"

# These next lines control how batching works. You should have this enabled
# otherwise you could get dropped metrics or poor performance. Batching
# will buffer points in memory if you have many coming in.

# batch-size = 1000 # will flush if this many points get buffered
# batch-timeout = "1s" # will flush at least this often even if we haven't hit buffer limit

###
### [monitoring]
###
### Send anonymous usage statistics to m.influxdb.com?
###
[monitoring]
enabled = false
write-interval = "24h"

###
### [continuous_queries]
###
### Controls how continuous queries are run within InfluxDB.
###

[continuous_queries]
log-enabled = true
enabled = true
recompute-previous-n = 2
recompute-no-older-than = "10m0s"
compute-runs-per-interval = 10
compute-no-more-than = "2m0s"

###
### [hinted-handoff]
###
### Controls the hinted handoff feature, which allows nodes to temporarily
### store queued data when one node of a cluster is down for a short period
### of time.
###

[hinted-handoff]
enabled = true
dir = "/data/hh"
max-size = 1073741824
max-age = "168h"
retry-rate-limit = 0
retry-interval = "1s"
4 changes: 2 additions & 2 deletions influxdb/docker/influxdb_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# InfluxDb docker build container script
#
# Usage:
# cd ambient7/influxdb-setup/docker
# cd ambient7/influxdb/docker
# ./influxdb_build.sh
#
docker build --tag ambient7/influxdb:0.1 ./
docker build --tag ambient7/influxdb:0.2 ./
7 changes: 2 additions & 5 deletions influxdb/docker/influxdb_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@
#
# InfluxDb docker container setup script
#
# On OS X a data dir can't be a shared vbox disk because
# of vboxfs limitations.
#
# Usage:
# cd ambient7/influxdb-setup/docker
# cd ambient7/influxdb/docker
# ./influxdb_setup.sh DATADIR ADMIN_PASSWORD
#
DATADIR="$1"
Expand All @@ -25,4 +22,4 @@ docker run -d -p "${API_PORT}:8086" -p "${ADMIN_PORT}:8083" \
-e "INFLUXDB_INIT_PWD=${ADMIN_PASSWORD}" \
-e "PRE_CREATE_DB=ambient7" \
--name=ambient7-influxdb \
ambient7/influxdb:0.1
ambient7/influxdb:0.2
41 changes: 0 additions & 41 deletions influxdb/docker/run
Original file line number Diff line number Diff line change
Expand Up @@ -6,52 +6,11 @@ INFLUX_HOST="localhost"
INFLUX_API_PORT="8086"
API_URL="http://${INFLUX_HOST}:${INFLUX_API_PORT}"

# Dynamically change the value of 'max-open-shards' to what 'ulimit -n' returns
sed -i "s/^max-open-shards.*/max-open-shards = $(ulimit -n)/" ${CONFIG_FILE}

# Configure InfluxDB Cluster
# if [ -n "${FORCE_HOSTNAME}" ]; then
# if [ "${FORCE_HOSTNAME}" == "auto" ]; then
# #set hostname with IPv4 eth0
# HOSTIPNAME=$(ip a show dev eth0 | grep inet | grep eth0 | sed -e 's/^.*inet.//g' -e 's/\/.*$//g')
# /usr/bin/perl -p -i -e "s/hostname = \"localhost\"/hostname = \"${HOSTIPNAME}\"/g" ${CONFIG_FILE}
# else
# /usr/bin/perl -p -i -e "s/hostname = \"localhost\"/hostname = \"${FORCE_HOSTNAME}\"/g" ${CONFIG_FILE}
# fi
# fi

# NOTE: 'seed-servers.' is nowhere to be found in config.toml, this cannot work anymore! NEED FOR REVIEW!
# if [ -n "${SEEDS}" ]; then
# SEEDS=$(eval SEEDS=$SEEDS ; echo $SEEDS | grep '^\".*\"$' || echo "\""$SEEDS"\"" | sed -e 's/, */", "/g')
# /usr/bin/perl -p -i -e "s/^# seed-servers.*$/seed-servers = [${SEEDS}]/g" ${CONFIG_FILE}
# fi

# if [ -n "${REPLI_FACTOR}" ]; then
# /usr/bin/perl -p -i -e "s/replication-factor = 1/replication-factor = ${REPLI_FACTOR}/g" ${CONFIG_FILE}
# fi

if [ "${PRE_CREATE_DB}" == "**None**" ]; then
unset PRE_CREATE_DB
fi

# NOTE: It seems this is not used anymore...
#
# if [ "${SSL_CERT}" == "**None**" ]; then
# unset SSL_CERT
# fi
#
# if [ "${SSL_SUPPORT}" == "**False**" ]; then
# unset SSL_SUPPORT
# fi

# Add UDP support
if [ -n "${UDP_DB}" ]; then
sed -i -r -e "/^\[\[udp\]\]/, /^$/ { s/false/true/; s/#//g; s/\"udpdb\"/\"${UDP_DB}\"/g; }" ${CONFIG_FILE}
fi
if [ -n "${UDP_PORT}" ]; then
sed -i -r -e "/^\[\[udp\]\]/, /^$/ { s/4444/${UDP_PORT}/; }" ${CONFIG_FILE}
fi


echo "influxdb configuration: "
cat ${CONFIG_FILE}
Expand Down
Loading