## Chapter 15. Clustering

In Red5 0.7 the Ant build.xml file contains a build target that creates a 'cluster' folder containing the same setup as described below. Use 'ant dist-cluster' to create the Red5 clustering setup.

| Limitations
As of now, the current trunk only supports the clustering configuration for multiple Edges with one Origin. The Edge server only accepts RTMP connection.

## 15.1. Server Configuration

### 15.1.1. Configuration Files

There are several configuration files added to support Edge/Origin configuration.

red5-edge.xml, red5-edge-core.xml - used for edge spring bean configuration. They are under conf/.

red5-origin.xml, red5-origin-core.xml - used for origin spring bean configuration. They are under conf/.

## 15.2. Configure Edge Server

You don't need to deploy your application on Edges.

We strongly recommend you to deploy Edge on a different server from Origin. But it should be OK to deploy the Edge on the same server as Origin.

### 15.2.1. Edge on a different Server from Origin

Update the configuration of bean "mrtmpClient" in red5-edge-core.xml to point to Origin server:

    <bean id="mrtmpClient"
        class="org.red5.server.net.mrtmp.MRTMPClient" init-method="start" >
        <property name="ioHandler" ref="mrtmpHandler" />
        <property name="server" value="${mrtmp.host}" />
        <property name="port" value="${mrtmp.port}" />
    </bean>

Replace red5.xml with red5-edge.xml. Start the server by

    $ ./red5.sh

or

    $ java -jar red5.jar

### 15.2.2. Edge on the same Server as Origin

You don't need to change red5.xml. Copy red5-edge.xml to $(RED5_ROOT) from $(RED5_ROOT)/conf. Start the server by

    $ java -jar red5.jar red5-edge.xml

or update red5.sh to add a parameter "red5-edge.xml", then

    $ ./red5.sh

## 15.3. Configure Origin Server

Deploy your application to webapps/. Make sure your 9035 port is not blocked by firewall. The port will be used by Edges to connection Origin.

Update red5.xml with red5-origin.xml. Start the server by

    $ ./red5.sh

or

    $ java -jar red5.jar

## 15.4. Use Your Appliation

Your RTMP can go through Edges now. Your RTMPT and HTTP can go through Origin as normal.

Prev | Home | Next
Chapter 14. Scripting Implementations | Red5 Open Source Flash Server | Chapter 16. Management