Install InfluxDB
3 minute read
Supported Versions
MyController supports InfluxDB 1.8.x or aboveIn this guide installation shown on Raspberry Pi with Raspbian Linux OS
If you have different OS, refer the influxdb installation guide
Influxdb can be installed in two different ways
Install InfluxDB on the host system
Follow this guide to install InfluxDB directly on your host system
Run the following commands as a root
user
Operating System: Raspbian Linux 10 (buster)
# configure influxdb repository
wget -qO- https://repos.influxdata.com/influxdb.key | apt-key add -
echo "deb https://repos.influxdata.com/debian buster stable" | tee /etc/apt/sources.list.d/influxdb.list
# update package details to the local system
apt update
# install influxdb and enable to run at startup
apt install influxdb
systemctl enable influxdb.service
# start influxdb
systemctl start influxdb.service
Optionally you can disable self monitoring metrics to avoid unnecessary CPU and Disk usage.
- update the following line on
/etc/influxdb/influxdb.conf
[monitor] store-enabled = false
- restart the influxdb service
systemctl restart influxdb.service
(Optional) Create a database for MyController usage in influxDB
If the database user has admin privilege, database will be created automatically by MyController server.
root@rpi-171:~# influx
Connected to http://localhost:8086 version 1.8.5
InfluxDB shell version: 1.8.5
> create database mycontroller
> show databases
name: databases
name
----
mycontroller
> exit
Install InfluxDB on the Docker
Most of the places docker installation of influxdb works well
Warning
In ARM v6, docker version of InfluxDB not started and no issues reported. Tested it on 1.8.4
We can directly install it on the host system by following this guide
To know your machine architecture execute uname -m
on the command line
$ uname -m
armv6l
Note
Assuming that you are running all the commands as aroot
user.If you are running from non-root user, you should include
sudo
in the beginning of the commands.
Generate influxdb.conf
Detailed information is on InfluxDB Website
-
generate
influxdb.conf
mkdir -p /opt/apps/influxdb cd /opt/apps/influxdb docker run --rm influxdb:1.8.4 influxd config > influxdb.conf
-
Optional - Steps to disable InfluxDB monitor
- Monitor InfluxDB metrics will be enabled by default. It eats lot of disk space and CPU.
- on the generated
influxdb.conf
setfalse
tostore-enabled
, available undermonitor
[monitor] store-enabled = false
Install
Variable $PWD
$PWD
is a Print Working Directory
.
mkdir -p /opt/apps/influxdb/influxdb_data
cd /opt/apps/influxdb
docker run --detach --name mc_influxdb \
--publish 8086:8086 \
--volume $PWD/influxdb_data:/var/lib/influxdb \
--volume $PWD/influxdb.conf:/etc/influxdb/influxdb.conf:ro \
--env TZ="Asia/Kolkata" \
--restart unless-stopped \
influxdb:1.8.4
(Optional) Create a database for MyController usage in influxDB
If the database user has admin privilege, database will be created automatically by MyController server.
- enter inside running docker container
- execute
influx
command inside the influx container as follows - create a database by running
create database mycontroller
- show available databases by running
show databases
- type
exit
two time, one exits from influx client shell, second exits from the docker container
$ docker exec -it mc_influxdb /bin/sh
# influx
Connected to http://localhost:8086 version 1.8.4
InfluxDB shell version: 1.8.4
> create database mycontroller
> show databases
name: databases
name
----
mycontroller
> exit
# exit
To see the logs
- Prints all available logs
docker logs mc_influxdb
- Prints and tails the logs, to get exit do
Ctrl+C
docker logs --follow mc_influxdb
Stop
docker stop mc_influxdb
Restart
docker restart mc_influxdb
Uninstall
docker stop mc_influxdb
docker rm mc_influxdb