The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Backing up PostgreSQL and MySQL databases to Amazon S3

Discussion in 'Database Discussions' started by Michael Babbitt, Apr 13, 2015.

  1. Michael Babbitt

    Joined:
    Apr 13, 2015
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Westlake Village, CA
    cPanel Access Level:
    Root Administrator
    I'm wondering if anyone can help me with setting up WHM's backup function.

    I've created a PostgreSQL database via shell (not cPanel) and also have MySQL databases that I DID create via cPanel. According to the text in WHM's Backup Configuration, it specifically mentions backing up MySQL databases but nothing about PostgreSQL. Additionally, if I DID NOT create my PostgreSQL database with cPanel's wizard, will I be able to configure WHM to back up this database?

    I'm interested in backing these databases up to an Amazon S3 bucket instead of locally but cannot quite figure out how to do this or if it's possible to include my PostreSQL database that was manually built. The documentation doesn't get into this territory.

    Any ideas? Thank you!
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,460
    Likes Received:
    195
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Have you tried forcing a backup (saved locally) and then check that backup for the PostgreSQL database?
     
  3. Michael Babbitt

    Joined:
    Apr 13, 2015
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Westlake Village, CA
    cPanel Access Level:
    Root Administrator
    Yes, this does not save the backup of the installed PostgreSQL database. Also, unless I choose to 'Backup Accounts', I don't get any databases backed up that are associated with those accounts. The problem with INCLUDING the accounts is there are no flags to omit directories such as the 'public_html' dir. That dir is already backed up via GIT and I don't want to be pushing several GB to S3 on a daily basis for obvious reasons.

    We could run a Cron Job to backup the databases to a place where then C-Panel could have access to it, but we'd need to be able to know where that would be without having to save all of each accounts data.

    Can you offer any suggestions for this?
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,762
    Likes Received:
    662
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello,

    You can actually exclude entire directory via the use of an exclude file:

    Backup Exclusions

    Thank you.
     
  5. Michael Babbitt

    Joined:
    Apr 13, 2015
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Westlake Village, CA
    cPanel Access Level:
    Root Administrator
    Thank you, this is very helpful. I am used to having to always work within the constraint of WHM's GUI to get things done.

    One final question I have is with this part of the instructions:

    When adding directory names/file names into the cpbackup-exclude.conf file within the user directory, the instructions say:

    "Do not include leading or trailing characters of any kind, such as slashes (/) or periods (.)."

    So what of the symbolic links? For example, '.spamassassin'? How would I instruct cPanel to not backup these files?
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,762
    Likes Received:
    662
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello,

    You can still enter .spamassassin as an exclusion. The statement you are referring to is intended to clarify that you shouldn't use a period or slash to define a path (e.g. ./directory/here instead of directory/here).

    Thank you.
     
  7. Michael Babbitt

    Joined:
    Apr 13, 2015
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Westlake Village, CA
    cPanel Access Level:
    Root Administrator
    Any advice on setting up Amazon S3 so Cpanel doesn't over-write my daily backup? I'm currently only able to store one backup in S3, even though I've set up a rule there to retain each backup for 14 days before deleting. I'm assuming that Cpanel is issuing a delete command before uploading each daily backup. If this is the case, there needs to be a way for me to archive these without using Glacier storage (as that will not allow me a speedy recovery if God-forbid, I need to recover lost data).

    Thank you,

    Michael
     
  8. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,762
    Likes Received:
    662
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
  9. Michael Babbitt

    Joined:
    Apr 13, 2015
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Westlake Village, CA
    cPanel Access Level:
    Root Administrator
    Yes, but I don't want the "Retention" to happen on the server that is hosting cPanel or we'll run out of space. Am I misunderstanding how it works? Obviously this is how it was working before I switched over to backing up to S3. Does the "Retention" only apply to S3 retention when S3 is used instead of local?
     
  10. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,762
    Likes Received:
    662
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
  11. Michael Babbitt

    Joined:
    Apr 13, 2015
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Westlake Village, CA
    cPanel Access Level:
    Root Administrator
    Ah, I see the tick box now. I had the "Retain backups in the default backup directory." checked. Un-checking that will only move backups to Amazon S3. This is fantastic. So happy cPanel added S3 backups! Thanks again!
     
Loading...

Share This Page