[redis] Production-level deployment

Table of contents

Environment deployment

redis environment deployment

redis multi-instance configuration

Build redis cluster cluster

cluster production cluster deployment

Cluster cluster failover


Environment deployment


1. Turn off the firewall

 

2. Prepare the configuration contents of two virtual machines as follows:

redis-master

192.168.108.67

7000

redis-master01

7001

redis-master02

7002

redis-master03

redis-slave

192.168.108.189

8000

redis-slave01

8001

redis-slave02

8002

redis-slave03

3. Modify the respective host names redis-master and redis-slave

【192.168.108.67】【redis-master】

【192.168.108.189】【redis-slave】

4. Configure the yum warehouse to put all the original files on the surface

 

 

redis environment deployment


redis compilation, deployment and basic optimization

First, drag the prepared source code package into the virtual machine. You can use the rz command or drag it directly.

 

Then execute the following command

[root@redis-master ~]# yum -y install wget gcc gcc-c++ make tar openssl openssl-devel cmake

[root@redis-master ~]# tar xf redis-4.0.10.tar.gz -C /usr/src/

Unzip the redis-4.0.10.tar.gz file to the /usr/src/ directory

[root@redis-master ~]# cd /usr/src/redis-4.0.10/

Switch to the redis-4.0.10 directory

[root@redis-master redis-4.0.10]# make

Compile Redis

[root@redis-master redis-4.0.10]#make MALLOC=jemalloc #Avoid fragmentation and scalable concurrency support

Using jemalloc as the memory allocator for Redis

[root@redis-master redis-4.0.10]# make PREFIX=/usr/local/redis install

Install the compiled Redis into the /usr/local/redis directory

[root@redis-master redis-4.0.10]# mkdir -p /usr/local/redis/conf

Create a subdirectory named `conf` under the `/usr/local/redis` directory, and if the `/usr/local/redis` directory does not exist, it will also be created

 

 Optimize redis program commands

[root@redis-master redis-4.0.10]# cp sentinel.conf /usr/local/redis/conf/ #redis sentinel configuration file     

Copy the `sentinel.conf` file to the `/usr/local/redis/conf/` directory

[root@redis-master redis-4.0.10]# cp src/redis-trib.rb /usr/local/redis/bin/    #redis-cluster

Copy the `redis-trib.rb` file to the `/usr/local/redis/bin/` directory

 

Create all files in the /usr/local/redis/bin/ directory as soft links in the /usr/local/bin/ directory. In this way, redis-related commands can be used directly in the /usr/local/bin/ directory.

[root@redis-master redis-4.0.10]# ln -s /usr/local/redis/bin/* /usr/local/bin/

 

[redis-slave also needs to install redis, the steps are the same as above]

Redis configuration file streamlined

[root@redis-master redis-4.0.10]# cp redis.conf /usr/local/redis/conf/

Copy the `redis.conf` file in the current directory to the `/usr/local/redis/conf/` directory

[root@redis-master redis-4.0.10]# cd /usr/local/redis/

Enter the `/usr/local/redis/` directory

[root@redis-master redis]# cp conf/redis.conf{,.bak}

Copy the `conf/redis.conf` file and rename it to `conf/redis.conf.bak`

[root@redis-master redis]# egrep -v "^$|^#" conf/redis.conf.bak > conf/redis.conf

Use the `egrep` command to filter empty lines and comment lines starting with `#` in the `conf/redis.conf.bak` file, and output the results to the `conf/redis.conf` file, which is equivalent to removing the empty lines. lines and comments.

System tuning configuration

echo never > /sys/kernel/mm/transparent_hugepage/enabled

Set the enabled status of transparent huge pages to "never", which disables transparent huge pages

echo never > /sys/kernel/mm/transparent_hugepage/defrag

Set the defragmentation status of transparent hugepages to "never", also to disable transparent hugepages

echo 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' >> /etc/rc.local

echo 'echo never >  /sys/kernel/mm/transparent_hugepage/defrag' >> /etc/rc.local

Add the above two commands to the script file `/etc/rc.local` that is executed when the system starts to ensure that transparent huge pages are still disabled after the system restarts.

 

echo "* - nofile 10240" >> /etc/security/limits.conf -- Number of concurrent files

echo "net.core.somaxconn = 10240" >> /etc/sysctl.conf --listening queue

echo "vm.overcommit_memory = 1" >> /etc/sysctl.conf --  0 If the memory is not enough, the application will be rejected

1. Physical memory is allowed to be allocated to you. As long as there is memory, it will be used by you. This can avoid the problem of failure to apply for memory.

sysctl -p

 

redis multi-instance configuration


Operate on redis-master

[root@redis-master ~]# mkdir -p /data/redis-cluster

Create a directory named `redis-cluster` with the path `/data/redis-cluster`. The `-p` option means that if the parent directory does not exist, it will be created automatically.

[root@redis-master ~]# cd /data/redis-cluster

Switch to the `/data/redis-cluster` directory

[root@redis-master redis-cluster]# mkdir 7000 7001 7002

Create three subdirectories in the current directory, namely `7000`, `7001` and `7002`

[root@redis-master redis-cluster]# cp /usr/local/redis/conf/redis.conf /data/redis-cluster/7000/

Copy the `/usr/local/redis/conf/redis.conf` file to the `/data/redis-cluster/7000/` directory

[root@redis-master redis-cluster]# cp /usr/local/redis/conf/redis.conf /data/redis-cluster/7001/

Copy the `/usr/local/redis/conf/redis.conf` file to the `/data/redis-cluster/7001/` directory

[root@redis-master redis-cluster]# cp /usr/local/redis/conf/redis.conf /data/redis-cluster/7002/

Copy the `/usr/local/redis/conf/redis.conf` file to the `/data/redis-cluster/7002/` directory

[root@redis-master redis-cluster]# tree /data/

Display files and subdirectories in the `/data/` directory in a tree structure

 

Operate on redis-slave

[root@redis-slave ~]# mkdir -p /data/redis-cluster

Create a folder named redis-cluster with the path /data/redis-cluster. If the folder on this path does not exist, it will be created automatically.

[root@redis-slave ~]# cd /data/redis-cluster

Enter the redis-cluster folder

[root@redis-slave ~]# mkdir 8000 8001 8002

Create three folders under the redis-cluster folder and name them 8000, 8001 and 8002 respectively.

 

Copy the redis-master configuration file to the redis-slave host

Operate on [root@redis-master ~]#

[root@redis-master ~]#

scp /data/redis-cluster/7000/redis.conf 192.168.108.189:/data/redis-cluster/8000/

Copy the local `/data/redis-cluster/7000/redis.conf` file to the `/data/redis-cluster/8000/` directory of the remote host `192.168.108.189`

[root@redis-master ~]#

scp /data/redis-cluster/7000/redis.conf 192.168.108.189:/data/redis-cluster/8001/

Copy the local `/data/redis-cluster/7000/redis.conf` file to the `/data/redis-cluster/8001/` directory of the remote host `192.168.108.189`

[root@redis-master ~]#

scp /data/redis-cluster/7000/redis.conf 192.168.108.189:/data/redis-cluster/8002/

Copy the local `/data/redis-cluster/7000/redis.conf` file to the `/data/redis-cluster/8002/` directory of the remote host `192.168.108.189`

View on redis-slave [If there is no tree, just install it with the command yum -yinstall tree]

[root@redis-slave ~]# tree /data          displays the directory structure under the `/data` directory

Modify the redis.conf configuration files of redis-master and redis-slave

Configure the reference template and modify the corresponding port in the configuration file

[The red part is the modified content]

[root@redis-master redis-cluster]# vim 7000/redis.conf Open [7001 and 7002 must be configured, just modify the correct port in the following configuration]

cluster-enabled yes

bind 0.0.0.0

port 7000

pidfile /data/redis-cluster/7000/redis.pid

logfile "/data/redis-cluster/7000/redis.log"

dir /data/redis-cluster/7000/

tcp-backlog 1024

timeout 0

tcp-keepalive 0

daemonize yes

loglevel notice

databases 16

stop-writes-on-bgsave-error yes

rdbcompression yes

rdbchecksum yes

dbfilename "dump.rdb"

slave-serve-stale-data yes

slave-read-only yes

repl-diskless-sync no

repl-diskless-sync-delay 5

repl-disable-tcp-nodelay no

slave-priority 100

lazyfree-lazy-eviction no

lazyfree-lazy-expire no

lazyfree-lazy-server-del no

slave-lazy-flush no

appendonly no

appendfilename "appendonly.aof"

appendfsync everysec

no-appendfsync-on-rewrite yes

auto-aof-rewrite-percentage 100

auto-aof-rewrite-min-size 64mb

aof-load-truncated yes

lua-time-limit 5000

slowlog-log-slower-than 10000

slowlog-max-len 128

latency-monitor-threshold 0

notify-keyspace-events ""

hash-max-ziplist-entries 512

hash-max-ziplist-value 64

list-max-ziplist-entries 512

list-max-ziplist-value 64

set-max-intset-entries 512

zset-max-ziplist-entries 128

zset-max-ziplist-value 64

hll-sparse-max-bytes 3000

activerehashing yes

client-output-buffer-limit normal 0 0 0

client-output-buffer-limit slave 256mb 64mb 60

client-output-buffer-limit pubsub 32mb 8mb 60

hz 10

aof-rewrite-incremental-fsync yes

Start multiple instances of redis-master

[root@redis-master ~]#  redis-server /data/redis-cluster/7001/redis.conf

[root@redis-master ~]#  redis-server /data/redis-cluster/7002/redis.conf

[root@redis-master ~]#  redis-server /data/redis-cluster/7000/redis.conf

This is the command to start the Redis cluster. Three Redis nodes are started respectively, corresponding to the port numbers 7000, 7001 and 7002. Each node uses a different configuration file (redis.conf) to configure Redis-related parameters. In this way, distributed storage and high availability of data can be achieved by building a Redis cluster.

If the configuration file is not configured to start, the following effect will occur and needs to be interrupted by ctrl+c.

 

If the configuration is successful, the configuration file starts smoothly

 

Find all Redis-related network connection and process information

[root@redis-master ~]#  netstat -antup | grep redis

 

Build redis cluster cluster


First drag the prepared Ruby source code package into the virtual machine 

[root@redis-master ~]#  tar xf ruby-2.5.1.tar.gz -C /usr/src/

Unzip the ruby-2.5.1.tar.gz file and extract the file contents to the /usr/src/ directory

[root@redis-master ~]#  cd /usr/src/ruby-2.5.1/

Enter the /usr/src/ruby-2.5.1/ directory

 [root@redis-master ruby-2.5.1]#  ./configure && make && make install

Run the configure command to configure the compilation environment. Run the make command to compile Ruby source code. Run the make install command to install the compiled Ruby into the system.

[root@redis-master ruby-2.5.1]#  ruby --version

Run the ruby ​​--version command to view the installed Ruby version

 

Install ruby's redis extension online

[root@redis-master ruby-2.5.1]#  /usr/local/bin/gem install redis

This is a command line instruction used to install the Ruby client library for the Redis database. It will install the Redis client library to your computer so that you can use the Redis database in your Ruby projects

 

Operate on redis-master

[root@redis-master~]#redis-trib.rb create 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002

Used to create a Redis cluster, which contains three nodes, namely 127.0.0.1:7000, 127.0.0.1:7001 and 127.0.0.1:7002. These three nodes will form a Redis cluster to achieve distributed storage and high availability of data.

 

View the cluster cluster’s build node information

[root@redis-master ~]# redis-cli -p 7000 cluster nodes

After executing this command, the Redis server will return a list containing all node information, including the node's ID, IP address, port number, role (master node or slave node), status, etc. This information can help administrators understand the topology and node status of the Redis cluster, and perform cluster management and troubleshooting.

 

ls /data/redis-cluster/7000/

The command will list the files and folders under that path

 

cat /data/redis-cluster/7000/nodes.conf

By viewing the nodes.conf file, you can understand the configuration and status information of each node in the Redis cluster for cluster management and troubleshooting.

 

To use redis-cli to operate the cluster, you need to add the -c parameter

redis-cli -c: Enable cluster mode (follow -ASK and -MOVED redirections).

This is an option for the Redis command line tool redis-cli. The -c option is used to enable Redis cluster mode, which automatically handles node redirection (-ASK and -MOVED) operations in the cluster. In cluster mode, Redis distributes data across multiple nodes and handles data read and write operations through automatic redirection. Use the -c option to ensure redis-cli works properly in cluster mode

Operate on redis-master

[root@redis-master ~]# redis-cli -c -p 7000

127.0.0.1:7000> set name crushlinux

Set the value of the key name "name" to "crushlinux"

127.0.0.1:7001> set age 18

Set the value of the key "age" to "18". These commands are used to set key-value pairs in the Redis database

Decentralization (decentralization refers to the power of the central point), any entrance

 

[root@redis-master ~]# redis-cli -c -p 7000 get name

[root@redis-master ~]# redis-cli -c -p 7001 get name

[root@redis-master ~]# redis-cli -c -p 7002 get name

This is the command using the Redis command line tool redis-cli, where -c means to use cluster mode connection, and -p 7000 means to connect to the Redis instance with port number 7000. get name means getting the value corresponding to the key named name

Operate on redis-slave

[root@redis-slave ~]# redis-cli -h 192.168.108.67 -c -p 7000 get name

This is a command using the Redis command line tool (redis-cli) to connect to the Redis server with the IP address 192.168.108.67 and the port number 7000, and obtain the value corresponding to the key named "name"

Could not connect to Redis at 127.0.0.1:7001: Connection refused #rejected  

Could not connect to Redis at 127.0.0.1:7001: Connection refused

[root@redis-slave ~]# redis-cli -h 192.168.108.67 -c -p 7001 get name

"crushlinux" #Only 7001 succeeded

[root@redis-slave ~]# redis-cli -h 192.168.108.67 -c -p 7002 get name

Could not connect to Redis at 127.0.0.1:7001: Connection refused #rejected  

Could not connect to Redis at 127.0.0.1:7001: Connection refused

When accessing redis-cluster remotely, it was rejected because when we created the cluster, we created it with the local IP of 127.0.0.1, so the cluster cluster can only function when accessed locally.

When accessing port 7001 remotely, the reason why it can be successful is because the data originally exists on redis that listens to port 7001, so we can access it successfully without adding -c.

 

cluster production cluster deployment


Operate on redis-master

[root@redis-master ~]# ls /data/redis-cluster/7000

Used to list files and folders in a specified directory. In this example, `ls /data/redis-cluster/7000` means listing the files and folders in the `/data/redis-cluster/7000` directory

[root@redis-master ~]# ls /data/redis-cluster/7001

[root@redis-master ~]# ls /data/redis-cluster/7002

 

Delete cluster configuration file

[root@redis-master ~]# rm -rf /data/redis-cluster/7000/nodes.conf

[root@redis-master ~]# rm -rf /data/redis-cluster/7001/nodes.conf

[root@redis-master ~]# rm -rf /data/redis-cluster/7002/nodes.conf

Used to delete files or directories under the specified path. Specifically, this command will delete the file with the path "/data/redis-cluster/7000/nodes.conf"

[root@redis-master ~]# redis-cli -p 7000 shutdown

[root@redis-master ~]# redis-cli -p 7001 shutdown

[root@redis-master ~]# redis-cli -p 7002 shutdown

Used to close the instance of the specified port number on the Redis server

 

Start redis-server

[root@redis-master ~]# redis-server /data/redis-cluster/7000/redis.conf

[root@redis-master ~]# redis-server /data/redis-cluster/7001/redis.conf

[root@redis-master ~]# redis-server /data/redis-cluster/7002/redis.conf

 

Recreate the redis-cluster cluster

[root@redis-master ~]# redis-trib.rb create 192.168.108.67:7000 192.168.108.67:7001 192.168.108.67:7002

 

[root@redis-master ~]# ps -ef | grep cluster | grep -v grep

Find and display all running processes containing the "cluster" keyword, excluding the grep command itself

 

[root@redis-slave ~]# redis-cli -h 192.168.108.67 -c -p 7000 set name crushlinux

Use the Redis command line tool (redis-cli) to connect to the Redis server with IP address 192.168.200.111 and port number 7000, and execute a set command. The set command is used to store key-value pairs into the Redis database. Here, the value of the key named "name" is set to "crushlinux"

[root@redis-slave ~]# redis-cli -h 192.168.108.67 -c -p 7001 get name

Use the Redis command line tool (redis-cli) command to connect to the Redis server with the IP address 192.168.200.111 and the port number 7001, and obtain the value corresponding to the key named "name"

[root@redis-slave ~]# redis-cli -h 192.168.108.67 -c -p 7002 get name

Use the Redis command line tool (redis-cli) to connect to the Redis server with the IP address 192.168.200.111 and the port number 7002, and execute the get command to obtain the value of the key "name"

[root@redis-slave ~]# redis-cli -h 192.168.108.67 -c -p 7001

192.168.200.111:7001> get name

Indicates getting the value corresponding to the key named "name"

192.168.200.111:7001> set age 18

Indicates setting the value of the key named "age" to 18

192.168.200.111:7000> get age

Indicates getting the value corresponding to the key named "age"

192.168.200.111:7000> exit

 

Batch import data to observe the cluster distribution of keys

[root@redis-slave ~]# for line in `seq -w 10000`;do redis-cli -h 192.168.108.67 -p 7000 -c set key3_${line} value_${line};done

This code is a loop that sets a series of key-value pairs into the Redis database. Among them, `192.168.108.67` is the IP address of the Redis server, and `7000` is the port number of the Redis server. Loop from 1 to 10000, setting a key-value pair each time. The key format is `key3_number` and the value format is `value_number`. The function of this code is to store a series of key-value pairs into the Redis database

 

Analyze the node distribution of cluster key

[root@redis-slave ~]# redis-cli -h 192.168.108.67 -p 7000 info keyspace

[root@redis-slave ~]# redis-cli -h 192.168.108.67 -p 7001 info keyspace

[root@redis-slave ~]# redis-cli -h 192.168.108.67 -p 7002 info keyspace

Use the Redis command line tool (redis-cli) to query the keyspace information of the specified Redis server (192.168.108.67) and port number (7000).

 

Cluster cluster failover


Start all slave libraries on redis-slave

[root@redis-slave ~]# redis-server /data/redis-cluster/8000/redis.conf

[root@redis-slave ~]# redis-server /data/redis-cluster/8001/redis.conf

[root@redis-slave ~]# redis-server /data/redis-cluster/8002/redis.conf

[root@redis-slave ~]# netstat -lnpt | grep redis

 

Add redis-cluster cluster slave library, operate on redis-master

Add the first set of slave servers

[root@redis-master ~]#  redis-trib.rb add-node --slave 192.168.108.189:8000 192.168.108.67:7000

Add 192.168.108.189:8000 to the Redis cluster as the slave node of 192.168.108.67:7000. The slave node will copy the data of the master node

 

Add a second set of slave servers

[root@redis-master ~]# redis-trib.rb add-node --slave 192.168.108.189:8001 192.168.108.67:7001

 

Add a third group of slave servers

[root@redis-master ~]# redis-trib.rb add-node --slave 192.168.108.189:8002 192.168.108.67:7002

 

View information about all nodes in the cluster

[root@redis-master ~]# redis-cli -p 7000 cluster nodes

 

Slave read and write test from library

[root@redis-slave ~]# redis-cli -h 192.168.108.189 -c -p 8000

192.168.200.112:8000> set address beijing

It means setting the address to Beijing. This sentence may be discussing or setting the address information of a certain place, setting it as Beijing

 

[root@redis-slave ~]# redis-cli -h 192.168.108.189 -c -p 8000 get address

[root@redis-slave ~]# redis-cli -h 192.168.108.189 -c -p 8001 get address

[root@redis-slave ~]# redis-cli -h 192.168.108.189 -c -p 8002 get address

Use the Redis command line tool (redis-cli) command to connect to the Redis server with the IP address 192.168.108.189 and the port number 8000, and obtain the value corresponding to the key named "address"

[root@redis-slave ~]# redis-cli -h 192.168.108.67 -c -p 7000 get address

[root@redis-slave ~]# redis-cli -h 192.168.108.67 -c -p 7001 get address

[root@redis-slave ~]# redis-cli -h 192.168.108.67 -c -p 7002 get address

Use the Redis command line tool (redis-cli) to connect to the Redis cluster with the IP address 192.168.108.67 and the port number 7000, and execute the get command to obtain the value of the key "address"

 Through testing, we found that the redis cluster cluster can perform set and get regardless of the main library or the slave library. Therefore, we do not need to go to the main library during use.

Check the distribution of master-slave cluster keys

[root@redis-slave ~]# redis-cli -h 192.168.108.189 -c -p 8000 info Keyspace

[root@redis-slave ~]# redis-cli -h 192.168.108.189 -c -p 8001 info Keyspace

[root@redis-slave ~]# redis-cli -h 192.168.108.189 -c -p 8002 info Keyspace

[root@redis-slave ~]# redis-cli -h 192.168.108.67 -c -p 7000 info Keyspace

[root@redis-slave ~]# redis-cli -h 192.168.108.67 -c -p 7001 info Keyspace

[root@redis-slave ~]# redis-cli -h 192.168.108.67 -c -p 7002 info Keyspace

Use the command "info Keyspace" to obtain information about all keyspaces in the Redis instance, including the number of key-value pairs in each keyspace, the number of expired key-value pairs, etc.

 

The master-slave of the redis cluster automatically switches. After the main database hangs up, the slave automatically becomes the master.

Manually switch master-slave command cluster failover

[root@redis-slave ~]# redis-cli -h 192.168.108.67 -p 7000 shutdown

Used to shut down the Redis server on the specified host and port. In this command, the `-h` parameter specifies the host address to be connected, the `-p` parameter specifies the port number to be connected, and `shutdown` means to shut down the Redis server. So, `redis-cli -h 192.168.108.67 -p 7000 shutdown` means to shut down the Redis server on port 7000 of the 192.168.108.67 host

[root@redis-slave ~]# redis-cli -h 192.168.108.189 -p 8000 cluster nodes

View the status and information of each node in the Redis cluster

 

Manually down the redis-server on port 7000. I learned from the information that 7000 was down and 8000 was switched to master.

Restart the server on port 7000 and check again

[root@redis-master ~]# redis-server /data/redis-cluster/7000/redis.conf

Start the Redis server and specify the path of the configuration file as `/data/redis-cluster/7000/redis.conf`. Redis is an open source in-memory database used to store and retrieve data. By specifying the configuration file path, specific configuration options can be loaded to meet different needs and configuration requirements. In this example, the command will start the Redis server and configure it using the configuration file in the specified path

[root@redis-slave ~]# redis-cli -h 192.168.108.189 -p 8000 cluster node

View the status and information of each node in the Redis cluster

 From the information, we learned that after the redis of 7000 was started, it became a slave.

Manually switch redis-server port 7000 to the main database

[root@redis-slave ~]# redis-cli -h 192.168.108.67 -c -p 7000 cluster failover

Failover is the process of promoting a slave node to a new master node when a master node failure occurs in a Redis cluster. The purpose of this command is to manually trigger a failover operation and switch the master node of the specified node to a slave node.

[root@redis-slave ~]# redis-cli -h 192.168.108.189 -p 8000 cluster nodes

 

Delete node

[root@redis-master ~]# redis-cli -h 192.168.108.189 -p 8000 cluster nodes

[root@redis-master ~]# redis-trib.rb del-node 192.168.108.189:8001 d6af56ec537be64e646212e1739705653e979643

The command of the Redis cluster management tool redis-trib.rb is used to delete the specified node from the Redis cluster. The specific meaning of the command is as follows:

- `redis-trib.rb`: The name of the Redis cluster management tool.

- `del-node`: The operation of the command, which means deleting the node.

- `192.168.108.189:8001`: IP address and port number of the node to be deleted.

- `d6af56ec537be64e646212e1739705653e979643`: ID of the node to be deleted

What follows at the end is the ID of the node, which can be viewed using cluster nodes in the redis-cli terminal.

 

repair node

[root@redis-master ~]# redis-trib.rb add-node --slave 192.168.108.189:8001 192.168.108.67:7001

The function of this command is to add `192.168.108.189:8001` to the slave node list of the `192.168.108.67:7001` master node. The slave node will replicate the data of the master node and provide read services when the master node is unavailable.

Found an error (please do the following first)

 

Clear existing data on node 8001

[root@redis-slave ~]#kill -9 67708

used to terminate the process

[root@redis-slave ~]# rm -rf /data/redis-cluster/8001/dump.rdb

This is a Linux command used to delete files or directories under a specified path. Specifically, this command will delete the file with the path "/data/redis-cluster/8001/dump.rdb"

[root@redis-slave ~]# rm -rf /data/redis-cluster/8001/nodes.conf

Used to delete files or directories under the specified path. Specifically, this command will delete the file with the path "/data/redis-cluster/8001/nodes.conf"

[root@redis-slave ~]# rm -rf /data/redis-cluster/8001/redis.pid

Used to delete files or directories under the specified path. Specifically, `rm` is the delete command and `-rf` is the option, which means to recursively delete the directory and its contents without prompting for confirmation.

[root@redis-slave ~]# redis-server /data/redis-cluster/8001/redis.conf

A process named redis-server will be started and the specified configuration file (/data/redis-cluster/8001/redis.conf) will be used to configure the server's behavior. With this command, you can start a Redis server instance and configure it as needed

[root@redis-master ~]# redis-trib.rb add-node --slave 192.168.200.112:8001 192.168.200.111:7001

View the process netstat -anputl | grep redis

 

 

After completing the above steps, the verification is successful again.

 

 

Guess you like

Origin blog.csdn.net/2302_77750172/article/details/131527510