Redundancy with 2 cPanel servers

vs-fam

Active Member
PartnerNOC
Mar 18, 2010
36
4
58
Hi,

I have 2 servers, one is the "master" and the other is a hot stand by. I want to improve the setup.

So far I'm doing the following:
  • Initially, all accounts on the master server were copied over to the standby server.
  • Using DNSME service for domain failover to the standby server.
  • Static content is being synced with rsync with a cron job per account (just public_html).
  • MySQL is set with Master-Master replication.
Considering the second server will be used just as an emergency for a limited time, i can live with limited functionality (ie. no email service) in the mean time.

The major problem this setup is giving me is that I'm missing some configurations:
  • New MySQL users and DB in cPanel aren't showing.
  • Obviously, new accounts created on the master server won't be created on the standby. Although their new DBs get replicated as orphaned.
  • Same with new subdomains, aliases, etc.
Can you recommend a better way to do this? All suggestions are welcome.

Thanks
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,270
463

vs-fam

Active Member
PartnerNOC
Mar 18, 2010
36
4
58
Hi,

I'm aware of those feature requests that have 4 years opened for discussion. There's not much information there either aside from using rsync to sync web content only.

It would be nice if cPanel staff could put up a 'howto' in the mean time on how to nearly achieve this considering you have inside information. What to sync, how, tools, etc. Just like the one to replace mysql with percona and other 'unsupported' tutos.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,270
463
The major problem this setup is giving me is that I'm missing some configurations:
  • New MySQL users and DB in cPanel aren't showing.
  • Obviously, new accounts created on the master server won't be created on the standby. Although their new DBs get replicated as orphaned.
  • Same with new subdomains, aliases, etc.
Hello,

I can offer some advice on some of the major issues you listed. To clarify, is the remote system live with a valid cPanel installation, and able to accept remote connections? If so, you may find the standardized hooks functionality helpful:

Guide to Standardized Hooks - Software Development Kit - cPanel Documentation

You could setup hooks on the source cPanel server to automatically run a custom script that performs actions on the secondary server. For example, let's say you wanted to run a custom script that created an account on the destination server anytime an account was created on the source server. You could setup the custom script to run automatically after every new account creation using a post "Accounts::Create" hook:

Guide to Standardized Hooks - Whostmgr Functions - Software Development Kit - cPanel Documentation

Thank you.