Migration to 4.0

Victor Ferreira6 years ago

I have a working installations of the 3.7 version of traccar and I was planning to migrate over to the 4.0. I don't have any modifications on the Traccar server, just some a few changes on the front-end, only small aesthetics things. So I downloaded a dump of the database and started tried a fresh install on a VM. But the new version to Traccar refuses to connect to my database after I've imported the data. I know in this new version the tables name were changed to avoid naming conflicts, but I thought that the migration would happen automatically. Did anyone have any problems with this?

I just followed the instructions on the documentation (https://www.traccar.org/install-digitalocean/) like I have done in the past, but it dind't work in my case. Does anyone have any idea what it might be the cause of the issue?

Anton Tananaev6 years ago

Migration happens automatically. If it doesn't, you probably messed up with default config.

Victor Ferreira6 years ago

That seems unlikely. When I did the fresh install, all worked great, so I did the following steps on this exact order:

  1. stopped traccar daemon: /opt/traccar/bin/stopDaemon.sh
  2. dropped the database: echo "drop database traccar" | mysql -u root -p
  3. recreated the database: echo "create database traccar" | mysql -u root -p
  4. imported the database dump: mysql -u root -p traccar < dump.sql
  5. restarted the daemon: /opt/traccar/bin/startDaemon.sh

Here's the log when I run tail -f /opt/traccar/logs/wrapper.log.*

==> /opt/traccar/logs/wrapper.log.20180817 <==
FINEST|7920/0|Service traccar|18-08-17 05:03:52|	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2530)
FINEST|7920/0|Service traccar|18-08-17 05:03:52|	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2683)
FINEST|7920/0|Service traccar|18-08-17 05:03:52|	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2482)
FINEST|7920/0|Service traccar|18-08-17 05:03:52|	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2440)
FINEST|7920/0|Service traccar|18-08-17 05:03:52|	at com.mysql.jdbc.StatementImpl.executeInternal(StatementImpl.java:845)
FINEST|7920/0|Service traccar|18-08-17 05:03:52|	at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:745)
FINEST|7920/0|Service traccar|18-08-17 05:03:52|	at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:352)
FINEST|7920/0|Service traccar|18-08-17 05:03:52|	... 20 more
INFO|wrapper|Service traccar|18-08-17 05:03:52|waitpid 7920 59136
INFO|wrapper|Service traccar|18-08-17 05:03:52|exit code posix process: 59136 application(status/signal): 231/0

==> /opt/traccar/logs/wrapper.log.20180817.lck <==
Luke Crooks6 years ago

When re-installed traccar did you copy your custom traccar.xml back into the root folder? It will be replaced by an empty one if you don't, then traccar won't know where to point the database connection.

Victor Ferreira6 years ago

@Luke, I didn’t reinstall traçar, just imported the data into MySQL.

All the config is still in place and working as expected, but when I try to reconnect, I get the error that is in the logs I posted earlier.

Vitor Reis6 years ago

Hello @Anton I'm also really interested on this topic.

Victor Ferreira6 years ago

To collect more information I decided to do a fresh install using the 3.17 version of traccar, since is the same version I'm running in production.

  1. I followed the instructions on the documentation (https://www.traccar.org/install-digitalocean/) and got everything up and running.
  2. Did the same process I described earlier: stop traccar, drop the db, create the db again, import the data and restart traccar.

Now everything works as expected, which indicates that is not a problem with the config. Somehow the migration process is not working as expected.

Does anyone have any idea what could be happening?

Anton Tananaev6 years ago

Upgrade procedure hasn't changed:

https://www.traccar.org/upgrading-traccar/