当前位置:网站首页>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] realize the animation production of mapping tripod deployment
- Machine learning -- neural network
- PHP reads the INI file and writes the modified content
- 程序员应该怎么学数学
- Threejs implements labels and displays labels with custom styles
- A solution to the problem that variables cannot change dynamically when debugging in keil5
- How to remove installed elpa package
- All in one 1413: determine base
- Realize the attention function of the article in the applet
猜你喜欢
[illusory engine UE] method to realize close-range rotation of operating objects under fuzzy background and pit recording
[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)
Threejs Internet of things, 3D visualization of factory
Threejs Internet of things, 3D visualization of farm (III) model display, track controller setting, model moving along the route, model adding frame, custom style display label, click the model to obt
How to realize real-time audio and video chat function
Interview related high-frequency algorithm test site 3
[phantom engine UE] the difference between running and starting, and the analysis of common problems
Function (error prone)
程序员应该怎么学数学
Key review route of probability theory and mathematical statistics examination
随机推荐
Looking back on 2021, looking forward to 2022 | a year between CSDN and me
Mxnet imports various libcudarts * so、 libcuda*. So not found
Uncover the seven quirky brain circuits necessary for technology leaders
Threejs realizes the drawing of the earth, geographical location annotation, longitude and latitude conversion of world coordinates threejs coordinates
Technical tutorial: how to use easydss to push live streaming to qiniu cloud?
Aperçu en direct | Services de conteneurs ACK flexible Prediction Best Practices
指针函数(基础)
How to carry out "small step reconstruction"?
[untitled]
【thingsboard】替换首页logo的方法
MacBook安装postgreSQL+postgis
Neural networks and deep learning Chapter 2: machine learning overview reading questions
[thingsboard] how to replace the homepage logo
A solution to the problem that variables cannot change dynamically when debugging in keil5
程序员应该怎么学数学
[Chongqing Guangdong education] 2408t Chinese contemporary literature reference test in autumn 2018 of the National Open University
The development of mobile IM based on TCP still needs to keep the heartbeat alive
【虚幻引擎UE】实现背景模糊下近景旋转操作物体的方法及踩坑记录
Leetcode hot topic Hot 100 day 33: "subset"
快手、抖音、视频号交战内容付费