MySQL Traccar Database Backup

Sifumwikea year ago

Hi, I am using bash script and the crontab utility to set up a daily backup task on from an online mysql traccar database to my local machine. I set the backup to run everyday by 11:30PM.

However, my concern is, will the backup (mysqldump) process ever complete as a whole while the traccar service keeps on running (there are more that 300 devices with 30 seconds reporting frequency)? or should I suspend the traccar service during that database backup period?

Track-tracea year ago

Making a database backup does not seem to be the correct way while the mysql database is still running (chance of data loss or corruption).

An solution would be to make your script / crontab shutdown mysql, do the backup and after that startup mysql again.

Would be nice if you post that script here for others to use.

Anton Tananaeva year ago

There shouldn't be any problem running backup at the same time as Traccar is running. The only problem that it makes things slower.

You definitely don't need to stop MySQL to make a backup.

Track-tracea year ago
Anton Tananaeva year ago

The standard option is mysqldump, which does not require the server to be stopped.

Sifumwikea year ago

My concern is as the mysqldump process is continuing, more data will be added to the database making the process somewhat infinite?

If I shut down MySQL service then how will the mysqldump operation work?

I think. Best bet would be to temporarily suspend Traccar service so no more data will be written to the database as the mysqldump process continues.

Thoughts?

Anton Tananaeva year ago

I agree. The best way is to stop Traccar for the time of the backup.

erickjohnea year ago

Good afternoon chaps, and happy friday,

Anton, I've done the backup however indeed makes it all slow, at some point my traccar service stopped responding and came back only after backup was completed, (mysqldump)

A question that might help other also,

Is there anyway to create the backup only for user credentials table, and necessary files to have another instance ready with a simple backup of devices, users, groups, and credentials? avoiding events, positions and etc
at least, in case a serious issues happens, you can have a script backup with this data and a ready server receiving this information and ready to work in the worst case scenario

Many thanks,

Anton Tananaeva year ago

Yes, you can tell mysqldump to backup only specific table(s).

Hello everyone, I recommend taking a look at the traccar website before consulting the forum. There is a lot of information.

https://www.traccar.org/clear-history/