How to make an ISPCP cluster - with clustered apache, mysql and users for ISPCP.

Two servers as provided by our webhost they could both be reached on their IPs but an ifconfig gave the IP as the load balancers IP

server1: 10.0.0.1

server2: 10.0.0.2

Load balanced ip: 10.0.0.4

Performed on debian lenny using ISPCP 1.07

STEP 1

Set up your two servers to replicate their databases to each other, the lag time between updates on either server is either server is under a second and all queries are run on the localhost

mysql multimaster replication

http://capttofu.livejournal.com/1752.html

Don't include any of the replicate-do-db lines to replicate all of the databases

IMPORTANT: Edit hosts.allow/hosts.deny files to only allow connections from each server to mysql

STEP 2

setup ssh passwordless auth http://arbib.it/tag/shortest-passwordless-ssh-tutorial-ever/

STEP 3

Install ispcp on each server

The /etc/hosts file which will have been regenerated by ispcp make sure you insert any hostnames you might have used for the multimaster replication:

Edit the /etc/apache/sites-available/00_master.conf and change the IP to the real IP of the server. This will allow you to access the ispcp pages on thier own IPs (otherwise you wouldn't know which server you're editting).

Copy the attached configs into /var/www/iscp/engine/ and stop /etc/init.d/ispcp_daemon on the second server

Also edit /var/www/ispcp/engine/ispcp-rqst-mngr and at the bottom change server2 to the IP (or hostname) of server 2.

The modified configs for server one have been modified so that when a change is made it changes the status in the mysql db to change2/toadd2/todelete2 etc and calls the requestmanager on server2 server2 then looks for these statuses in the database, and processes them before marking the change as applied.

STEP 4

To rsync the webdirectories from server 1 to server 2 (it's very difficult to do circular replication with files, which is why i'm syncing server 1 to 2)

Add the following line to crontab on server 1 to sync server 1 to 2 every 5 minutes */5 * * * * rsync -vaz --stats -r --rsh="ssh -p2222" --delete-delay /var/www/virtual/ server2:/var/www/virtual/

IMPORTANT any/all changes must be made on the first server. ie new sites added, removed etc.

STEP 5 (optional in some cases)

If your sites use /admin login to edit their content (most commerical shopping carts, cms systems etc)

To enable access on server1 to it's own IP you need to do the following steps.

cp /etc/apache2/sites-available/ispcp.conf /etc/apache2/sites-available/ispcp.server1.conf a2ensite ispcp.server1.conf sed -i 's/loadbalanced IP/server1 IP/g' /etc/apache2/sites-available/ispcp.server1.conf

Of you make regular changes it would be a good idea to add onto the end of below the `ssh ....` command `cp /etc/apache2/sites-available/ispcp.conf /etc/apache2/sites-available/ispcp.server1.conf` `sed -i 's/loadbalanced IP/server1 IP/g' /etc/apache2/sites-available/ispcp.server1.conf` `/etc/init.d/apache reload`

You should then update your hosts file to point your pc to the first servers IP address

IT Support Contracts

Support contracts to cover all your IT and Telecoms with UK wide free call-out. Our friendly support staff provide on-site, telephone, email and remote support for workstations, servers and phone systems. We offer full Linux support as well as Apple and Microsoft.

 

Linux Business Servers

Linux servers to suit every requirement from drop-in Microsoft replacements to advanced firewalls, high availability, thin client servers and virtualisation. Our SME Business Server product provides your business with an IT solution taking care of networking, security, storage, email, backup, remote access and much more.

 

Distro Support Includes

  • Elastix / AsteriskNow / FreePBX
  • RedHat / CentOS / Scientific
  • Zentyal / smeserver / SUSE
  • Debian / Ubuntu / Linux Mint
  • Arch / Archbang / Gentoo
  • Fedora / Kubuntu / Xubuntu
  • Raspbian / Embedded Systems

Ubuntu Server & Desktop

Pre-configured Ubuntu server, desktop and thin client systems to suit your requirements. We offer drop-in Microsoft Server replacements and even migrate your existing Microsoft server or desktops and keep the applications you need.