Redis Stack Server

type access

  • Operating System:

  • Terminal:

  • Shell:

  • Editor:

  • Package Manager:

  • Programming Language:

  • Database:

  • Extension:

type access

  • Operating System:

  • Terminal:

  • Shell:

  • Editor:

  • Package Manager:

  • Programming Language:

  • Database:

  • Extension:

Redis (Remote Dictionary Server) is an open source, in-memory data structure store used as a database, cache, message broker, and streaming engine.

Redis is an in-memory database that also persists data on disk, offering a unique balance: it achieves exceptionally high read and write speeds, but with the limitation that data sets must fit within the available memory.

Initialization

For information on how to use the Initialization parameter, please refer to the Initialization: Bash Script section of the documentation.

Start a New Server

The app starts a Redis server and an instance of RedisInsight, a powerful web interface for Redis.

drawing

RedisInsight combines a graphical user interface with Redis CLI. It allows to visually browse and interact with data, take advantage of diagnostic tools, and learn by example.

By default Redis server and RedisInsight data are stored in /data/redis and /data/redisinsight, respectively. The user can set the Redis data and RedisInsight data optional parameters to load/create persistent database instances.

Schedule Regular Backups

The app provides an option to schedule backups of Redis server databases on an hourly basis. A custom setup can be specified via the REDIS_ARGS optional parameter (see example below).

Set Login Credentials

By default the server doesn't have any authentication. To set a username and password for Redis one should pass an Access Control List (ACL) file using the Redis ACL optional parameter.

An example for this file is the following:

user default on >admin_pass ~* &* +@all
user user1 on >user1_pass ~keys:* +get +set
user user2 on >user2_pass ~keys:* +get +set
user user3 off >user3_pass -@all +ping

The file defines a list of users, each with username, password and specific permissions. For example, the default user has access to every possible key (~*) and Pub/Sub channel (&*), and can call every possible command (+@all).

For more information and rules check here.

Customize Server Configuration

By default Redis server will listen to port 6379. This value can be changed using the Redis server port optional parameter.

To pass in additional configuration changes, one can use any of these optional parameters:

  • REDIS_ARGS: extra argument for Redis.

    • Example: --requirepass admin_password.

    • Example: --save 60 1000 appendonly yes.

  • REDISSEARCH_ARGS: arguments for the search and query features (RediSearch).

  • REDISJSON_ARGS: arguments for JSON (RedisJSON).

  • REDISTIMESERIES_ARGS: arguments for time series (RedisTimeSeries).

    • Example: RETENTION_POLICY=20.

  • REDISBLOOM_ARGS: arguments for the probabilistic data structures (RedisBloom).

  • REDISGEARS_ARGS: arguments for triggers and functions (RedisGears).

Note

All custom settings can be specified in a single file using the Redis server configuration option. This will overwrite all other optional parameters. For more information check here.

Connect to the Server

Users can access Redis databases from the integrated RedisInsight web interface or from of the default app terminal interface, using the Redis CLI:

$ redis-cli --user <username> --pass <password>

assuming the Redis server was started with login credentials. Other client libraries are listed here.

If the client is installed in an interactive app available on UCloud, it's straightforward to establish a connection directly to the server as detailed here. In this case the server's hostname should be set as an external parameter via the Connect to other jobs optional setting.

Conversely, if the client is on a remote host, it is necessary to allocate a static IP address to the Redis server. Then, the bind IP address can be specified using the REDIS_ARGS optional parameter, with the argument: --bind <public_ip>.

Note

The static IP address must listen to the same port as the Redis server to establish a remote connection.