SystemMen - How to install InfluxDB in CentOS 7? In this article, I will guide you step by step to install InfluxDB time series database in CentOS 7.
You can install it for testing before using it.
Preparation steps before installation
Server information
- OS: CentOS Linux release 7.6.1810 (Core).
- RAM: For testing, you can choose 1GB of RAM, while on production environment it depends on the size of your system. I recommend that the minimum is 4GB of RAM.
- CPU: to test, you can choose 1 CPU, on the production environment I recommend a minimum of 4 CPUs.
- HDD: For testing, you can leave 20 GB, on production environment, I recommend a minimum of 100GB. I have run a server InfluxDB 100 GB HDD and can use it for more than 8 months.
Prepare NTP
You see, because this is a time series database. Therefore, we need accurate timestamps between servers.
I recommend that you install a NTP local server and synchronize all servers in the system to it, including InfluxDB server.
I have been faced with a case of displaying InfluxDB data to Grafana wrong. Same dashboard but different web servers display. Finally, I found the reason why NTP is not the same for each server, resulting in timestamp not the same.
Install InfluxDB in CentOS 7
InfluxDB’s documentation page has instructions for installing on different OS types, you can read more.
Here, I just instructed you to install it on CentOS 7.
First, you need root or sudo permissions to install the software.
Next, you create a repo file for InfluxDB. Thus, you can install and update InfluxDB via yum.
cat <<EOF | sudo tee /etc/yum.repos.d/influxdb.repo [influxdb] name = InfluxDB Repository - RHEL $releasever baseurl = https://repos.influxdata.com/rhel/$releasever/$basearch/stable enabled = 1 gpgcheck = 1 gpgkey = https://repos.influxdata.com/influxdb.key EOF
Then you type the following command to install this database.
yum install influxdb -y
Enable influxdb service after reboot.
systemctl enable influxdb
Start InfluxDB service.
service influxdb start
You can check status of influxdb service.
[root@influxdb ~]# service influxdb status Redirecting to /bin/systemctl status influxdb.service ● influxdb.service - InfluxDB is an open-source, distributed, time series database Loaded: loaded (/usr/lib/systemd/system/influxdb.service; enabled; vendor preset: disabled) Active: active (running) since Thu 2019-08-01 10:01:32 +07; 6s ago Docs: https://docs.influxdata.com/influxdb/ Main PID: 23939 (influxd) CGroup: /system.slice/influxdb.service └─23939 /usr/bin/influxd -config /etc/influxdb/influxdb.conf Aug 01 10:01:33 influxdb.local influxd[23939]: ts=2019-08-01T03:01:33.855117Z lvl=info msg="Starting precreation service" log_id=0Gzmr9dW000 service=shard-precreation check_interval=10m advance_period=30m Aug 01 10:01:33 influxdb.local influxd[23939]: ts=2019-08-01T03:01:33.855125Z lvl=info msg="Starting snapshot service" log_id=0Gzmr9dW000 service=snapshot Aug 01 10:01:33 influxdb.local influxd[23939]: ts=2019-08-01T03:01:33.855132Z lvl=info msg="Starting continuous query service" log_id=0Gzmr9dW000 service=continuous_querier Aug 01 10:01:33 influxdb.local influxd[23939]: ts=2019-08-01T03:01:33.855141Z lvl=info msg="Starting HTTP service" log_id=0Gzmr9dW000 service=httpd authentication=false Aug 01 10:01:33 influxdb.local influxd[23939]: ts=2019-08-01T03:01:33.855146Z lvl=info msg="opened HTTP access log" log_id=0Gzmr9dW000 service=httpd path=stderr Aug 01 10:01:33 influxdb.local influxd[23939]: ts=2019-08-01T03:01:33.855266Z lvl=info msg="Listening on HTTP" log_id=0Gzmr9dW000 service=httpd addr=[::]:8086 https=false Aug 01 10:01:33 influxdb.local influxd[23939]: ts=2019-08-01T03:01:33.855283Z lvl=info msg="Starting retention policy enforcement service" log_id=0Gzmr9dW000 service=retention check_interval=30m Aug 01 10:01:33 influxdb.local influxd[23939]: ts=2019-08-01T03:01:33.858979Z lvl=info msg="Listening for signals" log_id=0Gzmr9dW000 Aug 01 10:01:33 influxdb.local influxd[23939]: ts=2019-08-01T03:01:33.859398Z lvl=info msg="Storing statistics" log_id=0Gzmr9dW000 service=monitor db_instance=_internal db_rp=monitor interval=10s Aug 01 10:01:33 influxdb.local influxd[23939]: ts=2019-08-01T03:01:33.859541Z lvl=info msg="Sending usage statistics to usage.influxdata.com" log_id=0Gzmr9dW000
Open firewall port for InfluxDB
InfluxDB uses 2 ports 8086 and 8088. We will open these 2 ports on firewalld with the following command.
[root@influxdb ~]# firewall-cmd --permanent --add-port=8086/tcp success [root@influxdb ~]# firewall-cmd --permanent --add-port=8088/tcp success [root@influxdb ~]# firewall-cmd --reload success
Conclusion
So you can successfully install InfluxDB. This is just the first step, you have a lot of things to do before you can use it.
«« Introduction to InfluxDB time series databaseHow to set up HTTPS for InfluxDB server »»