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

Steps to set up and configure a redis cluster

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

The editor in this issue will bring you the steps of building and configuring redis clusters, and analyze and describe them from a professional point of view. I hope you can get something after reading this article.

Redis cluster needs at least 3 nodes, because the voting fault tolerance mechanism requires more than half of the nodes to think that a node is dead, so two nodes cannot form a cluster.

A cluster with three nodes in a cluster, with one master and one standby for each node. Six virtual machines are required. Build a pseudo-distributed cluster and simulate it with 6 redis instances.

1. Install the ruby environment

Yum install ruby//ruby Runtime Environment yum install rubygems//ruby package Manager uploads redis-3.0.0.gem to the server (the package on which redis-trib.rb runs) gem installe redis-3.0.0.gem (installs the dependent package)

two。 Set up a cluster

(1) copy bin

Mkdir redis-cluster cd rediscp-r bin.. / redis-cluster/redis01 / / copy

(2) configuration file modification

Cd.. / redis-cluster/redis01/rm-f dump.rdb (delete snapshot file) vim redis.conf

Modify:

Port 7001cluster-enabled yes

(3) create six nodes

Cp-r redis01/ redis02 (all the way to 6) vim redis02/redis.conf (change the port number respectively)

(4) copy the cluster script to the cluster directory

Cd redis-3.0.0/src cp * .rb / usr/local/redis-cluster/

(5) run 6 redis instances

Vim startall.shcd redis01. / redis-server redis.confcd.. cd redis02. / redis-server redis.confcd.. cd redis03. / redis-server redis.confcd.. cd redis04. / redis-server redis.confcd.. cd redis05. / redis-server redis.confcd.. cd redis06. / redis-server redis.confcd. / startall.sh

(6) create a cluster

/ redis-trib.rb create-- replicas 1 192.168.25.153VR 7002 192.168.25.153VR 7002 192.168.25.153VR 7004 192.168.25.153VR 7005 192.168.25.153VR 7006 above are the steps for building and configuring redis cluster shared by Xiaobian. If you have similar doubts, please refer to the above analysis to understand. If you want to know more about it, please follow the industry information.

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

Database

Wechat

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

12
Report