您的位置:首页 > 运维架构 > Linux

influxdb-1.7.8绿色安装-centos7

2019-10-19 07:08 1506 查看

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
  • kill, 重启.
[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就安装好了, 打包备份. 真正的一次安装, 到处运行.

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  InfluxDB CentOS Linux