Category: Uncategorized

Syncing Content Between RackSpace Cloud Servers With Unison

We have two RackSpace Cloud Server running CentOS that need to have the web content kept in sync. Changes on either server need to be replicated to the other server. Easy way to get this accomplished is with the Unison File Syncronizer (http://www.cis.upenn.edu/~bcpierce/unison/). Here are the steps: 1. Install SSH keys for root on each server so SSH can run without passwords between the servers. 2. Add /etc/hosts file entries to map the private addresses of the servers to names.

3. Install Unison on each server:

4. Create a profile on each server at /root/.unison/sync_web.prf containing:

Notice the hostname “web2-priv” in red above. The file on web1 should reference web2-priv. The file on web2 should reference web1-priv. You’ll need to adjust the path listed in the file to match your environment. 5. Next create a script to run Unison with the profile created in the previous step.

Read More »

MySQL Load Balancing With HAProxy

The goal of this series of articles has been to construct a high availability and load balanced MySQL cluster with CentOS on the RackSpace Cloud. You should begin with this article to setup the HA Linux cluster: HA Linux Cluster On RackSpace Cloud Servers Then follow this article to add the multi-master MySQL replication: MySQL Multi Master HA Cluster The last part of the process is to add load balancing. 1. Start by installing HAProxy on both servers:

Unfortunately yum will provide an outdated version so we need to upgrade from source as follows:

Now edit /etc/init.d/haproxy and change this line:

to:

2. Now edit /etc/haproxy/haproxy.cfg a. Remove all existing “listen”, “frontend” and “backend” sections. b. Find this line if it exists:

and change it to:

c. Add this listen section:

The [PASSWORD] controls access to the HAProxy web interface. And [HOST1_IP] and

Read More »

MySQL Multi Master HA Cluster

The goal of this article is to setup an HA Linux cluster on RackSpace Cloud Servers for MySQL with multi master replication and HAProxy for load balancing. Begin by creating the HA Linux client as described here: HA Linux Cluster On RackSpace Cloud Servers Once this is complete then return to these instructions. 1. Begin by logging into each of the servers and creating a replication slave user with the following SQL commands:

Where [PASSWORD] is a strong random string. Use the same password on each of the servers. 2. Stop mysqld on both servers:

3. On each server, edit the /etc/my.cnf file. Look through the my.cnf file for an existing section of replication options. If none is found then just add to the end of the file. a. Find the “server-id” line and make sure that each server has a unique server-id. It does not matter what

Read More »

HA Linux Cluster On RackSpace Cloud Servers

Our goal is to setup a pair of RackSpace Cloud Servers in a redundant cluster using a shared IP address. We’ll use the “heartbeat” package from Linux-HA (http://www.linux-ha.org) for the cluster messaging layer and “pacemaker” package from ClusterLabs (http://clusterlabs.org) for the cluster resource manager. Before starting this procedure you’ll need to: a. Create the two cloud servers. These instructions are specific to CentOS for the operating system. b. Open a ticket with RackSpace Cloud support and request a public IP address to be shared between the servers. You can use the instructions for other situations but you’ll need to make the appropriate adjustments. 1. Setup hosts file entries. On each server, edit /etc/hosts and add entries for each servers public and private interfaces. You’ll also find it convenient to setup ssh keys between the servers for easy access. 2. Now use yum to install some prerequisite packages:

Repeat this

Read More »

Reverse Proxy With Content Rewrites

One of our clients is a school district that wanted to make content on http://www.khanacademy.org/ (KA) available to users without Youtube. The KA site uses a bit of javascript to test if the user’s browser can get to youtube and if not it servers videos from an different source. Unfortunately this was not working for the client. To solve the problem we setup mod_proxy as a reverse proxy. Then we used mod_headers, mod_filter and mod_substitute to rewrite the javascript going to client and force the use of the youtube alternative. Here’s the apache config that does the content rewrite. It’s located in the reverse proxy virtual host:

Read More »

Categories

Get a free consultation from Reliable Penguin

Submit the form—or for immediate service call 866-649-7984.