是否有从数据库(或数据库本身)导出数据的方法(插件或工具)?我正在寻找这个功能,因为我需要迁移一个数据库从目前的主机到另一个。
发布于 2015-01-13 09:27:28
您可以转储每个表,并通过REST接口加载它们:
curl "http://hosta:8086/db/dbname/series?u=root&p=root&q=select%20*%20from%20series_name%3B" > series_name.json
curl -XPOST -d @series_name.json "http://hostb:8086/db/dbname/series?u=root&p=root"
或者,您可能想要向集群中添加新主机?这很简单,而且你会免费得到master-master副本。Cluster Setup
发布于 2016-10-08 01:48:56
导出数据:
sudo service influxdb start (Or leave this step if service is already running)
influxd backup -database grpcdb /opt/data
grpcdb是DB的名称,在这种情况下,备份将保存在/opt/data目录下。
导入数据:
sudo service influxdb stop (Service should not be running)
influxd restore -metadir /var/lib/influxdb/meta /opt/data
influxd restore -database grpcdb -datadir /var/lib/influxdb/data /opt/data
sudo service influxdb start
发布于 2015-03-03 11:30:34
正如ezotrank所说,您可以转储每个表。不过,ezotrank的答案中遗漏了一个"-d“。它应该是:
curl "http://hosta:8086/db/dbname/series?u=root&p=root&q=select%20*%20from%20series_name%3B" > series_name.json
curl -XPOST -d @series_name.json "http://hostb:8086/db/dbname/series?u=root&p=root"
(Ezotrank,对不起,我会直接对你的回答发表评论,但我还没有足够的名誉点来这么做。)
https://stackoverflow.com/questions/27779472
复制相似问题