Stop automatic backup of database

How to stop automatic database backup. Need urgent help. The server is performing poorly due to these automatic backups.

I have already set “0” in Settings → Backups.

It may help to say what version of ERPNext and if the performance problem is happening on a new instance or if things had been operating smoothly and this has just started happening.

Thanks @smino for replying.

ERPNext version 13 beta 4.

The performance problem is happening on an existing instance and it has started deteriorating gradually.

ERPNext creates cron jobs to perform the SQL database backups.

On your server, open a terminal. Switch to your ERPNext user. Then use this shell command:

crontab -e

This will open an editor (probably nano or vim). Then you can delete the line which is performing the backups.

3 Likes

Thanks @brian_pond. Would it be possible to add a “nice” invocation to the cronjob that would let it run as scheduled but with a priority that would cause less of a performance impact? Something like:

cd /home/frappe/frappe-bench && nice -1 /usr/local/bin/bench --site all backup >> /home/frappe/frappe-bench/logs/backup.log 2>&1

2 Likes

I’ve never tried that. But I’m assuming it would work.

The bench backup command is nothing special. It performs a “mysqldump” command for every Site (database) that it knows about.

If you have better SQL backups tools or schedulers at your disposal, you could remove the cronjob entirely. And just backup the SQL database your way.

Edit : I believe the bench backup command is also backing up the Site’s “public” files. In addition to performing a SQL database backup.

1 Like

Thanks @brian_pond and @smino for the prompt reply to my query.

Yes, I could find out the cron-job set for database backup ( /usr/local/bin/bench --site all backup) using crontab -e with erpnext user login. I have just changed the timing for backup so that it would not hamper the server performance during pick hours of transactions.
It would run in server idol time.

Additionally I found a cron task with following command :
/opt/erpnext/erpnext/env/bin/bench update --auto

What it does? It is set to run once everyday. Is it require so?

Apart from database backup file *.sql.gz, i found that site_config.json is also being backed-up simultaneously and continuously.

That file contains encryption_key, if the key is lost all the password fields need to be reset after restoring db.

Thanks @revant_one. I was unaware of that. So that means site_config.json is backed up with the database by default as a pre-requisite and it is happening by --site all backup command.

This automatically updates ERPNext. Pulling code down from GitHub, updating your local code, applying patches, and potentially making SQL schema changes.

I would strongly recommending disabling this in any Production environment. And instead patch ERPNext in a controlled and planned manner.

3 Likes

Ohhhh man. Thanks a lot, @brian_pond. I was unaware of it. I am just disabling it.

I facing the same error in our system and I try all the solution here but i did not found anything in crontab + set the backup number to 0 but still the backup running up every 6 hour

the wired things in my problem that after my server freeze and restart it from AWS that i have an image for the server before 2 days and have the

bench --verbose --site all backup >> /home/frappe/frappe-bench/logs/backup.log 2>&1 # bench auto backups set for every 6 hours

in the corntab of frappe but in live system there is not

One thing you can try. Check the crontab with below two distinct commands.

>> sudo crontab -e

>> croantab -e

In may case, I had also observed that if you have non-root user login then it wont show crontab set by root users.

Hope this may help.

1 Like

Did you try disabling auto scheduler? On down side it will disable all schedule tasks.

Or may be

bench --verbose --site all backup

do not work correctly

https://github.com/frappe/bench/issues/1236

Hi @pioneerpathan @revant_one @brian_pond
I’m using frappe version-14, facing same issue like whenever db backup scheduler runs my site automatically goes down and giving me an 504 error code in UI,

But, I don’t want to stop that, I do want to take backup but with better way
So, Is there any way to configure this to overcome this issue?

Yes, there are 2 kinds of MariaDB backups: Logical and Physical.

Frappe framework and Bench creates a Logical backup.

Alternately, you can use Mariabackup to create a Physical backup of your database. This is much faster, and uses less system resources. But the process is a bit more difficult, and it has some disadvantages.

2 Likes

Hi @brian_pond
Thanks for your response,
Just wondering isn’t there any other to way to configure within a bench, I mean with frappe. Instead of going with Mariabackup

Not with Bench and Frappe.

If the backups are taking down your site, one idea might be increasing the hardware (CPU, Memory). Or moving your SQL database to a different host device.

1 Like