我设置了一个家庭自动化系统,该系统将数据记录到 influxdb 中。我从与同一传感器相关的两个变量中获取了两个测量值。我想删除旧表并将旧数据从旧表迁移到新表。旧表“entity_id=node21_child04”,新表“entity_id=node21samsung_21_4”。我在 influxdb 数据库中有以下数据条目:
> show series;
key
---
C,domain=sensor,entity_id=node21_child04
°C,domain=sensor,entity_id=node21samsung_21_4
查看内容,提取一些数据,我得到以下结果:旧表:
> SELECT * FROM "autogen"."°C" WHERE ("entity_id" = 'node21samsung_21_4') AND time >= now() - 10m;
name: °C
time V_TEMP battery_level child_id description description_str device_str domain entity_id friendly_name friendly_name_str heartbeat icon_str node_id value
---- ------ ------------- -------- ----------- --------------- ---------- ------ --------- ------------- ----------------- --------- -------- ------- -----
1547484922088189952 9.3 0 4 11 Temperatura NORD (DHT11) mqtt sensor node21samsung_21_4 21214 node21Samsung 21 4 0 mdi:thermometer 21 9.3
1547485042146836992 9.4 0 4 11 Temperatura NORD (DHT11) mqtt sensor node21samsung_21_4 21214 node21Samsung 21 4 0 mdi:thermometer 21 9.4
1547485162424854016 9 0 4 11 Temperatura NORD (DHT11) mqtt sensor node21samsung_21_4 21214 node21Samsung 21 4 0 mdi:thermometer 21 9
1547485282887762176 8.7 0 4 11 Temperatura NORD (DHT11) mqtt sensor node21samsung_21_4 21214 node21Samsung 21 4 0 mdi:thermometer 21 8.7
新表:
> SELECT * FROM "autogen"."°C" WHERE ("entity_id" = 'node21samsung_21_4') AND time >= now() - 10m;
name: °C
time V_TEMP battery_level child_id description description_str device_str domain entity_id friendly_name friendly_name_str heartbeat icon_str node_id value
---- ------ ------------- -------- ----------- --------------- ---------- ------ --------- ------------- ----------------- --------- -------- ------- -----
1547484922088189952 9.3 0 4 11 Temperatura NORD (DHT11) mqtt sensor node21samsung_21_4 21214 node21Samsung 21 4 0 mdi:thermometer 21 9.3
1547485042146836992 9.4 0 4 11 Temperatura NORD (DHT11) mqtt sensor node21samsung_21_4 21214 node21Samsung 21 4 0 mdi:thermometer 21 9.4
1547485162424854016 9 0 4 11 Temperatura NORD (DHT11) mqtt sensor node21samsung_21_4 21214 node21Samsung 21 4 0 mdi:thermometer 21 9
1547485282887762176 8.7 0 4 11 Temperatura NORD (DHT11) mqtt sensor node21samsung_21_4 21214 node21Samsung 21 4 0 mdi:thermometer 21 8.7
我想将旧表中的值迁移到新表中。这样我就可以停止向旧表收集数据并将其删除。可以毫无问题地覆盖数据。如何做到这一点?
谢谢,西蒙