We need to zip the data and move it to our destination server.
# Zip the Data
tar -czvf file.tar.gz <PATH-TO-STORE>
# Unzip the data
tar -xzvf file.tar.gz
# To move the data between different server you can use sftp
# Then use put/get to move the data
Step 3: Restore the Database
# Restore the database by giving the path to metadir and datadir (from config files)
sudo influxd restore -database indooroutdoorenvdata -metadir /var/lib/influxdb/meta -datadir /var/lib/influxdb/data .
# Need to change permission for imported files
sudo chown -R influxdb:influxdb /var/lib/influxdb
InfluxDB is a Time Series Database system which is a perfect fit for Internet Of Things Applications. It supports high read/write load and also has retention policies that describes for how long and how much data is kept by InfluxDB over a period of time.
Here in this article we will learn how to setup InfluxDB instance on a Linux Virtual Machine with necessary security.
InfluxDB on Ubuntu Virtual Machine
Step 1 : First you need to add the InfluxDB repository with the following three commands.
Here are some general commands to Create Database and Enter Measurements Values
# Setup of Influx DB
CREATE DATABASE database_name
> INSERT temperature,location=indoor value=23
> INSERT temperature,location=outdoor value=19
> INSERT temperature,location=indoor value=22
> INSERT temperature,location=outdoor value=18
SELECT * FROM temperature
SELECT value FROM temperature WHERE location='indoor''
SHOW field keys
SHOW tag keys
DROP DATABASE database_name
Securing your InfluxDB and Modify Config File
It’s important to secure your InfluxDB Database to protect from unauthorized access. Use the Below commands to implement Username/Password Authentication.
CREATE USER samarth WITH PASSWORD '*******' WITH ALL PRIVILEGES
# Modify config file to implement authentication
sudo nano /etc/influxdb/influxdb.conf
auth-enabled = true
pprof-enabled = true
pprof-auth-enabled = true
ping-auth-enabled = true
flux-enabled = true
# Restart to implement changes
sudo systemctl restart influxdb
# Login with below command
influx -username samarth -password *******
You will be able to login without the username and password but you won’t be able to Use any database.
Important: If you want to access InfluxDB from the cloud you need to open port 8086 in your VM settings. No need to open the port if your cloud application is using the database.