Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Shells Virtual Desktop
BMail.ag - Secure Email Service
Server.net
CPLicense.net
VPS Server
Buy VPN
Vultr
VMs for AI
HostDare
ReliableSite White-Label Dedicated Hosting for Resellers
InterServer VPS
BMail.ag - Secure Email Service
Best VPN
High-Performance Bare Metal Server Solutions
Karvl.com
Server Mania Cloud Hosting
DataWagon Hosting
AlphaVPS Hosting
Evoxt.com
Clouvider
VPS Hosting with NVMe
Residential IPs in the US & 4G Mobile Proxies in EU & US with Unlimited Bandwidth
ReliableSite White-Label Dedicated Hosting for Resellers
Rabisu - Hosting Solutions
Shells Virtual Desktop
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Automatic database backup

Hello, I'm using cyberpanel with a vps and I want to backup the databases of the websites I added to cyberpanel every hour and send them to a safe place. For example, to an email account or other storage.

Is there a method to do this at the server level?

Comments

  • Hi,
    Yes, there are several ways to automatically backup databases on a server, such as using cron jobs or scripts. Here is an example of how to set up a cron job to backup a MySQL database every hour and email the backup file to a specified email address:

    Create a backup script that exports the database to a file, for example:
    mysqldump -u [username] -p[password] [database_name] > /path/to/backup/file.sql

    Use the 'crontab -e' command to open the cron table and add the following line to schedule the script to run every hour:
    0 * * * * /path/to/backup/script.sh | mail -s "Database Backup" [email protected]

    Save the cron table and the cron job will now run the backup script every hour and email the backup file to the specified email address.
    Alternatively, you can use other ways like using a Database management system like Percona Xtrabackup, or a cloud storage service like AWS S3, Azure storage, Google Cloud storage to store the backup files.

  • ElkarBackup is a free open-source backup solution based on RSync/RSnapshot

    https://github.com/elkarbackup/elkarbackup

  • thecreator_thecreator_ Member
    edited January 2023

    @olhachycher said:
    Hi,
    Yes, there are several ways to automatically backup databases on a server, such as using cron jobs or scripts. Here is an example of how to set up a cron job to backup a MySQL database every hour and email the backup file to a specified email address:

    Create a backup script that exports the database to a file, for example:
    mysqldump -u [username] -p[password] [database_name] > /path/to/backup/file.sql

    Use the 'crontab -e' command to open the cron table and add the following line to schedule the script to run every hour:
    0 * * * * /path/to/backup/script.sh | mail -s "Database Backup" [email protected]

    Save the cron table and the cron job will now run the backup script every hour and email the backup file to the specified email address.
    Alternatively, you can use other ways like using a Database management system like Percona Xtrabackup, or a cloud storage service like AWS S3, Azure storage, Google Cloud storage to store the backup files.

    @nqservices said:
    Check AutoMySQLBackup: https://github.com/sixhop/AutoMySQLBackup

    @Tony40 said:
    ElkarBackup is a free open-source backup solution based on RSync/RSnapshot

    https://github.com/elkarbackup/elkarbackup

    Thank you very much for your help.

  • Try Veeam maybe, they have free community edition.

    Thanked by 1thecreator_
  • If you have other servers you're backing up to, it's built into the engine it self. For example:

    https://mariadb.com/kb/en/setting-up-replication/

    Configure a master server you need backed up. Create slaves and replicate.

    Thanked by 1thecreator_
  • vsys_hostvsys_host Member, Patron Provider

    In addition, we can say that many tables are locked during backup and such a backup can put a load on the server, you can increase the interval, or do not backup directly from main db server

    Thanked by 1thecreator_
  • @vsys_host said:
    In addition, we can say that many tables are locked during backup and such a backup can put a load on the server, you can increase the interval, or do not backup directly from main db server

    Hello, thank you for your reply.
    How can I backup from main db server? Does it make sense to use mysqldump with a bash script? So this way, no matter how big the database is, can I correctly backup every hour?

    Thanked by 1vsys_host
  • WebProjectWebProject Veteran, 🚩 Host Rep Tag Suspended

    @Tony40 said:
    ElkarBackup is a free open-source backup solution based on RSync/RSnapshot

    https://github.com/elkarbackup/elkarbackup

    Did anyone tested the ElkarBackup to backup the database 25-30GB size?

  • vsys_hostvsys_host Member, Patron Provider

    @thecreator_ said:

    @vsys_host said:
    In addition, we can say that many tables are locked during backup and such a backup can put a load on the server, you can increase the interval, or do not backup directly from main db server

    Hello, thank you for your reply.
    How can I backup from main db server? Does it make sense to use mysqldump with a bash script? So this way, no matter how big the database is, can I correctly backup every hour?

    There are many ways to backup the Mysql database.
    mysqldump via bash script is straight forward way to backup, you have to use it until it does not affect the server's performance/load.
    But if you will face issues with high load, you can backup via LVM snapshot or deploy slave DB on another server and make a backup there.

    Thanked by 1thecreator_
Sign In or Register to comment.