databaseinfluxdb

correct rebuild of tsm files in influxdb v1.8.10


The sdcard of my rpi got corrupted, but I have managed to save an influxdb v1.8.10 database called PMONITOR that was in it, namely wal and data directories, and I am now trying to restore it. The directories have this structure

├── data
│   ├── _internal
│   │   ├── monitor
│   │   └── _series
│   └── PMONITOR
│       ├── autogen
│       ├── rp_5min
│       └── _series
└── wal
    ├── _internal
    │   └── monitor
    └── PMONITOR
        ├── autogen
        └── rp_5min

Things I've tried:

pi@raspberry:data $ influx_inspect report-disk -detailed /var/lib/influxdb/data/

TSM files inspected: 56 /56                                                       
Completed in 309.892234ms
{
  "Summary": {"shards": 44, "tsm_files": 56, "total_tsm_size": 368815064 },
  "Shard": [
    {"db": "PMONITOR", "rp": "autogen", "shard": "108", "tsm_files": 1, "size": 67672903},
    {"db": "PMONITOR", "rp": "autogen", "shard": "117", "tsm_files": 1, "size": 67856157},
    {"db": "PMONITOR", "rp": "autogen", "shard": "126", "tsm_files": 7, "size": 70889925},
    {"db": "PMONITOR", "rp": "autogen", "shard": "2", "tsm_files": 1, "size": 330726},
    {"db": "PMONITOR", "rp": "autogen", "shard": "90", "tsm_files": 1, "size": 67540780},
    {"db": "PMONITOR", "rp": "autogen", "shard": "99", "tsm_files": 1, "size": 67304567},
    {"db": "PMONITOR", "rp": "rp_5min", "shard": "100", "tsm_files": 1, "size": 139648},
    {"db": "PMONITOR", "rp": "rp_5min", "shard": "109", "tsm_files": 1, "size": 142547},
    {"db": "PMONITOR", "rp": "rp_5min", "shard": "118", "tsm_files": 1, "size": 145675},
    {"db": "PMONITOR", "rp": "rp_5min", "shard": "127", "tsm_files": 2, "size": 251610},
    {"db": "PMONITOR", "rp": "rp_5min", "shard": "3", "tsm_files": 1, "size": 2052},
    {"db": "PMONITOR", "rp": "rp_5min", "shard": "30", "tsm_files": 1, "size": 117039},
    {"db": "PMONITOR", "rp": "rp_5min", "shard": "31", "tsm_files": 1, "size": 139689},
    {"db": "PMONITOR", "rp": "rp_5min", "shard": "32", "tsm_files": 1, "size": 142861},
    {"db": "PMONITOR", "rp": "rp_5min", "shard": "33", "tsm_files": 1, "size": 143012},
    {"db": "PMONITOR", "rp": "rp_5min", "shard": "34", "tsm_files": 1, "size": 93983},
    {"db": "PMONITOR", "rp": "rp_5min", "shard": "35", "tsm_files": 1, "size": 117782},
    {"db": "PMONITOR", "rp": "rp_5min", "shard": "36", "tsm_files": 1, "size": 49610},
    {"db": "PMONITOR", "rp": "rp_5min", "shard": "37", "tsm_files": 1, "size": 142853},
    {"db": "PMONITOR", "rp": "rp_5min", "shard": "38", "tsm_files": 1, "size": 87117},
    {"db": "PMONITOR", "rp": "rp_5min", "shard": "39", "tsm_files": 1, "size": 24564},
    {"db": "PMONITOR", "rp": "rp_5min", "shard": "40", "tsm_files": 1, "size": 142845},
    {"db": "PMONITOR", "rp": "rp_5min", "shard": "41", "tsm_files": 1, "size": 142057},
    {"db": "PMONITOR", "rp": "rp_5min", "shard": "42", "tsm_files": 1, "size": 118335},
    {"db": "PMONITOR", "rp": "rp_5min", "shard": "43", "tsm_files": 1, "size": 71128},
    {"db": "PMONITOR", "rp": "rp_5min", "shard": "44", "tsm_files": 1, "size": 139573},
    {"db": "PMONITOR", "rp": "rp_5min", "shard": "45", "tsm_files": 1, "size": 125856},
    {"db": "PMONITOR", "rp": "rp_5min", "shard": "46", "tsm_files": 1, "size": 146120},
    {"db": "PMONITOR", "rp": "rp_5min", "shard": "47", "tsm_files": 1, "size": 134778},
    {"db": "PMONITOR", "rp": "rp_5min", "shard": "48", "tsm_files": 1, "size": 124801},
    {"db": "PMONITOR", "rp": "rp_5min", "shard": "55", "tsm_files": 1, "size": 139256},
    {"db": "PMONITOR", "rp": "rp_5min", "shard": "64", "tsm_files": 1, "size": 140839},
    {"db": "PMONITOR", "rp": "rp_5min", "shard": "73", "tsm_files": 1, "size": 142457},
    {"db": "PMONITOR", "rp": "rp_5min", "shard": "82", "tsm_files": 1, "size": 139642},
    {"db": "PMONITOR", "rp": "rp_5min", "shard": "91", "tsm_files": 1, "size": 140752},
    {"db": "_internal", "rp": "monitor", "shard": "1", "tsm_files": 1, "size": 1686644},
    {"db": "_internal", "rp": "monitor", "shard": "124", "tsm_files": 1, "size": 2467841},
    {"db": "_internal", "rp": "monitor", "shard": "125", "tsm_files": 1, "size": 2559449},
    {"db": "_internal", "rp": "monitor", "shard": "128", "tsm_files": 1, "size": 2554670},
    {"db": "_internal", "rp": "monitor", "shard": "129", "tsm_files": 1, "size": 2532634},
    {"db": "_internal", "rp": "monitor", "shard": "130", "tsm_files": 1, "size": 2509434},
    {"db": "_internal", "rp": "monitor", "shard": "131", "tsm_files": 1, "size": 2515246},
    {"db": "_internal", "rp": "monitor", "shard": "132", "tsm_files": 1, "size": 2516027},
    {"db": "_internal", "rp": "monitor", "shard": "133", "tsm_files": 6, "size": 4289580}
  ],
  "Measurement": [
    {"db": "PMONITOR", "rp": "autogen", "measurement": "home_load", "size": 80371795},
    {"db": "PMONITOR", "rp": "autogen", "measurement": "net", "size": 80371795},
    {"db": "PMONITOR", "rp": "autogen", "measurement": "raw_cts", "size": 119970973},
    {"db": "PMONITOR", "rp": "autogen", "measurement": "solar", "size": 22018611},
    {"db": "PMONITOR", "rp": "autogen", "measurement": "voltages", "size": 37348580},
    {"db": "PMONITOR", "rp": "rp_5min", "measurement": "ct6_energy_5m", "size": 375616},
    {"db": "PMONITOR", "rp": "rp_5min", "measurement": "ct6_power_5m", "size": 790396},
    {"db": "PMONITOR", "rp": "rp_5min", "measurement": "home_energy_5m", "size": 384297},
    {"db": "PMONITOR", "rp": "rp_5min", "measurement": "home_load_5m", "size": 790951},
    {"db": "PMONITOR", "rp": "rp_5min", "measurement": "net_energy_5m", "size": 375683},
    {"db": "PMONITOR", "rp": "rp_5min", "measurement": "net_power_5m", "size": 790733},
    {"db": "PMONITOR", "rp": "rp_5min", "measurement": "solar_energy_5m", "size": 15473},
    {"db": "PMONITOR", "rp": "rp_5min", "measurement": "solar_power_5m", "size": 30946},
    {"db": "_internal", "rp": "monitor", "measurement": "cq", "size": 38770},
    {"db": "_internal", "rp": "monitor", "measurement": "database", "size": 10640},
    {"db": "_internal", "rp": "monitor", "measurement": "httpd", "size": 990873},
    {"db": "_internal", "rp": "monitor", "measurement": "queryExecutor", "size": 139433},
    {"db": "_internal", "rp": "monitor", "measurement": "runtime", "size": 2130221},
    {"db": "_internal", "rp": "monitor", "measurement": "shard", "size": 1743262},
    {"db": "_internal", "rp": "monitor", "measurement": "subscriber", "size": 6615},
    {"db": "_internal", "rp": "monitor", "measurement": "tsm1_cache", "size": 1671003},
    {"db": "_internal", "rp": "monitor", "measurement": "tsm1_engine", "size": 2676895},
    {"db": "_internal", "rp": "monitor", "measurement": "tsm1_filestore", "size": 210338},
    {"db": "_internal", "rp": "monitor", "measurement": "tsm1_wal", "size": 795882},
    {"db": "_internal", "rp": "monitor", "measurement": "write", "size": 305234}
  ]
}

Any other suggestions or things to try? Thanks in advance for any tip.


Solution

  • I have been able to solve it. Credit should be given to the person in this post

    In essence the two key magic commands are

    
    influx_inspect export -database dbname -datadir path -waldir path -out exportfile.txt
    influx -import -path=exportfile.txt