docker
docker copied to clipboard
How to migrate from mysql to postgres service?
Mattermost 11 will support only Postgres databases. This repo used MySQL database before Mattermost 10. Will there be any additional compose file provided for the example of the migration process?
I ran through a similar process recently (native install+mysql -> docker install+postgres). Here are some notes from my process in case they help.
- Copy production mysql data dir to staging server
- On the staging server, start
docker run -v ./mysql_data:/var/lib/mysql -d mysql:<version> --default-authentication-plugin=mysql_native_password - Create a throwaway blank staging MM https://docs.mattermost.com/install/install-docker.html
- Mostly follow https://docs.mattermost.com/deploy/postgres-migration-assist-tool.html , but with the following tweaks
<address>in the following two steps found viadocker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <the_container>MYSQL_DSNlooked like:root:<password>@tcp(<address>:3306)/mattermostPOSTGRES_DSNlooked like:postgres://mattermost:<password>@<address>:5432/mattermost?sslmode=disablepgloaderalways crashed until I editedmigration.loadto reduce values to:workers = 2, rows per range = 4000, prefetch rows = 4000, batch rows = 1000- I executed
pgloadervia:docker run -it --rm --network=host -v $(pwd):/home/migration mattermost/mattermost-pgloader:latest pgloader migration.load > migration.log - After running
pgloader, I had toALTER USER mattermost RESET SEARCH_PATH;withindocker exec -it mattermost-postgres-1 psql mattermost
- Once this was all complete, set up production MM with
volumes/app/mattermost/datafrom your existing files data andvolumes/db/postgres/datacopied from the corresponding folder on the staging server