Load balancing UrbanCode Deploy

They say a picture is worth a thousand words and the picture of the High Availability setup for UCD  in the UCD Infocenter is no exception, reproduced here .

uDHAThe text in the Infocenter (in the process of being updated with a more comprehensive guide for a future UCD release) has information scattered around on how to do this. So here’s a quick and dirty guide to how I set this up.

On the load balancer side there are a number of options, hardware and software and I haven’t got access to a hardware one so I went the software way. My first eager beaver approach used Nginx, which I had played with briefly when looking at CLM Clustering. Though WebSphere Proxy Server was used in that instance, I found Nginx easy to setup and configure and so used it for my first attempt at setting up load balancing for UCD.

Running Nginx on my trusty Red Hat server and two UCD servers on Windows 2008, I got the setup going in short order. Or so I thought. Accessing the server web UI via the load balancer was all good. But getting an UCD agent to connect to the server via the load balancer was a no go because I’d configured Nginx to only balance HTTP requests forgetting the JMS channel between the server and agent.

After a little research I decided I didn’t want to spend the time trying to get Nginx to handle  non-HTTP traffic as well and replaced it with HAProxy. A simple tcp mode configuration of HAProxy (as in the snippet below) had the agents working as well.

listen ucd.jkebanking.net
bind :8080
bind :8443
bind :7918
mode tcp
balance source
server  ucd01 WIN-7VN7MDUIA2T check port 8080
server  ucd02 WIN-7VN7MDUIA3T check port 8080

I’m no expert in HAProxy config which has a ton of configuration options, but basically I’m getting the load balancer to listen on ports 8080, 8443, 7918 and redirect to one of 2 servers. I also use the unsecured http UCD server port (8080)as a check to see if the server is alive.

On the UCD configuration side there a few changes needed as detailed in the Infocenter topics on topicHigh availability servers and topicSetting up multi-datacenter clustering. The changes are as follows:

a) All of the servers in load balanced setup need to be configured to access the same database. This means once the first server has been installed and configured, choosing not to create new schema definitions in the database during every subsequent installation. In other words answering “N” to the “Create database schema” question for server 2..N.

b) All of the servers need to be configured to access a shared file system for the following folders/files:

install_dir\var\email
install_dir\var\plugins
install_dir\var\repository
install_dir\logs
install_dir\conf\encryption.keystore
install_dir\conf\server.keystore
install_dir\conf\collectors
install_dir\patches
install_dir\conf\server\log4j.properties

c) copy the value of the encryption.keystore.alias key from the install_dir\conf\server\installed.properties file of the first server to the installed.properties file of each subsequent server.

d) Add

com.urbancode.ds.UDeployServer.multiserver=true

to the install_dir\conf\server\installed.properties of each server.

e) Configure each server as a Network relay in Settings -> Network.

f) Most importantly make sure that the hostname specified in the servers Web UI URL (ie. the value of the server.external.web.url in the install_dir\conf\server\installed.properties file) is the load balancer rather than one of the actual servers. In my case the URL would be https://ucd.jkebanking.net:8443 rather than https://WIN-7VN7MDUIA2T:8443 or https://WIN-7VN7MDUIA3T:8443.

Once I fire up the servers, HAProxy and the agents  I have a load balanced 2-server UCD setup.

Enabling stats on HAProxy lets me look at how the servers are doing.

haproxy

Happy 2014:-)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s