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.
Quick start
This script assumes you installed it, plus all of its dependencies (including InfluxDB itself), using the
install-influxdb module.
This will:
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/hosts with the IPs of all instances.
the value of the instances' Name tag is used as the hostname entry.
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.
Run 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!
The run-influxdb script can automatically pick a rally point automatically by:
Looking up all the servers in the Auto Scaling Group specified via the --cluster-name parameter.
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
The 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
history!
You can either use a CLI tool to set the credentials as environment variables or you can temporarily disable Bash
history.
Required permissions
The run-influxdb script assumes it is running on an EC2 Instance with an IAM
Role that has the following permissions:
{"treedata":{"name":"root","toggled":true,"children":[{"name":".circleci","children":[{"name":"config.yml","path":".circleci/config.yml","sha":"f9f681ec70f1e06fb621f9909cea240061b82b07"},{"name":"publish-amis.sh","path":".circleci/publish-amis.sh","sha":"a6c7771129b46556d6863050b3b80abbb632eb36"}]},{"name":".gitignore","path":".gitignore","sha":"1d4e847f6ea857f7842d5d56048758497c58ef7c"},{"name":".pre-commit-config.yaml","path":".pre-commit-config.yaml","sha":"752f3f77602eb7f38ce57c5e6c6dfd8b7cb14367"},{"name":"CODEOWNERS","path":"CODEOWNERS","sha":"4be01a6334d39aa5bf6abe6baae701f5e2a8c5ac"},{"name":"CONTRIBUTING.md","path":"CONTRIBUTING.md","sha":"d02a77a6cf6e01e82938efb4ea53caab2d09a948"},{"name":"LICENSE","path":"LICENSE","sha":"7a4a3ea2424c09fbe48d455aed1eaa94d9124835"},{"name":"NOTICE","path":"NOTICE","sha":"1cc6603154b36da82afb433b6de6ba6b40445e39"},{"name":"README.md","path":"README.md","sha":"29ecbaf4c2af37ea4d2264171d7163152f738709"},{"name":"_docs","children":[{"name":"influxdb-multi-cluster-architecture.png","path":"_docs/influxdb-multi-cluster-architecture.png","sha":"0a22215c9b16f627f97c29588de014d8c23030b3"},{"name":"influxdb-single-cluster-architecture.png","path":"_docs/influxdb-single-cluster-architecture.png","sha":"c5b73dc6575abb032a97d81dafdffeb0c332c26f"},{"name":"tick-multi-cluster-architecture.png","path":"_docs/tick-multi-cluster-architecture.png","sha":"32b8045f0cbcd463b3813e6942965950ad20cddd"}]},{"name":"examples","children":[{"name":"chronograf-ami","children":[{"name":"README.md","path":"examples/chronograf-ami/README.md","sha":"12219d95ac4f7748cc704123dcd1aaa56ae786da"},{"name":"chronograf.json","path":"examples/chronograf-ami/chronograf.json","sha":"0313d0bd477999509254a30b9b88a7b76eb15e40"},{"name":"config","children":[{"name":"chronograf","path":"examples/chronograf-ami/config/chronograf","sha":"8c33b68c638a13593023ad87b6a3dc907bce3a6f"}]}]},{"name":"influxdb-ami","children":[{"name":"README.md","path":"examples/influxdb-ami/README.md","sha":"7347a431c9405d00c3c96042908c66119103d47c"},{"name":"config","children":[{"name":"influxdb-meta.conf","path":"examples/influxdb-ami/config/influxdb-meta.conf","sha":"7ad2a20080cd748eda3ddf29c1841845a897374d"},{"name":"influxdb.conf","path":"examples/influxdb-ami/config/influxdb.conf","sha":"36f19e69835fadc72781f3f606a77c65225deb4b"}]},{"name":"influxdb.json","path":"examples/influxdb-ami/influxdb.json","sha":"1ea4373793061adaddb86809c58c4923e63c8642"}]},{"name":"influxdb-cluster-simple","children":[{"name":"README.md","path":"examples/influxdb-cluster-simple/README.md","sha":"e68a61dbc9a8d989858c5df6dfb79c38fc6052ba"},{"name":"local-test","children":[{"name":".env","path":"examples/influxdb-cluster-simple/local-test/.env","sha":"d94f35ff4c4d7003bed1fd96b1abd8e487326f4c"},{"name":"docker-compose.yml","path":"examples/influxdb-cluster-simple/local-test/docker-compose.yml","sha":"aceb84dad407fd0d42cdcb0d5a577c343c573046"}]},{"name":"user-data","children":[{"name":"user-data.sh","path":"examples/influxdb-cluster-simple/user-data/user-data.sh","sha":"0c0c204a6ef8d564e137898379ab8efff146f22c"}]}]},{"name":"kapacitor-ami","children":[{"name":"README.md","path":"examples/kapacitor-ami/README.md","sha":"ddb815351fe872d219134f4ab6d39e88511b2431"},{"name":"config","children":[{"name":"kapacitor.conf","path":"examples/kapacitor-ami/config/kapacitor.conf","sha":"c70c256d2fdbf953a7a5b65d0111817212e5fb41"}]},{"name":"kapacitor.json","path":"examples/kapacitor-ami/kapacitor.json","sha":"e89b486d399541454ebde7aa799c28f4de390cfa"}]},{"name":"local-mocks","children":[{"name":"README.md","path":"examples/local-mocks/README.md","sha":"1e4ccdc3830140359c5bc2a19259043c21fd82b5"},{"name":"aws.sh","path":"examples/local-mocks/aws.sh","sha":"2ff858b6ce486b5a39c78d5b6421f35032ccb3d8"},{"name":"entrypoint.sh","path":"examples/local-mocks/entrypoint.sh","sha":"dd4d5596ff45597ad2fa1d7158af36fef70dd9c4"},{"name":"influxdb-common.sh","path":"examples/local-mocks/influxdb-common.sh","sha":"8a67f9e1c37ae3753f95632285c2564a83a23161"},{"name":"mount-volume.sh","path":"examples/local-mocks/mount-volume.sh","sha":"c9fa0b283e7ce1a0b1652dc4565bfe2740dcc820"}]},{"name":"telegraf-ami","children":[{"name":"README.md","path":"examples/telegraf-ami/README.md","sha":"5088b7d28693aef395915c1f4a5ec4b4ab92f4fd"},{"name":"config","children":[{"name":"telegraf.conf","path":"examples/telegraf-ami/config/telegraf.conf","sha":"ef7ab46f69c9f543ed4194572fdc8fbad996fb47"}]},{"name":"telegraf.json","path":"examples/telegraf-ami/telegraf.json","sha":"3724bbc99ebc61eef8f0e9e5e231513a57c44ebf"}]},{"name":"tick-ami","children":[{"name":"README.md","path":"examples/tick-ami/README.md","sha":"3fae3c0c11cc2dce489d9b1198248ce429df7cc7"},{"name":"tick.json","path":"examples/tick-ami/tick.json","sha":"f01ee54c1abe4c9cac789f077a56ba440c21c675"}]},{"name":"tick-multi-cluster","children":[{"name":"local-test","children":[{"name":".env","path":"examples/tick-multi-cluster/local-test/.env","sha":"e8f0451b5ea9b681e2cecc7e23cc32cf27dae594"},{"name":"docker-compose.yml","path":"examples/tick-multi-cluster/local-test/docker-compose.yml","sha":"523f12abb9afa2ac4d44957f868b76bb6c58d5e6"}]},{"name":"main.tf","path":"examples/tick-multi-cluster/main.tf","sha":"e3820481b8a2c71c50960d584540c75159fc1ffe"},{"name":"outputs.tf","path":"examples/tick-multi-cluster/outputs.tf","sha":"cc36d3551216edcb0962884d8a8d9c6cc494c57e"},{"name":"user-data","children":[{"name":"chronograf","children":[{"name":"user-data.sh","path":"examples/tick-multi-cluster/user-data/chronograf/user-data.sh","sha":"edcce4a9467877075ef2d5a130f957cb5bb0d342"}]},{"name":"influxdb","children":[{"name":"data-node","children":[{"name":"user-data.sh","path":"examples/tick-multi-cluster/user-data/influxdb/data-node/user-data.sh","sha":"94be7d4ab9c4fbda493e2aaf56acb632ce1d5f83"}]},{"name":"meta-node","children":[{"name":"user-data.sh","path":"examples/tick-multi-cluster/user-data/influxdb/meta-node/user-data.sh","sha":"81ef63c6880d86ee2a2a1f87b41bd5624aea768c"}]}]},{"name":"kapacitor","children":[{"name":"user-data.sh","path":"examples/tick-multi-cluster/user-data/kapacitor/user-data.sh","sha":"85fa24bc49c3c129f3e67ae0f350455f8a0a5a4f"}]},{"name":"telegraf","children":[{"name":"user-data.sh","path":"examples/tick-multi-cluster/user-data/telegraf/user-data.sh","sha":"1f45737e928c4b4407c23eb6b4230ffc507135e2"}]}]},{"name":"variables.tf","path":"examples/tick-multi-cluster/variables.tf","sha":"d4a98c4c302739f19e49fcae0d8f83d8dd0790de"}]},{"name":"tick-single-cluster","children":[{"name":"README.md","path":"examples/tick-single-cluster/README.md","sha":"8af5285a92db39248ecd0c0126a19881b1a7ec0b"},{"name":"local-test","children":[{"name":".env","path":"examples/tick-single-cluster/local-test/.env","sha":"9aab6b098221a61e5783ac141f52ab9c76c617f2"},{"name":"docker-compose.yml","path":"examples/tick-single-cluster/local-test/docker-compose.yml","sha":"1d533b6bc7808b216a21deeb6e4683be4aada216"}]},{"name":"main.tf","path":"examples/tick-single-cluster/main.tf","sha":"e76d85585578b446d4b9f4566d1678f0b1e6f6fa"},{"name":"outputs.tf","path":"examples/tick-single-cluster/outputs.tf","sha":"1f6582af089670a544838f8daf2d6b9443d714bf"},{"name":"user-data","children":[{"name":"user-data.sh","path":"examples/tick-single-cluster/user-data/user-data.sh","sha":"3761f7be138ac64ef9a23345791a45b6bae231f0"}]},{"name":"variables.tf","path":"examples/tick-single-cluster/variables.tf","sha":"766f1a00791ef7fd92728191d472349360ee4e5e"}]}]},{"name":"main.tf","path":"main.tf","sha":"7f83810cbd2d7b830a929660cc9adf014f7b0191"},{"name":"modules","children":[{"name":"chronograf-security-group-rules","children":[{"name":"README.md","path":"modules/chronograf-security-group-rules/README.md","sha":"ba653f803e7caeaa46d4d6205b59c5ca2f975ce4"},{"name":"main.tf","path":"modules/chronograf-security-group-rules/main.tf","sha":"c5b95770f9f478b91aa3025eb3bc6db52cfa4ed9"},{"name":"outputs.tf","path":"modules/chronograf-security-group-rules/outputs.tf","sha":"f7f3421d941f6323ac0d1c239c1944bafa558ccc"},{"name":"variables.tf","path":"modules/chronograf-security-group-rules/variables.tf","sha":"e836411856590178128294d05f0fc79899762765"}]},{"name":"chronograf-server","children":[{"name":"README.md","path":"modules/chronograf-server/README.md","sha":"e2110e93fb9b5eabfa4e1b6a5fcd9f6b61a3714e"},{"name":"main.tf","path":"modules/chronograf-server/main.tf","sha":"aa540886702bb8fc041ebb2c99a3cb4f19bf9722"},{"name":"outputs.tf","path":"modules/chronograf-server/outputs.tf","sha":"a290eaa88481cf8fdce21fee69e87f2a675d6b46"},{"name":"variables.tf","path":"modules/chronograf-server/variables.tf","sha":"412d27de9db1556050013a83398d31b96cc512b8"}]},{"name":"influxdb-cluster","children":[{"name":"README.md","path":"modules/influxdb-cluster/README.md","sha":"1377a05cc13f8f8c6155248e89760a91382141e0"},{"name":"main.tf","path":"modules/influxdb-cluster/main.tf","sha":"4baf70b04ff38d86987665819adc69b03f13f513"},{"name":"outputs.tf","path":"modules/influxdb-cluster/outputs.tf","sha":"a290eaa88481cf8fdce21fee69e87f2a675d6b46"},{"name":"variables.tf","path":"modules/influxdb-cluster/variables.tf","sha":"4b648c75401df28be3ebb92a61eaff61d32d56b5"}]},{"name":"influxdb-commons","children":[{"name":"influxdb-common.sh","path":"modules/influxdb-commons/influxdb-common.sh","sha":"1ced7551708487f10210c2e10eedcff4336fd4b6"},{"name":"mount-volume.sh","path":"modules/influxdb-commons/mount-volume.sh","sha":"ea92e25a009991796e13542117d9aeee2e77bdf3"}]},{"name":"influxdb-iam-policies","children":[{"name":"README.md","path":"modules/influxdb-iam-policies/README.md","sha":"114b98b4ee6bf2981b49f85b9f63ff265c22377a"},{"name":"main.tf","path":"modules/influxdb-iam-policies/main.tf","sha":"144c26257265c80b71ea2e6598a5fa588cab91a4"},{"name":"variables.tf","path":"modules/influxdb-iam-policies/variables.tf","sha":"52873644e20b4cafdcc0f33dc11db99f1fa9b586"}]},{"name":"influxdb-security-group-rules","children":[{"name":"README.md","path":"modules/influxdb-security-group-rules/README.md","sha":"417d2edf9ed471cd52caceae6d17d4271d1d50f9"},{"name":"main.tf","path":"modules/influxdb-security-group-rules/main.tf","sha":"3a87176e4e9b7d5e6ec43850606b9953ba8b1b21"},{"name":"outputs.tf","path":"modules/influxdb-security-group-rules/outputs.tf","sha":"5a6f6ae13dd2cd02c5afdfdf8a2986c4e8fd86bd"},{"name":"variables.tf","path":"modules/influxdb-security-group-rules/variables.tf","sha":"1f763c57fe0b502554d004fa112ac03726c8ad01"}]},{"name":"install-chronograf","children":[{"name":"README.md","path":"modules/install-chronograf/README.md","sha":"0265bb8199d0f8b167f88ff20102769e378adc28"},{"name":"install-chronograf","path":"modules/install-chronograf/install-chronograf","sha":"557b391c65eaf8de246f86b43c42a7515671aa6e"}]},{"name":"install-influxdb","children":[{"name":"README.md","path":"modules/install-influxdb/README.md","sha":"e9760321b7164d283c3a67d3aceca99aff74efa1"},{"name":"install-influxdb","path":"modules/install-influxdb/install-influxdb","sha":"28dd51772da06991dcda7040bd7a4e3d41313979"}]},{"name":"install-kapacitor","children":[{"name":"README.md","path":"modules/install-kapacitor/README.md","sha":"94af4c0b91ab86cd35c7fafc1481750cb30f817e"},{"name":"install-kapacitor","path":"modules/install-kapacitor/install-kapacitor","sha":"ede4f4302b14ca8296f0b661244b5006193ba540"}]},{"name":"install-telegraf","children":[{"name":"README.md","path":"modules/install-telegraf/README.md","sha":"873f734214f00d7c45a3f034206811273980a78e"},{"name":"install-telegraf","path":"modules/install-telegraf/install-telegraf","sha":"c36216b7e173a55c0126d96ae5dc4b84f84799dd"}]},{"name":"kapacitor-security-group-rules","children":[{"name":"README.md","path":"modules/kapacitor-security-group-rules/README.md","sha":"7e70898738f0dd781e7b68e0e8d8fb33fdde91fc"},{"name":"main.tf","path":"modules/kapacitor-security-group-rules/main.tf","sha":"a4dabc6bcdfb9c421bdae37f8a0963e3f6ad9f23"},{"name":"outputs.tf","path":"modules/kapacitor-security-group-rules/outputs.tf","sha":"f7f3421d941f6323ac0d1c239c1944bafa558ccc"},{"name":"variables.tf","path":"modules/kapacitor-security-group-rules/variables.tf","sha":"f21b9ff1c047b37c63c24bbc9d1803b9fe02d492"}]},{"name":"kapacitor-server","children":[{"name":"README.md","path":"modules/kapacitor-server/README.md","sha":"609adbe9be1c5189e93c9d9869a05519d4afa9c9"},{"name":"main.tf","path":"modules/kapacitor-server/main.tf","sha":"2c6845d77e1b8d253bd22721277c331dafaf62ce"},{"name":"outputs.tf","path":"modules/kapacitor-server/outputs.tf","sha":"618d0987a275cd153cf22f7745369bfe749fe6b2"},{"name":"variables.tf","path":"modules/kapacitor-server/variables.tf","sha":"ab49dd73e22da2adf8de4c66d318fefc1524350a"}]},{"name":"load-balancer-target-group","children":[{"name":"README.md","path":"modules/load-balancer-target-group/README.md","sha":"561c66859086f8dd877312bb4cc9d05eaf23706e"},{"name":"main.tf","path":"modules/load-balancer-target-group/main.tf","sha":"06d281d12ff069fe7a5c516d442823c7533410f6"},{"name":"outputs.tf","path":"modules/load-balancer-target-group/outputs.tf","sha":"cdf904445cf5099ccea5cc8820d198a1ffba4283"},{"name":"variables.tf","path":"modules/load-balancer-target-group/variables.tf","sha":"e249b8f633bed4ca941a7b5510d5e6f39805ff33"}]},{"name":"load-balancer","children":[{"name":"README.md","path":"modules/load-balancer/README.md","sha":"2748251533467ce849be4fbc6bb4868aea545313"},{"name":"main.tf","path":"modules/load-balancer/main.tf","sha":"271d8f729e6486b32501184448b3ac2a0172b837"},{"name":"outputs.tf","path":"modules/load-balancer/outputs.tf","sha":"26a741cce6b75f2c60339aefea93d5c99b862222"},{"name":"variables.tf","path":"modules/load-balancer/variables.tf","sha":"10f5715eba776610dd713ce1d59938c4fe6cb078"}]},{"name":"run-chronograf","children":[{"name":"README.md","path":"modules/run-chronograf/README.md","sha":"31ad5434745d5e4e05c289ded3ae85d5faaacd75"},{"name":"run-chronograf","path":"modules/run-chronograf/run-chronograf","sha":"29fe5710e71333e6aa3b7b37ab8ab812d5b3b53b"}]},{"name":"run-influxdb","children":[{"name":"README.md","path":"modules/run-influxdb/README.md","sha":"41fc1a499b85c3c8f29a8a051b9965de00048889","toggled":true},{"name":"run-influxdb","path":"modules/run-influxdb/run-influxdb","sha":"47755e2a21f2453ba949092bd76c0c110b5076db"}],"toggled":true},{"name":"run-kapacitor","children":[{"name":"README.md","path":"modules/run-kapacitor/README.md","sha":"0aeb557ba7f4f6c904af560f5eefa4acacaa4373"},{"name":"run-kapacitor","path":"modules/run-kapacitor/run-kapacitor","sha":"3394dc6e702aeb78e168d81c433af48df70927c6"}]},{"name":"run-telegraf","children":[{"name":"README.md","path":"modules/run-telegraf/README.md","sha":"ac8d874e452929be5a4b4c00446568c10bd10de5"},{"name":"run-telegraf","path":"modules/run-telegraf/run-telegraf","sha":"724af683538e33ed4c51d0204202c04cf1cdc14f"}]}],"toggled":true},{"name":"outputs.tf","path":"outputs.tf","sha":"1d2464bda76ea8f452773ebc69b41e3b65b1c827"},{"name":"test","children":[{"name":"Gopkg.lock","path":"test/Gopkg.lock","sha":"99df58080a1f0db4565d214129c32b4e1a4769e2"},{"name":"Gopkg.toml","path":"test/Gopkg.toml","sha":"b6373bead7b213d542e3564e5915ac2ffde5f0b8"},{"name":"README.md","path":"test/README.md","sha":"819e790d15767c851bfc438f0a1413ed2bde7d3b"},{"name":"influxdb_single_cluster_test.go","path":"test/influxdb_single_cluster_test.go","sha":"4dc35665cb26dbecd2cb7f9d33d64319797f2305"},{"name":"test_helpers.go","path":"test/test_helpers.go","sha":"1bbda8373251e26156a8b3422bc338d19d56aa10"},{"name":"tick_multi_cluster_test.go","path":"test/tick_multi_cluster_test.go","sha":"cc48d14f53f7f6df04e8e441d33788c2ac575344"},{"name":"tick_single_cluster_test.go","path":"test/tick_single_cluster_test.go","sha":"97921520812154ba4198ea7f33fe38a5df49b77d"}]},{"name":"variables.tf","path":"variables.tf","sha":"c1aa8ee0980cb0fd3a83f90e67407a510420131d"}]},"detailsContent":"<h1 class=\"preview__body--title\" id=\"influx-db-run-script\">InfluxDB Run Script</h1><div class=\"preview__body--border\"></div><p>This folder contains a script for configuring and initializing InfluxDB on an <a href=\"https://aws.amazon.com/\" class=\"preview__body--description--blue\" target=\"_blank\">AWS</a> server.\nThis script has been tested on the following operating systems:</p>\n<ul>\n<li>Ubuntu 18.04</li>\n<li>Amazon Linux 2</li>\n</ul>\n<p>There is a good chance it will work on other flavors of Debian, CentOS, and RHEL as well.</p>\n<h2 class=\"preview__body--subtitle\" id=\"quick-start\">Quick start</h2>\n<p>This script assumes you installed it, plus all of its dependencies (including InfluxDB itself), using the\n<a href=\"/repos/v0.1.1/terraform-aws-influx/modules/install-influxdb\" class=\"preview__body--description--blue\">install-influxdb module</a>.</p>\n<p>This will:</p>\n<ol>\n<li>\n<p>Fill out the templated configuration file with user supplied values.</p>\n</li>\n<li>\n<p>Start InfluxDB on the local node.</p>\n</li>\n<li>\n<p>Wait for the Meta and Data ASGs to spin up all desired instances then update <code>/etc/hosts</code> with the IPs of all instances.\nthe value of the instances' <code>Name</code> tag is used as the <code>hostname</code> entry.</p>\n</li>\n<li>\n<p>Figure out a rally point for your InfluxDB cluster. This is a "leader" Meta node that will be responsible for\ninitializing the cluster. See <a href=\"#picking-a-rally-point\" class=\"preview__body--description--blue\">Picking a rally point</a> for more info.</p>\n</li>\n<li>\n<p>On the rally point, initialize the cluster, including adding all Meta and Data nodes to the cluster</p>\n</li>\n</ol>\n<p>We recommend using the <code>run-influxdb</code> command as part of <a href=\"http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html#user-data-shell-scripts\" class=\"preview__body--description--blue\" target=\"_blank\">User\nData</a>, so that it executes\nwhen the EC2 Instance is first booting.</p>\n<p>See the <a href=\"/repos/v0.1.1/terraform-aws-influx/examples\" class=\"preview__body--description--blue\">examples folder</a> for\nfully-working sample code.</p>\n<h2 class=\"preview__body--subtitle\" id=\"command-line-arguments\">Command line Arguments</h2>\n<p>Run <code>run-influxdb --help</code> to see all available arguments.</p>\n<pre><span class=\"hljs-attribute\">Usage</span>: run-influxdb [options]\n\n<span class=\"routeros\">This<span class=\"hljs-built_in\"> script </span>can be used <span class=\"hljs-keyword\">to</span> configure <span class=\"hljs-keyword\">and</span> initialize InfluxDB. This<span class=\"hljs-built_in\"> script </span>has been tested with Ubuntu 18.04 <span class=\"hljs-keyword\">and</span> Amazon Linux 2.\n\nOptions:\n\n --hostname The hostname of the current node.\n --node-type Specifies whether the<span class=\"hljs-built_in\"> instance </span>will be a Meta <span class=\"hljs-keyword\">or</span> Data node. Must be one of <span class=\"hljs-string\">'meta'</span> <span class=\"hljs-keyword\">or</span> <span class=\"hljs-string\">'data'</span>.\n --meta-asg-name The name of the ASG that contains meta nodes.\n --data-asg-name The name of the ASG that contains data nodes.\n --region The AWS region the Auto Scaling Groups are deployed <span class=\"hljs-keyword\">in</span>.\n --auto-fill Search the InfluxDB<span class=\"hljs-built_in\"> config </span>file <span class=\"hljs-keyword\">for</span> KEY <span class=\"hljs-keyword\">and</span> replace it with VALUE. May be repeated.\n\nExample:\n\n run-influxdb --node-type meta --meta-asg-name asg-meta --data-asg-name asg-data --region us-east-1 --auto-fill <span class=\"hljs-string\">'<__LICENSE_KEY__>=******'</span>\n</span></pre>\n<h2 class=\"preview__body--subtitle\" id=\"picking-a-rally-point\">Picking a rally point</h2>\n<p>The Influx cluster needs a "rally point", which is a single Meta node that is responsible for:</p>\n<ol>\n<li>Initializing the cluster.</li>\n<li>Adding/removing nodes to the cluster.</li>\n</ol>\n<p>We need a way to unambiguously and reliably select exactly one rally point. If there's more than one node, you may end\nup with multiple separate clusters instead of just one!</p>\n<p>The <code>run-influxdb</code> script can automatically pick a rally point automatically by:</p>\n<ol>\n<li>\n<p>Looking up all the servers in the Auto Scaling Group specified via the <code>--cluster-name</code> parameter.</p>\n</li>\n<li>\n<p>Pick the meta node with the oldest Launch Time as the rally point. If multiple nodes have identical launch times, use the\none with the earliest Instance ID, alphabetically.</p>\n</li>\n</ol>\n<h2 class=\"preview__body--subtitle\" id=\"passing-credentials-securely\">Passing credentials securely</h2>\n<p>The <code>run-influxdb</code> script requires that you pass in your license key and shared secret. You should make sure to never\nstore these credentials in plaintext! You should use a secrets management tool to store the credentials in an encrypted\nformat and only decrypt them, in memory, just before calling <code>run-influxdb</code>. Here are some tools to consider:</p>\n<ul>\n<li><a href=\"https://www.vaultproject.io/\" class=\"preview__body--description--blue\" target=\"_blank\">Vault</a></li>\n<li><a href=\"https://square.github.io/keywhiz/\" class=\"preview__body--description--blue\" target=\"_blank\">Keywhiz</a></li>\n<li><a href=\"https://aws.amazon.com/kms/\" class=\"preview__body--description--blue\" target=\"_blank\">KMS</a></li>\n</ul>\n<p>Moreover, if you're ever calling <code>run-influxdb</code> interactively (i.e., you're manually running CLI commands\nrather than executing a script), be careful of passing credentials directly on the command line, or they will be\nstored, in plaintext, <a href=\"https://www.digitalocean.com/community/tutorials/how-to-use-bash-history-commands-and-expansions-on-a-linux-vps\" class=\"preview__body--description--blue\" target=\"_blank\">in Bash\nhistory</a>!\nYou can either use a CLI tool to set the credentials as environment variables or you can <a href=\"https://linuxconfig.org/how-to-disable-bash-shell-commands-history-on-linux\" class=\"preview__body--description--blue\" target=\"_blank\">temporarily disable Bash\nhistory</a>.</p>\n<h2 class=\"preview__body--subtitle\" id=\"required-permissions\">Required permissions</h2>\n<p>The <code>run-influxdb</code> script assumes it is running on an EC2 Instance with an <a href=\"http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html\" class=\"preview__body--description--blue\" target=\"_blank\">IAM\nRole</a> that has the following permissions:</p>\n<ul>\n<li><code>ec2:DescribeInstances</code></li>\n<li><code>ec2:DescribeTags</code></li>\n<li><code>autoscaling:DescribeAutoScalingGroups</code></li>\n</ul>\n<p>These permissions are automatically added by the <a href=\"/repos/v0.1.1/terraform-aws-influx/modules/influxdb-cluster\" class=\"preview__body--description--blue\">influxdb-cluster\nmodule</a>.</p>\n<h2 class=\"preview__body--subtitle\" id=\"debugging-tips-and-tricks\">Debugging tips and tricks</h2>\n<p>Some tips and tricks for debugging issues with your InfluxDB cluster:</p>\n<ul>\n<li>Log file locations: https://docs.influxdata.com/enterprise_influxdb/v1.6/administration/logs/.</li>\n<li>Use <code>systemctl status influxdb</code> to see if systemd thinks the InfluxDB process is running.</li>\n</ul>\n","repoName":"terraform-aws-influx","repoRef":"v0.1.2","serviceDescriptor":{"serviceName":"InfluxDB","serviceRepoName":"terraform-aws-influx","serviceRepoOrg":"gruntwork-io","cloudProviders":["aws"],"description":"Deploy an InfluxDB cluster. Supports automatic bootstrapping and auto healing.","imageUrl":"tick.png","licenseType":"open-source","technologies":["Terraform","Bash"],"compliance":[],"tags":[""]},"serviceCategoryName":"NoSQL","fileName":"README.md","filePath":"/modules/run-influxdb","title":"Repo Browser: InfluxDB","description":"Browse the repos in the Gruntwork Infrastructure as Code Library."}