logo

Migrating User Session Storage to Redis

For correct operation of ELMA with multiple web servers and/or system users, you need to use a network data storage that would store user sessions.

Redis (remote dictionary server) — is an open source data storage of the key - value type. This is a non-SQL high-performance DBMS.

Note
Redis versions are supported only for Unix-like operating systems.

This article describes how to install and configure Redis network data storage.

Configuring OS

1. Install Redis via the command prompt: 

sudo apt update 
sudo apt full-upgrade 
sudo apt-get install redis

2. In the configuration file /etc/redis/redis.config do the following:

  • comment out the line with the IP address (Bind 127.0.0.1:1) or change the IP address to your own;
  • set a password for accessing Redis (Requirepass MyPassword).

3. Start Redis with the command /etc/init.d/redis-server start.

Configuring ELMA

1. Next, copy the Redis libraries to ../<ELMA directory>/Web/bin/.

2. In the configuration file ../<ELMA directory>/Web/Web.config do the following:

  • Replace the line 
    <sessionState mode="InProc" timeout="30"/>​

with

<sessionState mode="Custom" customProvider="MySessionStateStore">
    <providers>
      <add type = "Microsoft.Web.Redis.RedisSessionStateProvider"
         name = "MySessionStateStore"
         connectionString = "machine1:6379, password= MyPassword,abortConnect=False"/>
    </providers>
  </sessionState>
  • where machine1:6379 is the port you are using, and MyPassword is the server password.

  • Comment out the blocks of lines as shown below: 
    <!--<remove name="Session" />-->
    <!--<add name="Session" type="EleWise.ELMA.Web.Mvc.Modules.ELMASessionStateModule, EleWise.ELMA.SDK.Web" />-->
Note

There are several lines of blocks in the configuration file.

Redis configuration is complete.