orientechnologies / orientdb-docker

OrientDB running in a docker container
MIT License
63 stars 63 forks source link

Unable to restore backups from console inside container #33

Closed 33Fraise33 closed 6 years ago

33Fraise33 commented 6 years ago

Hello,

I'm running orient inside a docker container. I enabled automatic backups and I want to try and restore a backup.

The problem is when I'm trying to restore the backup the file is not found: ./bin/backup/20171109084000.zip (No such file or directory)

When I connect to the console and I enter pwd I get /orientdb. So when I connect to the docker container through a shell (sudo docker exec -i -t <container id> /bin/sh) and I navigate to the /orientdb/bin/backup folder, the file is there. I tried many other file locations but none seems to work.

Is this an issue with orient in docker or orient itself?

33Fraise33 commented 6 years ago

Can it be confirmed this is a bug? I don't want to put Orient to production without being sure I can restore a backup.

robfrank commented 6 years ago

are you providing a volume to the container where to persist backups?

33Fraise33 commented 6 years ago

Yes I am, I'm starting my docker container with ansible, my config is the following:

- name: setup orient docker container
  docker_container:
    name: orientdb
    image: orientdb:latest
    command: "/orientdb/bin/server.sh -Ddistributed=false"
    published_ports:
      - 2424:2424
      - 2480:2480
    network_mode: host
    volumes:
      - "/orientdb/config:/orientdb/config"
      - "/orientdb/databases:/orientdb/databases"
      - "/orientdb/backup:/orientdb/bin/backup"
    env:
      ORIENTDB_ROOT_PASSWORD: "<password here>"
      ORIENTDB_NODE_NAME: "{{ ansible_hostname }}"
      ORIENTDB_OPTS_MEMORY: "-Xms20G -Xmx20G"
    recreate: yes
    state: started

I had to change my mounting point for backups as the default as provided in the docs /orientdb/backup is not used for automated backups, /orientdb/bin/backup is.

33Fraise33 commented 6 years ago

Any update on this? Can I provide more information?

33Fraise33 commented 6 years ago

@robfrank Can I help any further with this? I'm not a docker expert but it's very odd behaviour though.

cuvelierm commented 6 years ago

Any updates on this? I am having the same problem currently.

33Fraise33 commented 6 years ago

I've been able to resolve this issue with the following commands.

To restore a backup, make sure your docker container is turned off. You will have to connect plocal to the database. Mount the volumes with the run command (as the server is not turned on you cannot use the docker exec method)

sudo docker run --rm -it -v /orientdb/databases:/orientdb/databases -v /orientdb/backup:/orientdb/bin/backup orientdb:<version tag> /orientdb/bin/console.sh

Now your container has access to the backup files while your actual container is turned off. Connect plocal: CONNECT plocal:/orientdb/databases/<dbname> Restore the database: RESTORE DATABASE /orientdb/bin/backup/<filename>.zip