Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Linux redis-Sentinel configuration details

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

download

Download address: https://redis.io/download

Perform the download in the / usr/local/src directory.

Wget http://download.redis.io/releases/redis-3.2.8.tar.gz

Installation

Extract it to the / usr/local/src directory and put the source code package.

Tar xzf redis-3.2.8.tar.gz

Create a directory / usr/local/redis:

Make dir / usr/local/redis

Enter the source directory:

Cd / usr/local/src/redis-3.2.8

Then execute the following make command to compile and install to the directory / usr/local/redis/ (put the execution file).

Make PREFIX=/usr/local/redis install

Soft connection

The program makes a soft connection to the bin directory to facilitate direct execution.

Ln-s / usr/local/redis/bin/redis-cli / usr/local/bin/redis-cliln-s / usr/local/redis/bin/redis-sentinel / usr/local/bin/redis-sentinelln-s / usr/local/redis/bin/redis-server / usr/local/bin/redis-server

Configuration file

Copy the configuration file. There are sentinel.conf and redis.conf files in the source package. Copy them to the / etc/redis/ directory. If there are multiple instances, it is recommended to change the name. For example, the redis port used in this example is 7021 and sentinel is 17021:

Mkdir / etc/rediscp / usr/local/src/redis-3.2.8/redis.conf / etc/redis/redis_6379.conf cp / usr/local/src/redis-3.2.8/sentinel.conf / etc/redis/sentinel_26379.conf

Redis_master_6379.conf configuration

Modify the following parameters for configuration:

Port 6379daemonize yes#requirepass 123456#masterauth 123456

Where the daemonize property is changed to yes (running in the background).

Redis_slave_6380.conf configuration:

Modify the following parameters for configuration:

Port 6380daemonize yes#requirepass yingjunslaveof 192.168.248.128 6379masterauth 123456

Other slave configurations are the same as this configuration.

Sentinel_26379.conf configuration

Port 23791daemonize yeslogfile "/ var/log/sentinel_63791.log" # master-1sentinel monitor master-1 192.168.248.128 6379 2#sentinel auth-pass master-1 yingjun

Sentinel_26380.conf configuration

Port 23780daemonize yeslogfile "/ var/log/sentinel_63780.log" # master-1sentinel monitor master-1 192.168.248.128 6379 2#sentinel auth-pass master-1 yingjun

Start

Start the services sequentially.

Redis-server / etc/redis/redis_master_6379.confredis-server / etc/redis/redis_slave_6380.conf redis-sentinel / etc/redis/sentinel_26379.confredis-sentinel / etc/redis/sentinel_26380.conf

Check to see if all processes have been started

[root@iZj6cqZ redis] # ps-ef | grep redisroot 10910 10 08:11? 00:00:00 redis-server 127.0.0.1:6379root 10918 08:11? 00:00:00 redis-server 127.0.0.1:6380root 10939 08:15? 00:00:00 redis-sentinel *: 26379 [sentinel] root 10944 10 08:15? 00:00:00 redis-sentinel *: 26380 [sentinel] root 10948 10851 0 08:15 pts/1 00:00:00 grep-- color=auto redis

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report