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就安裝好了, 打包備份. 真正的一次安裝, 處處運行.