dockertarantool

How to recover Tarantool docker when computer crashed?


I got this when starting tarantool using docker compose:

tarantool_1  | Loading existing configuration file: /etc/tarantool/config.yml
tarantool_1  | Config:
tarantool_1  | ---
tarantool_1  | force_recovery: false
tarantool_1  | memtx_dir: /var/lib/tarantool
tarantool_1  | listen: 3301
tarantool_1  | pid_file: /var/run/tarantool/tarantool.pid
tarantool_1  | vinyl_dir: /var/lib/tarantool
tarantool_1  | wal_dir: /var/lib/tarantool
tarantool_1  | ...
tarantool_1  | 
tarantool_1  | 2021-01-25 15:36:42.907 [1] main/103/tarantool-entrypoint.lua C> Tarantool 2.7.1-0-g3ac498c9f
tarantool_1  | 2021-01-25 15:36:42.907 [1] main/103/tarantool-entrypoint.lua C> log level 5
nats_1       | [1] 2021/01/25 15:36:42.975913 [INF] Listening for route connections on 0.0.0.0:6222
tarantool_1  | 2021-01-25 15:36:42.908 [1] main/103/tarantool-entrypoint.lua I> mapping 268435456 bytes for memtx tuple arena...
tarantool_1  | 2021-01-25 15:36:42.908 [1] main/103/tarantool-entrypoint.lua I> Actual slab_alloc_factor calculated on the basis of desired slab_alloc_factor = 1.044274
tarantool_1  | 2021-01-25 15:36:42.908 [1] main/103/tarantool-entrypoint.lua I> mapping 134217728 bytes for vinyl tuple arena...
tarantool_1  | 2021-01-25 15:36:42.909 [1] main/103/tarantool-entrypoint.lua I> instance uuid 68029509-9446-40c2-a72e-a69079889474
tarantool_1  | 2021-01-25 15:36:42.909 [1] main/103/tarantool-entrypoint.lua xlog.c:1945 E> can't open tx: invalid magic: 0x0
tarantool_1  | 2021-01-25 15:36:42.909 [1] main/103/tarantool-entrypoint.lua I> instance vclock {0: 96622, 1: 16339245}
tarantool_1  | 2021-01-25 15:36:42.909 [1] iproto/101/main I> binary: bound to 0.0.0.0:3301
tarantool_1  | 2021-01-25 15:36:42.909 [1] main/103/tarantool-entrypoint.lua I> recovery start
tarantool_1  | 2021-01-25 15:36:42.909 [1] main/103/tarantool-entrypoint.lua I> recovering from `/var/lib/tarantool/00000000000016435825.snap'
tarantool_1  | 2021-01-25 15:36:42.910 [1] main/103/tarantool-entrypoint.lua I> cluster uuid a43303ee-232d-46d7-9ff2-9716f5b165ed
tarantool_1  | 2021-01-25 15:36:42.927 [1] main/103/tarantool-entrypoint.lua I> assigned id 1 to replica 68029509-9446-40c2-a72e-a69079889474
tarantool_1  | 2021-01-25 15:36:42.936 [1] main/103/tarantool-entrypoint.lua I> recover from `/var/lib/tarantool/00000000000016435825.xlog'
tarantool_1  | 2021-01-25 15:36:42.937 [1] main/103/tarantool-entrypoint.lua xlog.c:1625 E> XlogError: invalid magic: 0x0
tarantool_1  | 2021-01-25 15:36:42.937 [1] main/103/tarantool-entrypoint.lua F> can't initialize storage: invalid magic: 0x0
full_tarantool_1 exited with code 1

the docker-compose.yml

version: '2'
services:
  tarantool:
    image:  tarantool/tarantool:2.6.0
    ports:
      - 3301:3301
    volumes:
      - /var/local/foo/tarantool:/var/lib/tarantool

Is there a way to prevent this from happening in the future?


Solution

  • Try to use force_recovery_option (it could be passed via TARANTOOL_FORCE_RECOVERY env variable). Note that it's a dangerous option -backup your xlog/snap files before to be able to recover your data if my advice will be unsuccessful.