influxdb做为一款性能强悍的时序数据库, 一旦拥有, 别无所求. 本文介绍它的绿色安装方法.
[dev5@7bdc6644c7c4 influxdb-1.7.8] cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
[dev5@7bdc6644c7c4 influxdb-1.7.8] pwd
/home/dev5/tools/
[dev5@7bdc6644c7c4 influxdb-1.7.8] mkdir influxdb-1.7.8
[dev5@7bdc6644c7c4 influxdb-1.7.8] cd influxdb-1.7.8
[dev5@7bdc6644c7c4 influxdb-1.7.8] mkdir influx
[dev5@7bdc6644c7c4 influxdb-1.7.8] mkdir influx/wal influx/dat influx/meta
[dev5@7bdc6644c7c4 influxdb-1.7.8] wget https://repos.influxdata.com/centos/7Server/x86_64/stable/influxdb-1.7.8.x86_64.rpm
[dev5@7bdc6644c7c4 influxdb-1.7.8] rpm2cpio influxdb-1.7.8.x86_64.rpm | cpio -idmv
[dev5@7bdc6644c7c4 influxdb-1.7.8]$ pwd
/home/dev5/tools/influxdb-1.7.8
[dev5@7bdc6644c7c4 influxdb-1.7.8]$ ls
etc influx usr var
修改配置文件: vim etc/influxdb/influxdb.conf
- 将
元数据
, 数据
, 日志
目录指向上面咱们建立的influx/meta
, influx/dat
, influx/wal
.
[meta]
# Where the metadata/raft database is stored
dir = "/home/dev5/tools/influxdb-1.7.8/influx/meta"
[data]
# The directory where the TSM storage engine stores TSM files.
dir = "/home/dev5/tools/influxdb-1.7.8/influx/dat"
# The directory where the TSM storage engine stores WAL files.
wal-dir = "/home/dev5/tools/influxdb-1.7.8/influx/wal"
若是你不许备污染系统环境变量, 就准备一个启动脚本startup-influxdb.sh
#!/bin/sh
#
export PATH=/home/dev5/tools/influxdb-1.7.8/usr/bin:$PATH
#
nohup influxd -config /home/dev5/tools/influxdb-1.7.8/etc/influxdb/influxdb.conf &
刚起来的influxdb还不具有鉴权能力, 手动配置以前, 先建立一个用户.
[dev5@7bdc6644c7c4 influxdb-1.7.8]$ export PATH=/home/dev5/tools/influxdb-1.7.8/usr/bin:$PATH
[dev5@7bdc6644c7c4 influxdb-1.7.8]$ influx
Connected to http://localhost:8086 version 1.7.8
InfluxDB shell version: 1.7.8
> create user admin with password 'deadbeef' with all privileges
> create user "x-msg-im" with password 'deadbeef' with all privileges
> exit
- 使能鉴权: vim etc/influxdb/influxdb.conf
[http]
# Determines whether HTTP endpoint is enabled.
# enabled = true
# The bind address used by the HTTP service.
# bind-address = ":8086"
# Determines whether user authentication is enabled over HTTP/HTTPS.
auth-enabled = true
[dev5@7bdc6644c7c4 influxdb-1.7.8]$ ps -aef|grep influx
dev5 51622 1 0 13:04 pts/3 00:00:01 influxd -config /home/dev5/tools/influxdb-1.7.8/etc/influxdb/influxdb.conf
dev5 52055 39606 0 13:22 pts/3 00:00:00 grep --color=auto influx
[dev5@7bdc6644c7c4 influxdb-1.7.8]$ kill 51622
默认的配置会引发较多的运行时日志, 咱们能够禁用它
- vim etc/influxdb/influxdb.conf
# Whether queries should be logged before execution. Very useful for troubleshooting, but will
# log any sensitive data contained within a query.
# query-log-enabled = true
query-log-enabled = false
# Determines whether HTTP request logging is enabled.
# log-enabled = true
log-enabled = false
到这里一个可用的绿色版influxdb就安装好了, 打包备份. 真正的一次安装, 处处运行.