To move the Postgres DB, get a shell into the PostgreSQL container running on your instance. Use psql
to make a backup of the DB. This can be done while the postgres server is running.
docker ps | grep postgres # Use this to find the container ID
docker exec -it 058d8f344e05 pg_dump -U postgres thingsboard > /var/lib/postgresql/data/thingsboard.sql.bak
Then, put that somewhere safe.
scp /mnt/data/thingsboard-pe/tb-node/postgres/thingsboard.sql.bak wilnil@somewheresafe.example.com:~/
Stop the instance, and just copy the entire dir somewhere safe.
docker-compose down
scp /mnt/data/thingsboard-pe/tb-node/cassandra wilnil@somewheresafe.example.com:~/
Use psql
to restore the dump.
Copy the whole cassandra directory to the new instance
scp -r ~/cassandra thingsboard@newinstance.example.com:/var/lib/cassandra