比如,将influx的数据存储目录改到/home路径下:
创建存储的 路径
1 |
|
将这3个目录的属主与群组都改为 influxdb
1 |
|
修改influxdb配置文件
停止 influxdb1
[root@localhost ~]# systemctl start influxdb.service
修改配置文件1
2
3
4
5
6
7
8
9
10
11[root@localhost ~]# vim /etc/influxdb/influxdb.conf
[meta]
#dir = "/var/lib/influxdb/meta" 把原先的注释掉
dir = "/home/influxdb/meta" 修改参数
[data]
#dir = "/var/lib/influxdb/data" 把原先的注释掉
dir = "/home/influxdb/data" 修改参数
#wal-dir = "/var/lib/influxdb/wal" 把原先的注释掉
wal-dir = "/home/influxdb/wal" 修改参数
验证influxdb可用性
启动 influxdb1
[root@localhost ~]# systemctl stop influxdb.service
查看 influxdb 进程1
[root@localhost ~]# ps -ef | grep -i influxdb
查看并删除 influxdb 历史数据1
2[root@localhost ~]# du -sh /var/lib/influxdb/
[root@localhost ~]# rm -rf /var/lib/influxdb/
验证 influx 可用性1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44[root@localhost ~]# influx
显示数据库
> show databases;
name: databases
name
----
opentsdb
_internal
>
使用数据库
> use opentsdb;
Using database opentsdb
显示已存在的表
> show measurements
netdata_23.system.ram.free
netdata_23.system.ram.used
netdata_23.mem.writeback.Writeback
netdata_23.mysql_local.binlog_cache.all
.
.
.(省略...)
查看表数据(注意使用双引号)
> select * from "netdata_23.system.ram.used";
name: netdata_23.system.ram.used
time host value
---- ---- -----
1541928659000000000 localhost.localdomain 21539.505
1541928669000000000 localhost.localdomain 21540.171
1541928679000000000 localhost.localdomain 21540.118
1541928689000000000 localhost.localdomain 21541.185
1541928699000000000 localhost.localdomain 21541.095
1541928709000000000 localhost.localdomain 21542.59
1541928719000000000 localhost.localdomain 21541.594
1541929169000000000 localhost.localdomain 21541.843
>
退出influx
> exit
[root@localhost ~]#
influxdb 可用性测试完成!