今天来点简单的
InfluxDB安装
首先老规矩,官网
[root@hadoop004 software]# cat <<EOF | sudo tee /etc/yum.repos.d/influxdb.repo
> [influxdb]
> name = InfluxDB Repository - RHEL \$releasever
> baseurl = https://repos.influxdata.com/rhel/\$releasever/\$basearch/stable
> enabled = 1
> gpgcheck = 1
> gpgkey = https://repos.influxdata.com/influxdb.key
> EOF
[influxdb]
name = InfluxDB Repository - RHEL $releasever
baseurl = https://repos.influxdata.com/rhel/$releasever/$basearch/stable
enabled = 1
gpgcheck = 1
gpgkey = https://repos.influxdata.com/influxdb.key
[root@hadoop004 software]# yum install influxdb
安装成功!!!
InfluxDB使用
启动InfluxDB
[root@hadoop004 bin]# systemctl start influxdb
这里会发生一个诡异的现象,程序启动不久,马上又挂掉了。
解决方案
启动之前先修改配置文件
[root@hadoop004 bin]# vim /etc/influxdb/influxdb.conf
bind-address = "127.0.0.1:8009"
默认是绑定的8088端口,但是我的8088端口已经被占用了,不然当InfluxDB启动之后,很快就又宕掉了。
启动 influx
command line interface (CLI)
[root@hadoop004 app]# influx -precision rfc3339
Connected to http://localhost:8086 version 1.7.7
InfluxDB shell version: 1.7.7
相关名词解释
创建数据库
> CREATE DATABASE hello
> SHOW DATABASES
name: databases
name
----
_internal
hello
> INSERT cpu,host=serverA,region=us_west value=0.64
> SELECT "host", "region", "value" FROM "cpu"
name: cpu
time host region value
---- ---- ------ -----
2019-07-08T07:23:50.876862275Z serverA us_west 0.64
> INSERT temperature,machine=unit42,type=assembly external=25,internal=37
> SELECT * FROM "temperature"
name: temperature
time external internal machine type
---- -------- -------- ------- ----
2019-07-08T07:27:08.33463649Z 25 37 unit42 assembly
至此,InfluxDB的安装和使用就完成了,下一步就是InfluxDB和Grafana的整合使用,敬请期待!!!