Issue Summary

I need some guidance with migrating to a new server for Redash, and go from v4 to v7 in the process.

Technical details:

  • Redash Version: 4 and 7
  • Browser/OS: Chrome
  • How did you install Redash: Script and Container

I have the means to connect to the v4 database from the v7 database, is there a clean way to bring the data across? I can script up a bunch of “insert into … select from …”.

As this is a relational database, it will be critical to ensure referential integrity, sequence numbers, additional columns, etc.

Any help greatly appreciated.

Hi @chris1,

I understand you are using Docker. Did you visit this page :

The process was ok for me.
Another discussion about migration from standalone install to Docker install ans upgrade here :

Thanks Mathieu, some good advice there, so I’ll see if I can get v4 into the docker host, import the pgsql dump, then step through each upgrade to v7. Sounds do-able.

1 Like

OK, for those interested, here is a brief overview of how I went from tarball Redash v4 on Ubuntu to Redash v4 in containers on CentOS. I’m working with Redash 4.0.1.b4038.

  • Provisioned CentOS 7, added /var/lib/docker as an LVM mount point, then installed docker-ce
  • Follow the guides above, using local redash user to create “env” and “docker-compose.yml” files
  • Local redash user is empowered for docker admin actions
  • Identify the version of postgres on the source host (Ubuntu had updates, so mine was 9.5.19)
  • Edit docker-compose.yml set postgres version to match
  • I don’t have have direct internet, so I specify web proxy in ~/.docker/config.jso
  • Next, I’m running the docker-compose commands to bring up the containers
  • On the source host, as postgres, export data: pg_dump -Fc postgres > /tmp/postgres.dmp
  • Copy compressed dumpfile to target host using SCP, make it world readable
  • As redash on the target host, identify postgres container name: docker ps
  • Identify data destination: docker inspect -f ‘{{ json .Mounts }}’ redash_postgres_1 | python -m json.tool
  • Copy dumpfile there: docker cp /tmp/postgres.dmp redash_postgres_1:/var/lib/postgresql/data/
  • Open postgres container bash shell: docker exec -it redash_postgres_1 bash
  • Import replacing: pg_restore -U postgres -d postgres -c /var/lib/postgresql/data/postgres.dmp
  • Verify: psql -U postgres -c “select count(*) from dashboards”
  • Verify new server Redash URL content matches source Redash URL, check dashboards

Now the new container environment is Redash v4 with the same data as the original host. This should pave the way for upgrades to version 7.

1 Like

I worked my way through the upgrades to the latest 7.0.0.b18042 today using the docker actions as shown in the upgrade guide. A few notes that may be of interest to others:

  • I grabbed the latest setup/docker-compose.yml
  • Environment variables move out of my old docker-compose.yml and into the env file
  • Ensure correct postgres version and data mapping in docker-compose.yml
  • Firewall rules are added when recreating workers, ensure iptables/firewalld is up
  • One upgrade at a time
    End result, success. Thank you Redash team, brilliant work.
2 Likes

@chris1 Thanks for the detailed instruction. I need to upgrade my Redash (Bitnami) to Docker version. But my postgres dump size is around 4GB and OI couldn’t restore it. Do you have something is mind regarding my issue?

Hi and sorry for a late reply. This is what I did, starting on the old host,

$ pg_dump -Fc postgres > /tmp/postgres.dmp

$ scp /tmp/postgres.dmp me@newhost:/tmp/

On the new host as the redash user, identify storage for pg, move the dumpfile,

$ PGCON=docker ps | grep -i postg | awk '{print $NF}'
$ docker inspect -f ‘{{ json .Mounts }}’ $PGCON | python -m json.tool

$ docker cp /tmp/postgres.dmp $PGCON:/var/lib/postgresql/data/

Now get a shell on the pg container, import data,

$ docker exec -it $PGCON bash

$ ls -l /var/lib/postgresql/data/

$ pg_restore -U postgres -d postgres -c /var/lib/postgresql/data/postgres.dmp

$ psql -U postgres -c “select count(*) from dashboards”

Good luck :slight_smile:

2 Likes