An Industrial IOT Platform

How to install InfluxDB (Docker) for Windows 10

Work in progress
Downloads are currently not available
Contact us for demo

STEP 1 - Install Docker

InfluxDB is a NoSQL Database which can run on windows, mac or linux. To run on windows, it is recommended for Influxdb to run on a dockerized container. Although it can be run on windows directly, this is not the recommeded method as advised by Influx DB Developer . 
For this reason, the first setup is to install docker for windows. Download docker for windows at the following link:
https://docs.docker.com/docker-for-windows/install/

STEP 2 - Run Docker

Once installed, Docker Desktop will appear on the windows start menu. Click it to launch.

Docker will start loading

Docker should appear in the windows taskbar indicating that it has started

If virtualization error occurs

Sometimes the following message will appear:
'An error Occurred' Hardware assisted virtualization and data execution protection must be enabled in the BIOS. 

To fix this issue go to the link shown
https://docs.docker.com/docker-for-windows/troubleshoot/#virtualization-must-be-enabled
This link tells the user to go to the system BIOS and enable virtualization.

Make sure Docker is set to start automatically when system restarts

In windows 10 task manager, go to startup and scroll down to Docker Desktop. Make sure status is set as 'Enabled'

STEP 3 - Download Docker Container for InfluxDB

Open an Command Prompt (it doesnt't matter where it is open). Then, use the following command:
> docker pull influxdb
This will download the docker container for InfluxDB.

Where is docker image stored?

The docker container image will be stored by default at:
C:/ProgramData/DockerDesktop/vm-data
This location can be changed in the docker settings
windows systray -> docker for windows -> docker settings -> advanced -> disk image location
All database files will be stored in this docker image, thus the image size will grow in size accordingly.

You may also want to change the docker settings

This is to allow docker to use more of the Systems's resources

Check docker image exists

To check if a docker image exists, in your command prompt type in the following. Influxdb should appear there. The image is like a blueprint, it will only be running once it's loaded into a container
>docker image ls

STEP 4 - Set the Influxdb configuration file

Before the Influxdb image can be run, the influxdb configuration file 'influxdb.conf' needs to be set. You can download a config file at the following link:

Download the influxdb.conf file

Paste the config file to InfluxDB directory

Once download you may edit the file if you are know what you're doing.  The paste the file at the following location. If the location does not exist, create the directory
C:/ProgramData/InfluxDB

STEP 5 - Run InfluxDB

Run InfluxDB using the following command. This command loads the InfluxDB image into a container.
>docker run -p 8086:8086 -v C:/ProgramData/InfluxDB:/var/lib/influxdb influxdb -config /var/lib/influxdb/influxdb.conf

What does the following command do?

-run: Means run the image

-p: Means setting the port as XXXX:XXXX. InfluxDB uses port 8086 by default.

--restart=always: Means that the container will automatically restart when the system reboots (Rhe docker service must also starts after system reboot)

-v: Means mount. This means the windows directory 'C:/ProgramData/InfluxDB' will be mapped to linux directory '/var/lib/influxdb influxdb'. Please take note the regular windows back slash becomes '/' (front slash) in the command.  Permission wil be asked to allow docker to access the drive as shown below.
-influxdb: Means the Influxdb image to load

-config: Means the location of the config file in the linux directory. Since this directory is mapped to windows directory, putting the config file in the windows directory will cause it to appear at the defined linux folder.

When InfluxDB is run, the command prompt should show the following:
NOTE: You may close the command prompt after running. Docker continues to run the container even if the command prompt is closed

STEP 6 - Check InfluxDB Running

Open a web browser and browse to the following location
http://localhost:8086/query?q=show%20databases
The following should be shown. This indicates than InfluxDB is running. The API query lists all the databases in the system

STEP 7 -  Manage Docker Containers (Useful commands)

To stop a running container

First get the container ID using 'docker contrainer ls'. Then use container stop command:
>docker container stop [CONTAINER ID]

To list all stopped containers

Listing all stopped containers is important to find containerId that was stopped
>docker container list -f "status=exited"

To remove all stopped containers

>docker system prune

To restart a stopped container

To srestart a stopped container use the same [ContainerID] that was stopped in the following command
>docker container start [CONTAINER ID]

Running Unix shell commands on a container

If you are familiar with UNIX commands, you can also run SSH on the container using the following command:
>docker exec -it [CONTAINER ID] bash

Where are the influxDB database files?

The InfluxDB data files are located where the -v (mount parameter) is specified during the 'docker run' command on step 5. Take note that since this is run on windows but the container is run on linux the slash '/' is used instead of back slash.
>docker run -p 8086:8086 -v C:/ProgramData/InfluxDB:/var/lib/influxdb influxdb -config /var/lib/influxdb/influxdb.conf
Below is a screenshot of an InfluxDB database directory

Congratulations, you have successfully installed InfluxDB Docker on Windows 10!

Open-Plant is a revolutionary Industrial IOT Platform software, used to create and deploy Industrial IT apps/solutions. It is an all-encompassing solution offering both back-end and front-end components i.e. the full stack. From our user's experience, creating and deploying Industrial IT apps became 10x faster and 10x less cost. We serve the mining, energy, oil & gas, construction and manufacturing industry. 

Vlix

Perth, Australia

EMAIL

info@vlix.me
homedownloadexclamation-triangleenvelope