Redis on Windows

About Redis

Redis is a high-performance, NoSQL key-value database typically used for caching data to scale high-traffic websites. GE Digital APM uses Redis for caching purposes and to ensure a consistent shared cache among the various servers and services that make up a GE Digital APM installation.

The GE Digital APM Servers are set up using one of the following configurations:

If GE Digital APM servers are set up in a load-balanced configuration, then a separate Redis server is also used as an intermediate to broadcast events from the Meridium Scheduling Service to instances of GE Digital APM that are connected to different GE Digital APM Servers using the WebSocket protocol.

Redis is an open source software component licensed under the Three Clause BSD License.

More Details

Redis provides a basic Pub-Sub messaging infrastructure that allows the server to notify subscribed clients of changes or various events that occur on the server. The GE Digital APM uses this feature to notify servers/services when cached data has changed, caches expire, or caches are removed. This feature, along with the Meridium Notification Service, is used for change notification. Redis events specifically handle cached/static data such as metadata, while the Meridium Notification Service handles more dynamic changes such as Entity inserts/updates. Redis is used as an in-memory cache to store user session information, various types of metadata (e.g., family definitions, field definitions, security groups, etc.), and Catalog data.

Meridium Scheduling Service runs on each GE Digital APM Server in a load-balanced configuration. For a user session, an instance of GE Digital APM connects to one of the GE Digital APM Servers using the Websocket protocol, but the background job can run on any server in a load-balanced configuration. Meridium Scheduling Service sends the message to the Redis server, and the Redis server then relays the message to all GE Digital APM Servers. Finally, the GE Digital APM Server sends this message to the GE Digital APM instance connected using the WebSocket protocol.

Install Redis on the GE Digital APM and Redis Servers

About This Task

This topic describes how to install Redis on the Windows-based GE Digital APM and Redis servers.
Note: The last supported Redis version for Windows contains Common Vulnerabilities and Exposures (CVE). Therefore, we recommend that you install Redis on a Linux server. For more information on how to install Redis on a Linux server, refer to the Install Redis on the GE Digital Redis Servers topic.

Procedure

  1. Access the GE Digital APM distribution package, and then navigate to the folder V4.4.0.0_3rd_Party_Software\Redis.
  2. If the GE Digital APM Server and Redis server are set up using the standard deployment architecture, run the Redis installer package to install Redis on the GE Digital APM Server.

    or

    If the GE Digital APM Server and Redis servers are set up using the high availablity configuration architecture, run the Redis installer package to install Redis on each Redis server.

  3. Perform the following steps to ensure that the Redis service is running:
    1. On the Windows Start menu, in the Search box, enter Services.msc, and then press Enter.
      The Services window appears, displaying the status of all the services installed on the GE Digital APM Server.


    2. Ensure that the Redis service is running on the GE Digital APM Server.

About Configuring the Redis Server

The configuration settings for the Redis server are controlled through the conf file that is specified when installing the service. You can change settings by modifying the file and restarting the service to apply the changes. You can also use the CONFIG GET and CONFIG SET commands from a Redis client to view or alter the server configuration.

Note:
  • Ensure that the value for configuration option notify-keyspace-events in \Program Files\Redis\redis.windows-service.conf is specified as EA.
  • The conf file will not be updated with the changes that occur at run time. After making changes to the conf file, be sure to restart the service.

Configure Server and Ports

By default, the Redis server runs on TCP Port 6379.

  • If the GE Digital APM server and the Redis server are on same machine, then connections are allowed from the local server.
  • If the GE Digital APM server and the Redis server are on different machines, then Port 6379 must be accessible between the Client and the Server. Any firewalls between the systems must be configured to support traffic over this port. The default port is changed in the conf file to 6379 by adjusting the port value.

Configure Secure Access

It is recommended to always use Redis in an environment in which the network and the Redis server are secured.

  • If the GE Digital APM server and the Redis server are on same machine, then Redis can be secured by blocking external access to the network port (port 6379), allowing connections only from the local server.
  • If the GE Digital APM server and the Redis server are on different machines, you can secure the access by:
    • Configuring Redis to use a password.
      Note: By default, Redis is configured without a password.

      When using a password on the Redis server, you must configure the connection string to include the password.

      1. On the GE Digital APM Server, access the folder C:\ProgramData\Meridium, and then, in an application that you can use to modify XML script (for example, Notepad), open the file MeridiumAppSettings.xml.
      2. Within the <cacheServiceUrl> setting, change the default value localhost to localhost,password=<Redis password>, where <Redis password> is the password for the Redis server.
      Note: The password in the .XML file can be encrypted by running MeridiumCachePasswordUtility.exe from a command prompt, passing in C:\ProgramData\Meridium\MeridiumAppSettings.xml as a command line parameter.
    • Setting up the firewall on the Redis server to only allow connections from the GE Digital APM servers.

Note: If Redis is configured on a separate server and network transmissions are across an unsecured/open network, then it is recommended to use third-party software (for example, Stunnel) to enable SSL communication between systems.

Standard Deployment Architecture

By default, the standard single system deployment architecture includes the Redis server on the same system as the GE Digital APM Server.



Set Up the GE Digital APM Server - Single Server Cache Configuration

About This Task

Note:

In a standard deployment, the Redis server is on the same system as the GE Digital APM Server and is installed and correctly configured.

To configure GE Digital APM servers using single server cache configuration:

Procedure

  1. On the GE Digital APM Server machine, navigate to the folder C:\ProgramData\Meridium.
  2. Open the file MeridiumAppSettings.xml in an application that you can use to modify XML script.


    Note: GE Digital APM requires both the cacheServiceUrl and explicit Host and Port keys.
  3. Below the <Cache Service> comment tag, verify the following Redis-specific settings.
    • The cacheType value should be equal to "redis".
      Note: The cacheType value “redis” is supported for any customer implementations.
    • The default value for cacheServiceUrl is "localhost". If Redis is configured on a different server using a non-default port, values should contain a comma separated set of values.
    • The default value for cacheTimeout is 1 day, or 1440 minutes.
  4. To increase the time GE Digital APM will wait for Redis to complete operations, add a SyncTimeout to the cacheServiceUrl and key:
    <add key="cacheServiceUrl" value="localhost,syncTimeout=5000" />
    <add key="MessageBus:CacheOptions:SyncTimeout" value="5000"/>
    
    Note: The system will first check whether these settings are configured in the executable or web config file and, if they are not, it will then load them from the MeridiumAppSettings.xml file. GE Digital’s recommendation is to use the MeridiumAppSettings.xml file to ensure consistency across the installation and to give you the ability to change the settings for all of the services and websites in one place per server.

Setup GE Digital APM Server - High Availability Configuration

About This Task

If GE Digital APM Servers are set up in a load-balanced configuration, then two Redis servers should be running, each on a separate system, with each GE Digital APM server/service configured to point to the separate systems. Redis servers can be configured either by Replication only Setup or by Automatic Fail-Over monitoring.

The first Redis server setup is used for caching. The second Redis server setup is used by GE Digital APM Scheduling Service to broadcast events to instances of GE Digital APM.



The following image illustrates how the Redis server setup used by GE Digital APM Scheduling Service communicates with instances of GE Digital APM over web socket protocol.



Redis can be configured with replication only. Replication only setup means that Redis will replicate data automatically to any configured replica servers but in the event of a failure, an administrator must login and manually change a server to be the primary server instead of replica server.

Configure Redis - High Availability Configuration

About This Task

To configure Redis for high availabilty, some changes must be made in the Redis configuration file. To enable the Redis primary/replica configuration, you must make changes to the primary and replica servers.
Note: For more information on the configuration options available in the Redis configuration file, refer to the Redis documentation.

Procedure

  • Steps: Changes to the primary server
    1. Configure the save intervals.

      save 900 1

      save 300 10

      save 60 10000

    2. Configure the directory for the persisted data.
      heapdir "c:\\path_to_where_data_is_stored\\"
    3. Enable persistence.
      persistence-available yes
  • Steps: Changes to the replica server
    1. Configure the replica server to point to the IP address of the primary server.
      slaveof <masterip> <masterport>
    2. Configure the priority of the replica server to a lower value than the primary server.
      slave-priority 1
      Note: The default priority is 100. You should configure the first replica server and set the priority to 1, then set the priority of the second replica server to 2, and so on.

Sentinel: Automatic fail-over monitoring and configuration

About This Task

This setup will automatically replicate any data changes from the primary Redis server to the replica server. Sentinel will then automatically detect a failure and reconfigure the replica server to be the primary server in the event of failure.

Note: It is recommended that you configure Redis in a primary/replica setup with Sentinel. Perform these steps for each Redis server, and one Sentinel only server.

Procedure

  1. Make changes to the Sentinel "Conf" file:

    sentinel monitor <master-group-name> <master IP> 6379 2 logfile "c:\\ProgramData\\Meridium\\Logs\\redis-sentinel.log"

  2. Install Sentinel:
    redis-server --service-install sentinel.windows.conf --loglevel verbose --service-name Sentinel --sentinel
    Note: By default, the Redis server runs on TCP Port 6379. If using in a non-secure network then the port should be blocked from external access but be accessible from all other sentinels and all Redis servers. Sentinels should be one more than the number of replica servers.
  3. To use GE Digital APM, Redis, and Sentinel in a High Availability Configuration:
    1. On the GE Digital APM Server machine, navigate to the folder C:\ProgramData\Meridium.
    2. Open the file MeridiumAppSettings.xml in an application that you can use to modify XML script (for example, Notepad).
    3. Below the <Cache Service> comment tag, make changes to the following setting:
      • cacheServiceUrl- This should contain connection details to the Redis server setup that will be used for caching. The servers are separated by a comma at the beginning of the connection string and should include the port number, if non-default ports are used.
    4. Within the <appSettings> tag, make changes to following settings:
      • useRedisBackplane : This should be set to true.
      • redisBackplaneUrl : This should contain connection details to the Redis server setup that will be used by GE Digital APM Scheduling Service. The servers are separated by a comma at the beginning of the connection string, and, if non-default ports are used, should include the port number.
    5. For each GE Digital APM Server in the high-availability configuration, repeat steps a through d.
    Note: All servers (GE Digital APM, Redis, and Sentinel) in a High Availability configuration must use the same password.