influxdb的消化

建了一个influxdb库开了一个“迷窟电力公司”,不知不觉已经过了一年多了,需要重新消化一下了,
经查证这个库是建立在一个docker下的,由python插库,grafana负责展示,进入命令行,

docker exec -it influxDbService bash

查询空间占用,Oct-7-2019开始的

root@9ef38c6e4a72:/var/lib/influxdb# du * -sh
68M     data
8.0K    meta
32M     wal

登录查询数据量,63万(631600)条,每分钟一提交

influx
>show databases
>use my_test
>show measurements
>select count(*) from db
>select * from db limit 5

web界面(未解决)

vi /etc/influxdb/influxdb.conf
[admin]
  enadbled=true
  bind-address=":8083"

问题查找,源于占用
service influxdb start
influxdb process was unable to start [ FAILED ]
cat /var/log/influxdb/influxd.log

数据备份与恢复
http://www.linuxdaxue.com/influxdb-backup-and-restore.html

1、库备份
influxd backup /tmp/backup
influxd backup -database my_test /tmp/backup
scp /tmp/backup/* user@192.168.1.1:~/backup

2、装软件
https://portal.influxdata.com/downloads/
wget https://dl.influxdata.com/influxdb/releases/influxdb2_2.0.3_amd64.deb
sudo dpkg -i influxdb2_2.0.3_amd64.deb
sudo service influxdb start
http://192.168.1.6:8086
user/12345678/test/temp

sudo dpkg -l influxdb2
sudo dpkg -r influxdb2(不删配置)
sudo dpkg --purge influxdb2(彻底)

wget https://dl.influxdata.com/influxdb/releases/influxdb_1.8.3_amd64.deb
sudo dpkg -i influxdb_1.8.3_amd64.deb
sudo service influxdb restart

3、恢复数据
https://www.cnblogs.com/zihanxing/p/7405414.html

influxd restore -metadir /var/lib/influxdb/meta/ ~/influx_db_backup
influxd restore -database my_test -datadir ~/influxdb/data ~/backup

sudo chown -R influxdb:influxdb /var/lib/influxdb

4、入新库
5、用新库
6、狗入库(mqtt、influxdb)

标签: none

添加新评论