Skip to content

Configuring REDIS to work with multiple servers

Introduction

This page describes how to configure Redis to work with multiple servers. This guide assumes that there's only one administration server, and multiple query processors.

With one administration server and multiple query processors the usual way to configure Redis is to use a master/slave approach: The administration server is made the master, and each query processor is configured as slaves of this master.

The configuration requires the following steps:

  • Ensure that the master listens to the correct network interface
  • Configure the slaves to connect and authenticate to the master

Configuration files

All modifications of the Redis configuration should be made in SEARCH_HOME/conf/redis.conf. Do not modify the SEARCH_HOME/conf/redis.conf.default file as it will get overwritten during upgrades.

The master server must be configured so that Redis will listen to the appropriate network interface (the interface to which the others servers are connected). By default Redis is configured to listen to localhost only and will refuse any external connections.

To configure the network interface, edit SEARCH_HOME/conf/redis.conf and add the following line:

bind 0.0.0.0

This will cause Redis to listen to all network interfaces. If you want to restrict it to a specific interface, use the appropriate IP address of the interface, e.g.:

bind 192.168.0.1

For this configuration to take effect, you'll need to restart the funnelback-redis service.

Important: Also make sure that the firewall(s) protecting the Redis master are configured to allow connections to the Redis port. The default Redis port is 6379 and can be changed by using the port num directive in SEARCH_HOME/conf/redis.conf

The slaves must be told to connect to the master, and use the proper authentication password. Edit SEARCH_HOME/conf/redis.conf on the slaves, and add:

slaveof master_hostname master_port
masterauth master_passwd

master_hostname

Host name of the master server

master_port

Port of the master server.

master_passwd

Password of the master server.The password can be retrieved from SEARCH_HOME/conf/redis.password.conf.default on the master server:

requirepass 1234

Once configured, the funnelback-redis service on the slaves must be restarted.

Example

Assuming the master server hostname is search-admin.company.com and its password is 1234abcd, the following lines should be added to SEARCH_HOME/conf/redis.conf on the slaves:

slaveof search-admin.company.com 6379
masterauth 1234abcd

Once all services have been restarted, the SEARCH_HOME/log/redis.log files on the master and slaves should contain traces of the master / slave replication.

On the master:

[31248] 01 Oct 11:39:00 * Slave ask for synchronization
[31248] 01 Oct 11:39:00 * Starting BGSAVE for SYNC
[31248] 01 Oct 11:39:00 * Background saving started by pid 32043
[32043] 01 Oct 11:39:00 * DB saved on disk
[31248] 01 Oct 11:39:00 * Background saving terminated with success
[31248] 01 Oct 11:39:00 * Synchronization with slave succeeded

On the slave:

[11967] 01 Oct 11:39:00 * Connecting to MASTER...
[11967] 01 Oct 11:39:00 * MASTER <-> SLAVE sync started
[11967] 01 Oct 11:39:00 * Non blocking connect for SYNC fired the event.
[11967] 01 Oct 11:39:00 * MASTER <-> SLAVE sync: receiving 1355 bytes from master
[11967] 01 Oct 11:39:00 * MASTER <-> SLAVE sync: Loading DB in memory
[11967] 01 Oct 11:39:00 * MASTER <-> SLAVE sync: Finished with success

In case the current master fails, a new master can be promoted. To do so:

  • Edit the new master configuration to listen to the proper network interface
    • If the new master was a slave previously, remove the slaveof statement from its configuration file
  • Edit the slave's configuration and update the slaveof statement to point to the new master
  • Restart all services (master first, then slaves)

The most common sources of errors are:

  • Network related connection problems:
    • Is Redis listening to the correct interface?
    • Is the port properly configured?
    • Is the firewall letting the Redis connections in?
  • Authentication problems:
    • Are the master and the slaves sharing the same password?
    • Was Redis restarted after the password was changed?

See also

top

Funnelback logo
v15.14.0