当前位置:网站首页>Setting up redis cluster cluster under Windows
Setting up redis cluster cluster under Windows
2022-07-05 04:27:00 【Eleven elder sister】
Catalog
One 、 Download and install
You need to download the following three :
Redis、Ruby Language environment 、Redis Of Ruby drive redis-3.2.2.gem
1、Redis-x64-5.0.14.1.zip download , 6 platform redis The server , Build pseudo clusters , And run on different ports 6380-6385
2、Ruby download ,ruby Script to build the cluster , All the way next, Finally, uncheck ,finish, then cmd It outputs
ruby -v
Represents a successful installation3、 install Redis Of Ruby drive rubygems download , It's a tool for Ruby Components are packaged Ruby Packing system ; Decompress after downloading , Then open the command window and switch to the decompression directory , Carry out orders
ruby setup.rb
Two 、 build Redis colony
For the cluster to function properly, at least 3 Main node , Recommended configuration 3 Main node , rest 3 As the slave nodes of each master node ( It is also the mode recommended by the official website ), Simulate through different ports of the same computer
1、 Create a new folder Redis-cluster, And download the above
Redis-x64-5.0.14.1.zip
unpack , And rename the folder to 63802、 open 6380 A file in a directory
redis.windows.conf
, Modify the port number inside port by 6380, The main changes are as follows ,1. port 6380 // Change to the same port number as the current folder name 2. appendonly yes // Specifies whether to log after each update operation ,Redis stay By default, data is written to disk asynchronously , If you don't turn it on , It may lead to 4. Cause data loss for a period of time . yes Express : storage ,aof, Save the write operation record to the log 3. cluster-enabled yes // Turn on cluster mode 4. cluster-config-file nodes-6380.conf // Save node configuration , Automatically create , Auto update ( It is recommended to add port number when naming ) 5. cluster-node-timeout 15000 // Cluster timeout , If the node does not respond after this time, it is determined to be down
3、 stay 6380 New file in directory
start.bat
, The contents are as follows , It is used to enter the folder named by each port to start the servicetitle redis-6380 redis-server.exe redis.windows.conf
4、 Copy 6380 Folder , And rename to 6381-6385, At the same time, modify the
redis.windows.con
Andstart.bat
The port number in the file , take 6380 Replace with the corresponding 6381-63855、 Open any cmd Window execution
gem install redis
6、 Build cluster scripts , from 6380 Copy and paste under the directory
redis-cli.exe
To Redis-cluster Under the table of contents ,meanwhile 6380~6385 Under each directory start.bat Double click the file to run without closing !!!
7、 Then in the present Redis-cluster Open in directory cmd window , Execute the following command , Now the cluster is built
redis-cli --cluster create 127.0.0.1:6380 127.0.0.1:6381 127.0.0.1:6382 127.0.0.1:6383 127.0.0.1:6384 127.0.0.1:6385 --cluster-replicas 1
3、 ... and 、 Cluster environment test
- Reference documents
redis-cli -c -h 127.0.0.1 -p 6380
- View cluster information :
cluster info
- View master-slave relationship :
info replication
, Cluster nodes are arranged from left to right from master to slave 6 individual redis node , So it can also be seen that 6380,6381,6382 Three are the master nodes ,6383,6384,6385 There are three slave nodes , The correspondence is : Lord 6380 from 6383 - View the node assignments slot:
cluster nodes
Four 、 take redis-cluster Registered student windows service
Console launch redis server If the console is closed redis server Will be shut down together , Then we need to let redis Running in the background requires redis server register as windows service , And then again start
So we can solve the above problems in the following ways , To 6380-6385 Rename services respectively under the directory , And start the ,
Please ensure that at least three master node services have been started in the background , Otherwise, it will cause the connection redis-cluster, But it can't connect to the inside db0
# adopt service-name start-up redis service : redis-server --service-install redis.windows.conf --service-name redis6380 --loglevel verbose redis-server --service-start --service-name redis6380 # adopt service-name stop it redis service : redis-server --service-stop --service-name redis6380
If the service fails to start , Open as administrator cmd perform
SC delete The service name
, Then when the corresponding directory is rebuilt
5、 ... and 、 open redis Visualization tools , The connection is successful as shown in the figure
- Pictured , Test connection successful
- The default is 127.0.0.1 You can visit , Modified as follows .conf, You can modify bind Designated LAN ip visit ,
After modifying the configuration , You need to restart the service to take effect
边栏推荐
- MacBook installation postgresql+postgis
- Practice | mobile end practice
- 取余操作是一个哈希函数
- Learning notes 8
- Threejs realizes rain, snow, overcast, sunny, flame
- Ctfshow web entry code audit
- Introduction to RT thread kernel (5) -- memory management
- [untitled]
- Is there a sudden failure on the line? How to make emergency diagnosis, troubleshooting and recovery
- Leetcode hot topic Hot 100 day 33: "subset"
猜你喜欢
American 5g open ran suffered another major setback, and its attempt to counter China's 5g technology has failed
官宣!第三届云原生编程挑战赛正式启动!
TPG x AIDU|AI领军人才招募计划进行中!
如何优雅的获取每个分组的前几条数据
假设检验——《概率论与数理统计》第八章学习笔记
首席信息官如何利用业务分析构建业务价值?
10 programming habits that web developers should develop
Fuel consumption calculator
[uniapp] system hot update implementation ideas
Threejs realizes the drawing of the earth, geographical location annotation, longitude and latitude conversion of world coordinates threejs coordinates
随机推荐
Threejs implements labels and displays labels with custom styles
Hexadecimal to decimal
Neural networks and deep learning Chapter 2: machine learning overview reading questions
Advanced length of redis -- deletion strategy, master-slave replication, sentinel mode
Threejs rendering obj+mtl model source code, 3D factory model
指针函数(基础)
Introduction to RT thread kernel (5) -- memory management
Fuel consumption calculator
How to get the first few pieces of data of each group gracefully
3 minutes learn to create Google account and email detailed tutorial!
PHP读取ini文件并修改内容写入
C26451: arithmetic overflow: use the operator * on a 4-byte value, and then convert the result to an 8-byte value. To avoid overflow, cast the value to wide type before calling the operator * (io.2)
web资源部署后navigator获取不到mediaDevices实例的解决方案(navigator.mediaDevices为undefined)
Realize the attention function of the article in the applet
【虛幻引擎UE】實現UE5像素流部署僅需六步操作少走彎路!(4.26和4.27原理類似)
The development of mobile IM based on TCP still needs to keep the heartbeat alive
About the project error reporting solution of mpaas Pb access mode adapting to 64 bit CPU architecture
Judge whether the stack order is reasonable according to the stack order
自动语音识别(ASR)研究综述
Uncover the seven quirky brain circuits necessary for technology leaders