Redis Sentinel Reset

Posted onby admin

Cheatsheet

Introduction

Redis is an open-source, in-memory key-value data store. Redis has several commands that allow you to make changes to the Redis server’s configuration settings on the fly. This tutorial will go over some of these commands, and also explain how to make these configuration changes permanent.

How To Use This Guide

This guide is written as a cheat sheet with self-contained examples. We encourage you to jump to any section that is relevant to the task you’re trying to complete.

目前 Sentinel 系统是 Redis 的 unstable 分支的一部分, 你必须到 Redis 项目的 Github 页面 克隆一份 unstable 分值, 然后通过编译来获得 Sentinel 系统。. Sentinel 程序可以在编译后的 src 文档中发现, 它是一个命名为 redis-sentinel 的程序。. 你也可以通过下一节介绍的方法, 让 redis-server 程序. 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. VM Instance Name Apps / Services IP Address; Instance 01: haproxy-01: HAProxy: 192.168.1.10: Instance 02: redis-01: Redis, Sentinel (Master) 192.168.1.11: Instance 03. Redis connection reset (ECONNRESET) Connecting to Redis via the CLI. Configuring Redis Using an alternate local Redis instance. If you use Redis Sentinel, do not activate client support for SSL. Redis 6 supports SSL, and you can configure it to work with GitLab only as an external service.

The commands shown in this guide were tested on an Ubuntu 18.04 server running Redis version 4.0.9. To set up a similar environment, you can follow Step 1 of our guide on How To Install and Secure Redis on Ubuntu 18.04. We will demonstrate how these commands behave by running them with redis-cli, the Redis command line interface. Note that if you’re using a different Redis interface — Redli, for example — the exact output of certain commands may differ.

Be aware that managed Redis databases typically do not allow users to alter the configuration file. If you’re working with a Managed Database from DigitalOcean, the commands outlined in this guide will result in errors.

Changing Redis’s Configuration

The commands outlined in this section will only alter the Redis server’s behavior for the duration of the current session, or until you run config rewrite which will make them permanent. You can alter the Redis configuration file directly by opening and editing it with your preferred text editor. For example, you can use nano to do so:

Redis Sentinel Reset

Warning: The config set command is considered dangerous. By changing your Redis configuration file, it’s possible that you will cause your Redis server to behave in unexpected or undesirable ways. We recommend that you only run the config set command if you are testing out its behavior or you’re absolutely certain that you want to make changes to your Redis configuration.

Redis Sentinel Reset

It may be in your interest to rename this command to something with a lower likelihood of being run accidentally.

config set allows you to reconfigure Redis at runtime without having to restart the service. It uses the following syntax:

For example, if you wanted to change the name of the database dump file Redis will produce after you run a save command, you might run a command like the following:

If the configuration change is valid, the command will return OK. Otherwise it will return an error.

Note: Not every parameter in the redis.conf file can be changed with a config set operation. For example, you cannot change the authentication password defined by the requirepass parameter.

Cluster

Making Configuration Changes Permanent

config set does not permanently alter the Redis instance’s configuration file; it only changes Redis’s behavior at runtime. To edit redis.conf after running a config-set command and make the current session’s configuration permanent, run config rewrite:

This command does its best to preserve the comments and overall structure of the original redis.conf file, with only minimal changes to match the settings currently used by the server.

Like config set, if the rewrite is successful config rewrite will return OK.

Checking Redis’s Configuration

Redis Sentinel Config

To read the current configuration parameters of a Redis server, run the config get command. config get takes a single argument, which can be either an exact match of a parameter used in redis.conf or a glob pattern. For example:

Redis sentinel configuration

Redis Sentinel Cluster Setup

Depending on your Redis configuration, this command might return:

You can also return all of the configuration parameters supported by config set by running config get *.

Conclusion

This guide details the redis-cli commands used to make changes to a Redis server’s configuration file on the fly. If there are other related commands, arguments, or procedures you’d like to see outlined in this guide, please ask or make suggestions in the comments below.

Redis sentinel reset command

Redis Cli Sentinel

For more information on Redis commands, see our tutorial series on How to Manage a Redis Database.