Clustering Lobby Demo :: Documentation

(c) - version 1.1.0 - 2008 gotoAndPlay


» Content of the package

Once you have decompressed the archive you will find the following folders:

» Requirements

The simplest way to check the demo is to start the Terracotta Server and the the cluster nodes all on the same machine.
Here you can see the demo running on a Linux box with 6 JVMs:

Demo running on a single box

From top-left to bottom-right there are: the Terracotta Server, the monitor instance, Game Server #1, Lobby Server #1, Lobby Server #2, Game Server #2.

In this document we will describe how to configure the application to run on a single machine. Running the demo on multiple servers requires the same setup process.

System requirements

The pre-compiled binaries are available for Windows or Linux 32-bit systems. If you need to use a 64-bit JRE you will have to follow the steps below:

In order to run this demo we recommend at least a 2Ghz processor, 1Gb of RAM and a cable 100Mbit local network connection.

» Configuring the cluster

In the Server/ folder you find a set of files called cluster-lobby{N}.xml and cluster-lobby{N}.xml.
These are preconfigured files for running up to 6 Lobby nodes and 2 game nodes. You can add more if you want to test a larger cluster, however for this test we're just using the following files:

Open each of these xml documents and simply modify the IP address of the server at the beginning of each file. Save all files, and we're almost ready to run!

Now we can configure the client application.
Open the cluster-config.xml found in /Server/webserver/webapps/default/clusterDemo/bin/ and modify the ip addresses of the gateways.

The file should look like this:

<cluster-config>

	<zoneName>clusterLobby</zoneName>
	<extensionName>clobby</extensionName>

	<gateways>
		<gateway port="8080">aaa.bbb.ccc.ddd</gateway>
		<gateway port="8082">aaa.bbb.ccc.ddd</gateway>
	</gateways>

	<games>
		<game id="tris">SmartFoxTris</game>
		<game id="maze">TheMaze Game</game>
	</games>

</cluster-config>
	

Where aaa.bbb.ccc.ddd is the IP address of your local server.

NOTE: about the jetty config

» Running the cluster

NOTE: the steps below show how to run the cluster demo in a Linux terminal. For Windows users you will need to perform the same steps by opening multiple Windows consoles and by running the .bat versions of the scripts.

First we need to run the Terracotta Server. Make sure to launch a new terminal window for each of the operations described below. So let's open a new console and type:

> cd path-to-demo-folder/terracotta-2.5.2/bin/
> ./start-tc-server.sh
	

Then we can run the cluster monitor:

> cd path-to-demo-folder/Server/
> ./start-monitor.sh
	

Then we go ahead starting the first Lobby node:

> cd path-to-demo-folder/Server/
> ./start-cluster.sh cluster-lobby1.xml
	

Now we start the second Lobby node:

> cd path-to-demo-folder/Server/
> ./start-cluster.sh cluster-lobby2.xml
	

The first Game Server:

> cd path-to-demo-folder/Server/
> ./start-cluster.sh cluster-game1.xml
	

And the second Game Server:

> cd path-to-demo-folder/Server/
> ./start-cluster.sh cluster-game2.xml
	

If everything has been configured successfully you should have six JVMs running in your system and the cluster is up and running.

» Testing the application

You can now test it by opening a new browser and pointing it to http://your-ip-address:8080/default/clusterDemo/