READynamic

Setting up server load balancing in READynamic

Introduction

READynamic is designed to be able to manage system requests from hundreds or thousands of individual users, allowing them to promptly and efficiently download eBook files, edit eBooks, create and join groups, and complete all of the functions the system offers.

But to succeed with the large volume in network traffic requests that result from a large community of users, you might want to use server load balancing. Server load balancing uses a router to distribute system requests for your READynamic environment across multiple server hardware devices, using a single database and Network Attached Storage (NAS). NAS is a dedicated file storage system that allows multiple users and client devices to retrieve files from a central disk array.

To set up load balancing for READynamic, you will need:

  • A datacenter controller that can determine the available capacity of individual servers in a server cluster and distribute network traffic in response
  • A remote database server, such as Amazon’s MySQL Relational Database Service
  • Networked Attached Storage (NAS)

Configuring the Remote Database

When you install READynamic, the system is configured to build a local database at /readynamic/mysql.

This won’t work well, however, in a cluster environment, where multiple server devices need to communicate with a single database. Fortunately, you can easily configure READynamic to connect to a remote database by making a small change to a Docker control file:

/readynamic/docker/.env.web

The file looks like this:

BUNDLE_PATH=/home/app/bundle
PASSENGER_DOWNLOAD_NATIVE_SUPPORT_BINARY=0
PASSENGER_COMPILE_NATIVE_SUPPORT_BINARY=0

You need to add a variable to this file called DATABASE_URL. The Docker container will pick up this variable when the system is built. When this variable is present in the env.web file, the RAILS environment ignores all other database configurations specified in two files found in the READynamic /config directory, readynamic/env.db and database.yml.

The DATABASE_URL variable includes a user name, a password, a web address for the SQL server, and the MySQL database name. Here is an example of these values:

user readynamic
password test123
URL mysqlserver.datalogics.amazonaws.com
Database name rdstage

So the string you add to the env.web file might look like this:

DATABASE_URL=mysql2://readynamic:test123@mysqlserver.datalogics.amazonaws.com/rdstage

Add DATABASE_URL string to env.web. When you are finished, the file should look something like this:

BUNDLE_PATH=/home/app/bundle
PASSENGER_DOWNLOAD_NATIVE_SUPPORT_BINARY=0
PASSENGER_COMPILE_NATIVE_SUPPORT_BINARY=0
DATABASE_URL=mysql2://readynamic:test123@mysqlserver.datalogics.amazonaws.com/rdstage