A medium-performance setup for Grafana on AWS. Private files at github.
Setup the instance
- t3.large, Ubuntu 18 (or AWS Linux 2) as I’m familiar with it
- Seperate root and data disks
- Security group with 8083 (InfluxDB), 22 (SSH), 80 (www) and, optionally, 3000 (Grafana) open
Setup separate data volume
Key files
/var/lib/influxdb/ # backup via aws
/etc/influx/influx.conf # git
/etc/grafana/grafana.ini # git
/var/lib/grafana/ # backup via aws
Option 1: Mount a seperate volume for /var
Use instructions from AWS to mount an attached volume
sudo mkfs -t ext4 /dev/nvme1n1 # or xfs or ext4
sudo mkdir /data
mount /dev/nvme1e0 /data # temp...
sudo rsync -a /var/ /data/ # ..to enable this sudo blkid # remember UUID sudo nano /etc/fstab # Add the following (change UUID) UUID=8a2ca8df-d123-4ff2-9183-33ba462826de /var ext4 defaults,nofail 0 2
# restart
Option 2: Symlink to /data
# mount a volume at /data and symlink: sudo mkdir -p /data/etc/influxdb/ sudo mkdir -p /data/lib/influxdb/ cd /etc/influxdbsudo mv /etc/influxdb/influxdb.conf /data/etc/influxdbsudo ln -s /data/etc/influxdb/influxdb.conf sudo chown -R influxdb:influxdb /data/etc/influxdb/ /data/lib/influxdb/ vim /etc/influxdb/influxdb.conf # to point to /data: [data] dir = "/data/lib/influxdb/data" wal-dir = "/data/lib/influxdb/wal" [meta] dir = "/data/lib/influxdb/meta"
Install the software:
Install as directed:
Then:
# need secure-link module
sudo apt-get install nginx-extras
# start on boot
sudo systemctl enable nginx
sudo systemctl enable influxdb
sudo systemctl enable grafana-server
Configure
Configure InfluxDB
Add an admin user first:
influx>create user whoever with password [REDACTED]
Then configure via /etc/influxdb/influxdb.conf :
[http]
access-log-path = "/var/log/influxdb/influxdb-http.log" auth-enabled = true
max-connection-limit = 1000
[coordinator]
max-concurrent-queries = 100
max-select-series = 100
query-timeout = "10s"
log-queries-after = "1s"
max-select-point = 1000000
[continuous_queries]
query-stats-enabled = true
query-stats-enabled = false
run-interval = "1m"
And… restart to see changes
sudo systemctl restart influxdb sudo systemctl status influxdb
Configure Grafana
/etc/grafana/grafana.ini:
[server]
root_url = http://live2.example.com
[users]
allow_sign_up = false
allow_org_create = false
auto_assign_org = false
[auth.anonymous]
# check if required?
enabled = true
[auth.proxy]
enabled = true
Configure Nginx
See Access Grafana via token without login screen for details.