当前位置:网站首页>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
边栏推荐
- [phantom engine UE] only six steps are needed to realize the deployment of ue5 pixel stream and avoid detours! (the principles of 4.26 and 4.27 are similar)
- WeNet:面向工业落地的E2E语音识别工具
- 蛇形矩阵
- [untitled]
- 函数(易错)
- Mxnet imports various libcudarts * so、 libcuda*. So not found
- Ctfshow web entry code audit
- Is "golden nine and silver ten" the best time to find a job? Not necessarily
- What are the building energy-saving software
- Leetcode hot topic Hot 100 day 33: "subset"
猜你喜欢
随机推荐
[Chongqing Guangdong education] 2408t Chinese contemporary literature reference test in autumn 2018 of the National Open University
解密函数计算异步任务能力之「任务的状态及生命周期管理」
MySQL: view with subquery in the from clause limit
Is "golden nine and silver ten" the best time to find a job? Not necessarily
Practice | mobile end practice
Looking back on 2021, looking forward to 2022 | a year between CSDN and me
Live broadcast preview | container service ack elasticity prediction best practice
Mxnet imports various libcudarts * so、 libcuda*. So not found
PHP reads the INI file and writes the modified content
【FineBI】使用FineBI制作自定义地图过程
Invalid bound statement (not found) in idea -- problem solving
小程序中实现文章的关注功能
Leetcode hot topic Hot 100 day 33: "subset"
WeNet:面向工业落地的E2E语音识别工具
【虚幻引擎UE】实现测绘三脚架展开动画制作
Threejs factory model 3DMAX model obj+mtl format, source file download
【虛幻引擎UE】實現UE5像素流部署僅需六步操作少走彎路!(4.26和4.27原理類似)
【UNIAPP】系统热更新实现思路
Power management bus (pmbus)
[thingsboard] how to replace the homepage logo