Switching to Postgres

Exie8 months ago

Hi Folks,

I've been running Traccar for a bit now on the internal H2 and its working great, but now want to switch to Postgres.

No worried about keeping old data, so I've followed the guide and configured the connection, I also threw in the Postgres JDBC JAR, the server starts, but it doesn't initialise the DB with all the tables and such.

2023-09-18 09:57:51  INFO: Operating system name: Linux version: 4.15.0-159-generic architecture: amd64
2023-09-18 09:57:51  INFO: Java runtime name: OpenJDK 64-Bit Server VM vendor: Alpine version: 11.0.20+8-alpine-r0
2023-09-18 09:57:51  INFO: Memory limit heap: 1024mb non-heap: 0mb
2023-09-18 09:57:51  INFO: Character encoding: UTF-8 charset: UTF-8
2023-09-18 09:57:51  INFO: Version: 5.9
2023-09-18 09:57:51  INFO: Starting server...
2023-09-18 09:57:52  INFO: HikariPool-1 - Starting...
2023-09-18 09:57:52  INFO: HikariPool-1 - Added connection org.postgresql.jdbc.PgConnection@350b3a17
2023-09-18 09:57:52  INFO: HikariPool-1 - Start completed.
2023-09-18 09:57:52  INFO: Set default schema name to public
2023-09-18 09:57:52  INFO: Clearing database change log checksums
2023-09-18 09:57:53  INFO: Successfully acquired change log lock
2023-09-18 09:57:53  INFO: Successfully released change log lock
2023-09-18 09:57:56  INFO: Reading from public.databasechangelog
2023-09-18 09:57:57  INFO: Reading from public.databasechangelog
2023-09-18 09:57:57  INFO: Reading from public.databasechangelog
2023-09-18 09:57:57  INFO: UPDATE SUMMARY
2023-09-18 09:57:57  INFO: Run:                          0
2023-09-18 09:57:57  INFO: Previously run:              44
2023-09-18 09:57:57  INFO: Filtered out:                 0
2023-09-18 09:57:57  INFO: -------------------------------
2023-09-18 09:57:57  INFO: Total change sets:           44

2023-09-18 09:57:57  INFO: Update summary generated
2023-09-18 09:57:57  INFO: Successfully released change log lock
2023-09-18 09:57:57  INFO: Command execution complete
2023-09-18 09:57:59  INFO: jetty-11.0.15; built: 2023-04-11T18:37:53.775Z; git: 5bc5e562c8d05c5862505aebe5cf83a61bdbcb96; jvm 11.0.20+8-alpine-r0
2023-09-18 09:57:59  INFO: Started o.t.w.@6b9eef22{/,null,AVAILABLE}
2023-09-18 09:57:59  INFO: Session workerName=node0
2023-09-18 09:58:00  WARN: JAXBContext implementation could not be found. WADL feature is disabled.
2023-09-18 09:58:00  INFO: Started o.e.j.s.ServletContextHandler@50ee1b35{/,null,AVAILABLE}
2023-09-18 09:58:00  INFO: Started ServerConnector@23452d2f{HTTP/1.1, (http/1.1)}{0.0.0.0:8082}
2023-09-18 09:58:00  INFO: Started Server@6368b9b8{STARTING}[11.0.15,sto=0] @10346ms

Whats the trick to make it init the DB and create the tables ?

Exie8 months ago

Ahh, sorry, I'm an idiot, I was still looking in the public DB, not the traccar one the app was using, all the tables are there and its all working nicely.

I'm keen to explore more of the data and make sure its all been parsed correctly. From the route information in the Server UI it doesn't show you much. It would be cool if it showed all the parameters at that point in time.

Track-trace8 months ago

Normally it is suggested to use Mysql database for best performance.

Exie8 months ago

Thanks, I'm sure MySQL is fine, but I just find Postgres easier to use and interface with other tools.
Performance is not a concern for me.