redis clusters simple rough handling

Note that this is done with the cache server, rather than persistent, persistent need to open the AOF and RDB

Here is the cluster cluster configuration, multi-master multi-slave cluster

Two servers, the main 3 from 3

Table

1 server Server 2
192.168.17.135:6379 192.168.17.137:6380
192.168.17.135:6381 192.168.17.137:6382
192.168.17.135:6384 192.168.17.137:6383

 

initial

Step 1: Open  https://redis.io
download the latest stable version redis5
Step 2: ssh to the server, recommended here finalShell, do not ask why, because free ah Big Brother

Step 3: decompress the compressed packet command, where the decompression line are generally root line

tar -zxvf redis-5.0.5.tar.gz 

Step 4: Rename the folder

mv redis-5.0.5 redis

Step 5: cd redis redis into the root directory, execute  make  command to compile the source code

Redis will be put to the Linux operating system, and then extract, go to the next redis-5.0.5 directory:

If the above error occurs when using the make command, execute the following command installation, which is untreated make installation, other questions please yourself Baidu:

apt install gcc automake autoconf libtool make
Run make command again, if something goes wrong, you can use the following command:
make MALLOC=libc

  

Start Redis, into the src directory and execute the following command:

./redis-server

That is the successful launch of a successful installation.

 

Mid - to modify the configuration file

A. New rediscluster extract the files in the directory redis folder, copy the files in redis redis.conf decompression rediscluster directory to the directory, the file six copies, the names are as follows:

  • repeat-6379.conf

  • repeat-6380.conf

  • repeat-6381.conf

  • repeat-6382.conf

  • repeat-6383.conf

  • repeat-6384.conf

B. In a redis-6379.conf file, for example, modify the contents, the modified portion as follows:

You can specify a particular bind 0.0.0.0 # ip, this is to allow all ip 
Port # 6379 Port Cluster-Enabled yes Cluster-config-File /redis/nodes/nodes-6379.conf # attention! ! ! We need to create a folder, run redis-serve file will be automatically generated node cluster-node-timeout 15000 # node failure

Then enter redis root of the boot all servers

src/redis-server ../rediscluster/redis-6379.conf > /dev/null &
src/redis-server ../rediscluster/redis-6381.conf > /dev/null &
src/redis-server ../rediscluster/redis-6384.conf > /dev/null &

src/redis-server ../rediscluster/redis-6380.conf > /dev/null &
src/redis-server ../rediscluster/redis-6382.conf > /dev/null &
src/redis-server ../rediscluster/redis-6383.conf > /dev/null &

 

高潮-集群启动

配置集群与启动

#主机M放前面,后面防止从机
src/redis-cli --cluster create 192.168.17.135:6379 192.168.17.135:6381 192.168.17.137:6383 192.168.17.137:6380 192.168.17.137:6382 192.168.17.135:6384 --cluster-replicas 1

 

ok 至此集群配置完成

进入集群 测试一把

src/redis-cli -h localhost -p 6379 -c

 

好用请给好评哈

Guess you like

Origin www.cnblogs.com/theworld/p/12112506.html