InfluxDB Run Script
This folder contains a script for configuring and initializing InfluxDB on an AWS server. This script has been tested on the following operating systems:
- Ubuntu 18.04
- Amazon Linux 2
There is a good chance it will work on other flavors of Debian, CentOS, and RHEL as well.
This script assumes you installed it, plus all of its dependencies (including InfluxDB itself), using the install-influxdb module.
Fill out the templated configuration file with user supplied values.
Start InfluxDB on the local node.
Wait for the Meta and Data ASGs to spin up all desired instances then update
/etc/hostswith the IPs of all instances. the value of the instances'
Nametag is used as the
Figure out a rally point for your InfluxDB cluster. This is a "leader" Meta node that will be responsible for initializing the cluster. See Picking a rally point for more info.
On the rally point, initialize the cluster, including adding all Meta and Data nodes to the cluster
We recommend using the
run-influxdb command as part of User
Data, so that it executes
when the EC2 Instance is first booting.
See the examples folder for fully-working sample code.
Command line Arguments
run-influxdb --help to see all available arguments.
Usage: run-influxdb [options] This script can be used to configure and initialize InfluxDB. This script has been tested with Ubuntu 18.04 and Amazon Linux 2. Options: --hostname The hostname of the current node. --node-type Specifies whether the instance will be a Meta or Data node. Must be one of 'meta' or 'data'. --meta-asg-name The name of the ASG that contains meta nodes. --data-asg-name The name of the ASG that contains data nodes. --region The AWS region the Auto Scaling Groups are deployed in. --auto-fill Search the InfluxDB config file for KEY and replace it with VALUE. May be repeated. Example: run-influxdb --node-type meta --meta-asg-name asg-meta --data-asg-name asg-data --region us-east-1 --auto-fill '<__LICENSE_KEY__>=******'
Picking a rally point
The Influx cluster needs a "rally point", which is a single Meta node that is responsible for:
- Initializing the cluster.
- Adding/removing nodes to the cluster.
We need a way to unambiguously and reliably select exactly one rally point. If there's more than one node, you may end up with multiple separate clusters instead of just one!
run-influxdb script can automatically pick a rally point automatically by:
Looking up all the servers in the Auto Scaling Group specified via the
Pick the meta node with the oldest Launch Time as the rally point. If multiple nodes have identical launch times, use the one with the earliest Instance ID, alphabetically.
Passing credentials securely
run-influxdb script requires that you pass in your license key and shared secret. You should make sure to never
store these credentials in plaintext! You should use a secrets management tool to store the credentials in an encrypted
format and only decrypt them, in memory, just before calling
run-influxdb. Here are some tools to consider:
Moreover, if you're ever calling
run-influxdb interactively (i.e., you're manually running CLI commands
rather than executing a script), be careful of passing credentials directly on the command line, or they will be
stored, in plaintext, in Bash
You can either use a CLI tool to set the credentials as environment variables or you can temporarily disable Bash
run-influxdb script assumes it is running on an EC2 Instance with an IAM
Role that has the following permissions:
These permissions are automatically added by the influxdb-cluster module.
Debugging tips and tricks
Some tips and tricks for debugging issues with your InfluxDB cluster:
- Log file locations: https://docs.influxdata.com/enterprise_influxdb/v1.6/administration/logs/.
systemctl status influxdbto see if systemd thinks the InfluxDB process is running.