High availability or clustering of Traccar Server?

wpearse8 years ago

I wonder if it would be possible to create a cluster of Traccar servers? This would enable us to do rolling upgrades when a new Traccar server version is released, and allow for failure/upgrade/maintenance of one or more Traccar hosts.

I was thinking of configuring two Traccar servers on different machines to use the same MySQL database, then place Haproxy as a front end.

Has anyone done anything similar? Any obvious reason why this might not work?

Anton Tananaev8 years ago

Some things will work, but some won't. Saving data in the database should work just fine, but because Traccar has internal cache, some info (devices, groups etc) won't be synced between servers until next request to the database which will only happen when API to modify data is called.

Igor Lopes6 years ago

Hi,

Regarding your answer, let's assume that we have two servers running, one as main server, and I take it down for update, while the second one takes all requests. The second server will continue to work fine for saving data, but it will return outdated data until we move traffic to the main server, that will return updated data and work fine after update. Is this correct ?

So, if Traccar doesn't support horizontal scalling, and if we try it will not work properly, what it would be the best approach to update a production server without downtime ?

Thanks.

Anton Tananaev6 years ago

As long as you can make devices report to the second server, then you should be more or less fine, assuming that you started it at the same time you stopped main one, so it gets latest snapshot from the database.

Igor Lopes6 years ago

I think it would be a good idea to add a feature that allows users to enable/disable cache or setup a shared cache (e.g Redis). I understand that Traccar has a great performance and can handle thousands of requests, but it makes difficult to setup redundancy server to avoid downtimes while a server is updated, and such feature would give users freedom to setup they server environment as they would like, without limitations and possible data inconsistencies between servers.

I haven't found such feature request, and if it doesn't exist, I would like to ask if I could request it where I should do it. Perhaps it can be upvoted/downvoted for future implementation.

Thank you for your help.

Anton Tananaev6 years ago

I'm sure it has been discussed before, but you can create a new request for it if you can't find existing one.