目录
环境搭建
rpm安装
wget https://dl.influxdata.com/influxdb/releases/influxdb-1.2.4.x86_64.rpm
yum influxdb-1.2.4.x86_64.rpm
此处安装的是1.2.4,需要注意的是,高版本的不支持web访问。
其他版本的安装可以参考官网,讲解的很详细
https://docs.influxdata.com/influxdb/v1.7/introduction/installation/
端口
- port 8083:管理页面端口,访问localhost:8083可以进入你本机的influxdb管理页面;
- port 8086:http连接influxdb client端口,一般使用该端口往本机的influxdb读写数据。
配置文件
/etc/influxdb/influxdb.conf 采用最简单的配置,修改一下2处,分别是设置web访问和http访问的端口、密码
[admin]
# Determines whether the admin service is enabled.
enabled = true
#WEB页面的端口
# The default bind address used by the admin service.
bind-address = ":8083"
[http]
# Determines whether HTTP endpoint is enabled.
# enabled = true
# The bind address used by the HTTP service.
bind-address = ":8086"
#开启密码
# Determines whether HTTP authentication is enabled.
auth-enabled = true
启动
systemctl start influxdb
查看状态
[root@axe1 influxdb]# systemctl status influxdb
● 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 Tue 2019-10-08 18:54:59 CST; 8min ago
Docs: https://docs.influxdata.com/influxdb/
Main PID: 860 (influxd)
CGroup: /system.slice/influxdb.service
└─860 /usr/bin/influxd -config /etc/influxdb/influxdb.conf
Oct 08 18:55:00 axe1 influxd[860]: [I] 2019-10-08T10:55:00Z Authentication enabled:true service=httpd
Oct 08 18:55:00 axe1 influxd[860]: [I] 2019-10-08T10:55:00Z Listening on HTTP:[::]:8086 service=httpd
Oct 08 18:55:00 axe1 influxd[860]: [I] 2019-10-08T10:55:00Z Starting retention policy enforcement service with check interval of 30m0s service=retention
Oct 08 18:55:00 axe1 influxd[860]: [I] 2019-10-08T10:55:00Z Listening for signals
Oct 08 18:55:00 axe1 influxd[860]: [I] 2019-10-08T10:55:00Z Storing statistics in database '_internal' retention policy 'monitor', at interval 10s service=monitor
Oct 08 18:55:00 axe1 influxd[860]: [I] 2019-10-08T10:55:00Z Sending usage statistics to usage.influxdata.com
Oct 08 18:55:01 axe1 influxd[860]: [I] 2019-10-08T10:55:01Z beginning level 2 compaction of group 0, 1 TSM files engine=tsm1
Oct 08 18:55:01 axe1 influxd[860]: [I] 2019-10-08T10:55:01Z compacting level 2 group (0) /var/lib/influxdb/data/testdb/autogen/4/000000003-000000002.tsm (#0) engine=tsm1
Oct 08 18:55:01 axe1 influxd[860]: [I] 2019-10-08T10:55:01Z compacted level 2 1 files into 0 files in 2.012775ms engine=tsm1
Oct 08 18:55:20 axe1 influxd[860]: [I] 2019-10-08T10:55:20Z /var/lib/influxdb/data/_internal/monitor/10 database index loaded in 27.72µs service=shard
查看web页面
SHELL命令
链接shell
[root@axe1 ~]# influx
Connected to http://localhost:8086 version 1.2.4
InfluxDB shell version: 1.2.4
> auth
username: admin
password:
> show databases
name: databases
name
----
_internal
testdb
>
创建数据库
create database testdb
查看数据库
show databases
创建用户
--管理员用户
CREATE USER ... 一定要大写,否则会不识别
CREATE USER admin WITH PASSWORD 'admin' WITH ALL PRIVILEGES