Creating a Redis cluster in ColdFusion 2016 API Manager

In ColdFusion 2016 API Manager, you can use a Redis cluster as your datastore.

Using the Redis cluster, you can scale API Manager by adding or removing Redis nodes and manage automatic failover by creating slaves.

This is independent of your API Manager cluster.

A Redis cluster requires at least three master nodes. We recommend creating three corresponding slave nodes for better availability and reliability.

Creating a Redis cluster involves installing individual Redis nodes that will become a part of the cluster. The next step involves adding the nodes to the cluster and providing the Redis cluster information to API Manager.

Installing a Redis node

You can install a Redis node using the API Manager add-on installer.

Enable the Enable Cluster Configuration check-box when installing each Redis node.

Add-on services
Add-on services

Each Redis node requires two open TCP connections.

The first port is the Datastore port (provided during installation), for example 6379, plus the port obtained by adding 10000 to the datastore port, so 16379 in this case.

This second port is used for the cluster bus, which is a node-to-node communication channel using a binary protocol.

The cluster bus port must be reachable from all the other cluster nodes. If you do not open both TCP ports, your cluster will not work as expected.

Creating a Redis cluster

You can create a Redis cluster by adding individual Redis nodes to the cluster and establishing communication between the nodes.

  1. Download Ruby installer for Windows from http://rubyinstaller.org/downloads/. For non-Windows platforms, compile the installer from source.

    Download redis.gem from https://rubygems.org/.

    Syntax: gem install <path-to-gem-file>

  2. Execute the Ruby script redis-trib.rb located at <APIM_AddOn_Home>\datastore\ruby-script.

    You can execute this script in any machine that has Ruby pre-installed and redis.gem added. 

  3. Execute the following command to configure Redis cluster with three master nodes and no slave nodes:

    ruby redis-trib.rb create <machine-ip>:<port> <machine-ip>:<port> <machine-ip>:<port>

  4. Execute the following command to configure Redis cluster with three master nodes and three slave nodes:

    ruby redis-trib.rb create --replicas 1 <machine-ip>:<port> <machine-ip>:<port> <machine-ip>:<port> <machine-ip>:<port> <machine-ip>:<port> <machine-ip>:<port>

For more information, refer the Redis cluster documentation at http://redis.io/topics/cluster-tutorial.

Providing the Redis cluster information to API Manager

To provide the Redis cluster information to API Manager during installation:

  1. Uncheck the Datastore check-box.

    Uncheck datastore
    Uncheck datastore
  2. In the Datastore and API Manager Cluster configuration dialog, choose Redis Cluster as Yes, and enter the details of any one node in the Redis cluster.

    Choose Redis cluster
    Choose Redis cluster

    You can also move to a Redis Cluster after installation by providing the details at API Manager Administrator > Server > API Datastore

    You can also migrate all the data from single node to Redis Cluster from here by enabling the Perform Migration check-box.

    Redis Cluster to a single node or cluster to cluster configuration is not supported.

    When you start Redis from the command line, there is no logging. Logging gets redirected to redis.log file that can be found in datastore folder.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy