美文网首页
Centos7 下 InfluxDB安装配置

Centos7 下 InfluxDB安装配置

作者: 五岁小孩 | 来源:发表于2021-04-15 09:23 被阅读0次

InfluxDB安装配置

安装

安装版本:influxdb-1.8.0.x86_64.rpm

# 安装目录
cd /home/app/influxdb1.8
# 在线下载安装包安装
wget https://dl.influxdata.com/influxdb/releases/influxdb-1.8.0.x86_64.rpm
yum localinstall influxdb-1.8.0.x86_64.rpm
# 本地安装
rpm -ivh influxdb-1.8.0.x86_64.rpm

启动

#启动
systemctl start influxdb

#配置开机启动
systemctl enable influxdb

防火墙配置(可选)

#开放端口
# firewall-cmd --add-port=8086/tcp --permanent
#重载防火墙配置
# firewall-cmd --reload

启动cli命令

[root@localhost grafana]# influx
Connected to http://localhost:8086 version 1.8.0
InfluxDB shell version: 1.8.0
>

配置用户和数据库

// InfluxDB 安装后,修改配置文件 vi /etc/influxdb/influxdb.conf
// (1)端口
// (2)[http]    auth-enabled = true // 开启 author
// (3)[http]    flux-enabled = true
// (4)[http]    log-enabled = false // 关闭http的日志

// 创建用户
create user "icnc" with password 'icnc@576576' with all privileges

// 创建数据库以及保留策略
CREATE DATABASE "ICNC_CACHE" WITH DURATION 2d REPLICATION 1 SHARD DURATION 1h NAME "cache_policy_2d"

卸载

卸载命令:

[root@localhost shared]# rpm -q influxdb
influxdb-0.8.7-1.x86_64
[root@localhost shared]# rpm -e influxdb
[root@localhost shared]# rpm -q influxdb
package influxdb is not installed

# 删除完后,清除已有文件:
[root@localhost opt]# rm -rf influxdb

测试

# 连接
[root@localhost ~]# influx -precision rfc3339
Connected to http://localhost:8086 version 1.8.0
InfluxDB shell version: 1.8.0
> 

# 权限验证
> auth
username: icnc
password: 
> 
# 查看所有数据库
> show databases;
name: databases
name
----
_internal
ICNC_CACHE
>

# 使用数据库
> use ICNC_CACHE
Using database ICNC_CACHE
> 
# 查看所有表
> show measurements;
> 
.............
其他操作类似mysql

相关文章

网友评论

      本文标题:Centos7 下 InfluxDB安装配置

      本文链接:https://www.haomeiwen.com/subject/ukptlltx.html