Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to migrate from mysql to postgres service? #156

Open
iVegas opened this issue Dec 17, 2024 · 1 comment
Open

How to migrate from mysql to postgres service? #156

iVegas opened this issue Dec 17, 2024 · 1 comment

Comments

@iVegas
Copy link
Contributor

iVegas commented Dec 17, 2024

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?

@alpha0010
Copy link

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 via docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <the_container>
    • MYSQL_DSN looked like: root:<password>@tcp(<address>:3306)/mattermost
    • POSTGRES_DSN looked like: postgres://mattermost:<password>@<address>:5432/mattermost?sslmode=disable
    • pgloader always crashed until I edited migration.load to reduce values to: workers = 2, rows per range = 4000, prefetch rows = 4000, batch rows = 1000
    • I executed pgloader via: docker run -it --rm --network=host -v $(pwd):/home/migration mattermost/mattermost-pgloader:latest pgloader migration.load > migration.log
    • After running pgloader, I had to ALTER USER mattermost RESET SEARCH_PATH; within docker exec -it mattermost-postgres-1 psql mattermost
  • Once this was all complete, set up production MM with volumes/app/mattermost/data from your existing files data and volumes/db/postgres/data copied from the corresponding folder on the staging server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants