Store Sensors Data with InfluxDB
1 min readAug 30, 2020
1. Download InfluxDB container
Download influxDB docker image
sudo docker pull influxdb
2. Start InfluxDB server container
sudo docker run -d -p 8086:8086 -v influxdb:/var/lib/influxdb — name influxdb influxdb
Note: In this case, we start the database as deamon and we create a volume to store the data in /var/lib/influxdb
3. Start InfluxDB client container
sudo docker exec -it influxdb influx
3. Create a database
create database Sensor
Create a username and password
create user “<username>” with password ‘<password>’
To see all databases:
show database
Enter the Database:
use Sensor
To see all tables inside the database:
show measurements
To grant access of database to a specific user
grant all on Sensor to <username>
4. Insert some time-series data
Insert data (Here Motionsense is a Measurement which is similar to the table name of SQL):
insert MotionSense,SensorType=Gyro roll=1.2,yaw=5,pitch=3
5. Query the data
See the data of the Measurements:
> select * from MotionSense
name: MotionSense
time SensorType pitch roll yaw
---- ---------- ----- ---- ---
1597078827918172855 Gyro 3 1.2 5
About Me
I am Amit, currently pursuing my MSC from Univeristät Bremen and work as Research Assistant in BIBA with an avid interest in Control and Embedded Applications. You can get in touch with me via LinkedIn.