Mattermost, Inc.

Migrating mattermost database to new mattermost server

I have this turnkeylinux mattermost instance setup a vm. I had no idea how anything works in it in case I wanted to play around with or install plugins or anything. So I decided to install it again from scratch on a new vm. I Installed it and then want to copy all the users, teams, infomrations…
I am using postgresql on both VMs. I copied the data file found in /opt/mattermost and the database. And granted privilege to the user but it felt that mattermost was still using the old database so I deleted it and renamed the new one the same as the old one. now whenever I start mattermost server with sudo systemctl start mattermost, doesn’t start. Nginx is fine. when I open journalctl -xe this is some of the output
Apr 16 11:05:23 mattermost platform[22665]: [2018/04/16 11:05:23 -03] [INFO] Pinging SQL master database
Apr 16 11:05:23 mattermost platform[22665]: [2018/04/16 11:05:23 -03] [CRIT] SqlSystemStore.SaveOrUpdate: We encountered an error saving the system property,
Apr 16 11:05:24 mattermost systemd[1]: mattermost.service: Main process exited, code=exited, status=233/RUNTIME_DIRECTORY
Apr 16 11:05:24 mattermost systemd[1]: Failed to start Mattermost.
– Subject: Unit mattermost.service has failed
– Defined-By: systemd
– Support: https://www.debian.org/support

– Unit mattermost.service has failed.

– The result is failed.
Apr 16 11:05:24 mattermost systemd[1]: mattermost.service: Unit entered failed state.
Apr 16 11:05:24 mattermost systemd[1]: mattermost.service: Failed with result ‘exit-code’.
Apr 16 11:05:34 mattermost systemd[1]: mattermost.service: Service hold-off time over, scheduling restart.
Apr 16 11:05:34 mattermost systemd[1]: Stopped Mattermost.
– Subject: Unit mattermost.service has finished shutting down
– Defined-By: systemd
– Support: https://www.debian.org/support

– Unit mattermost.service has finished shutting down.
Apr 16 11:05:34 mattermost systemd[1]: mattermost.service: Failed to reset devices.list: Operation not permitted
Apr 16 11:05:34 mattermost systemd[1]: Starting Mattermost…
– Subject: Unit mattermost.service has begun start-up
– Defined-By: systemd
– Support: https://www.debian.org/support

– Unit mattermost.service has begun starting up.
Apr 16 11:05:35 mattermost platform[22673]: [2018/04/16 11:05:35 -03] [INFO] Loaded system translations for ‘en’ from ‘/opt/mattermost/i18n/en.json’
Apr 16 11:05:35 mattermost platform[22673]: [2018/04/16 11:05:35 -03] [INFO] Server is initializing…
Apr 16 11:05:35 mattermost platform[22673]: [2018/04/16 11:05:35 -03] [INFO] Pinging SQL master database
Apr 16 11:05:35 mattermost platform[22673]: [2018/04/16 11:05:35 -03] [CRIT] SqlSystemStore.SaveOrUpdate: We encountered an error saving the system property,
Apr 16 11:05:36 mattermost systemd[1]: mattermost.service: Main process exited, code=exited, status=233/RUNTIME_DIRECTORY
Apr 16 11:05:36 mattermost systemd[1]: Failed to start Mattermost.
– Subject: Unit mattermost.service has failed
– Defined-By: systemd
– Support: https://www.debian.org/support

– Unit mattermost.service has failed.

Hi @rony94,

You might find some help in these docs.

I did follow them when installing mattermost

Thanks for your feedback @rony94,

I’ll ask our engineers to help troubleshoot…

Hi, @rony94!

The key error here seems to be:

Apr 16 11:05:35 mattermost platform[22673]: [2018/04/16 11:05:35 -03] [CRIT] SqlSystemStore.SaveOrUpdate: We encountered an error saving the system property,

Unfortunately, it seems like it’s truncated. Can you enable logging to a file, and see if there is more context to the error? I would also recommend enabling "FileLevel": "DEBUG" while you’re in there.

@jesse @rony94 I’m also getting this on 14.04 with Postgres 9.3. I’ve tried logging to a file but there’s no additional context. Tried upgrading my 3.3 instance to both 4.7.4 and latest stable with no luck on either.

Not sure how to post the outputs, they are too big

@rony94, you can filter down the file to just the context around the critical error, e.g.:

cat file.log | grep -C10 CRIT

Hopefully that’s small enough to easily post.

Going to laugh myself out of the room here: I was trying to run the enterprise version of 4.x and it was failing silently. Even running 3.x was failing silently.

I was trying to run it because I copied the first command I saw on the releases page, and it wasn’t clear that it was the enterprise version from the file name, because like most people, I just skim things.

Can I recommend changing the formatting of the file names so that it’s clear when there’s an enterprise version being installed, instead of defaulting to the enterprise file name? Instead of mattermost-4.9.0-linux-amd64.tar.gz being enterprise, can mattermost-enterprise-4.9.0-linux-amd64.tar.gz be enterprise, and mattermost-4.9.0-linux-amd64.tar.gz be team?

I ended up just reverting to 3.5 for the time being.

cat mattermost.log | grep -C10 CRIT

The output is the longest thing I’ve ever seen, but at the end it’s pretty much the same

[2018/04/24 15:35:28 -03] [INFO] Server is initializing...
[2018/04/24 15:35:28 -03] [DEBG] Parsing server templates at /opt/mattermost/templates/
[2018/04/24 15:35:28 -03] [INFO] Pinging SQL master database
[2018/04/24 15:35:28 -03] [CRIT] SqlSystemStore.SaveOrUpdate: We encountered an error saving the system property,
[2018/04/24 15:35:40 -03] [INFO] Loaded system translations for 'en' from '/opt/mattermost/i18n/en.json'
[2018/04/24 15:35:40 -03] [INFO] Server is initializing...
[2018/04/24 15:35:40 -03] [DEBG] Parsing server templates at /opt/mattermost/templates/
[2018/04/24 15:35:40 -03] [INFO] Pinging SQL master database
[2018/04/24 15:35:40 -03] [CRIT] SqlSystemStore.SaveOrUpdate: We encountered an error saving the system property,

I feel that I just migrated the database and the data file badly,
maybe get a guidance through the process again.
migrating data file and database from one VM to another. Plus the VM where I am migrating from has the database and mattermost there, but the new installation of mattermost is seperated in two VMs one for mattermost and one for the database

what does /opt/mattermost/bin/platform -version return?

an error :stuck_out_tongue:
.opt/mattermost/bin/platform version return this though
panic: Unable to find i18n directory

goroutine 1 [running]:
main.initDBCommandContextCobra(0x24349a0, 0xc4201d7ca0, 0x0, 0x0)
        /var/lib/jenkins/jobs/msr/jobs/d/jobs/enterprise-release/workspace/src/github.com/mattermost/mattermost-server/cmd/platform/init.go:22 +0xe2
main.versionCmdF(0x24349a0, 0x246aa78, 0x0, 0x0, 0x0, 0x0)
        /var/lib/jenkins/jobs/msr/jobs/d/jobs/enterprise-release/workspace/src/github.com/mattermost/mattermost-server/cmd/platform/version.go:20 +0x2b
github.com/mattermost/mattermost-server/vendor/github.com/spf13/cobra.(*Command).execute(0x24349a0, 0x246aa78, 0x0, 0x0, 0x24349a0, 0x246aa78)
        /var/lib/jenkins/jobs/msr/jobs/d/jobs/enterprise-release/workspace/src/github.com/mattermost/mattermost-server/vendor/github.com/spf13/cobra/command.go:753 +0x475
github.com/mattermost/mattermost-server/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x2438040, 0x2433b60, 0x2433dc0, 0xc4201d7f70)
        /var/lib/jenkins/jobs/msr/jobs/d/jobs/enterprise-release/workspace/src/github.com/mattermost/mattermost-server/vendor/github.com/spf13/cobra/command.go:843 +0x334
github.com/mattermost/mattermost-server/vendor/github.com/spf13/cobra.(*Command).Execute(0x2438040, 0xc420000180, 0x10f207c)
        /var/lib/jenkins/jobs/msr/jobs/d/jobs/enterprise-release/workspace/src/github.com/mattermost/mattermost-server/vendor/github.com/spf13/cobra/command.go:791 +0x2b
main.main()
        /var/lib/jenkins/jobs/msr/jobs/d/jobs/enterprise-release/workspace/src/github.com/mattermost/mattermost-server/cmd/platform/mattermost.go:34 +0x2d

I’m a mere outsider but that tells me that you’re onto something! Does ls /opt/mattermost/i18n/en.json return an error as well? (I’m assuming it’s installed there at least)

anecdotally, I’m not sure if the enterprise release is what you want, or if that trace is relevant at all to having the correct version…

no it’s there. Weird no ? in both VMs same things

I followed this
cd /opt/mattermost/bin
sudo ./platform version

and got this output in the Vm i am migrating from:
Version: 4.7.1
Build Number: 4.7.2
Build Date: Fri Feb 23 01:23:46 UTC 2018
Build Hash: 659ce8c60012a7d5fd597997b1794ac512b3b155
Build Enterprise Ready: false
DB Version: 4.7.1

But got this error in the VM I am migrating to:
[2018/04/24 16:04:19 -03] [INFO] Loaded system translations for ‘en’ from ‘/opt/mattermost/i18n/en.json’
[2018/04/24 16:04:19 -03] [INFO] Server is initializing…
[2018/04/24 16:04:19 -03] [INFO] Pinging SQL master database
[2018/04/24 16:04:20 -03] [CRIT] SqlSystemStore.SaveOrUpdate: We encountered an error saving the system property,

the same error from the log file

Looking at the mattermost-server source code, it seems like the log message indeed obscures the underlying error here, for reasons I can’t immediately explain. That’s something I’ll look into separately.

Are you able to examine your database server logs to see the query being run and perhaps any associated errors? Let me know if you’re running MySQL or PostgreSQL and I may be able to help you track this down.

I am using postgresql, appreciate any help thank you

Can you try enabling the logging_collector setting on your Postgres instance? Here’s a tutorial on how to find your configuration file and what fields to set: https://chartio.com/resources/tutorials/how-to-log-queries-in-postgresql/.

With that feature enabled, restart your Mattermost service, and you should have a more detailed log that we can use to track this problem down.