Environment and reference materials
1.windows server R2 Enterprise (Wood has a way, the company's servers are all so, this environment to build it)
2.redis Official information Download: Https://redis.io/download
3.redis official does not provide the relevant package, but Microsoft Open Tech Group provides and maintains the relevant Redis installation package Https://github.com/MSOpenTech/redis (only 64-bit programs are available)
Here's to say that many of the company's Redis are deployed on Linux, and I'm just here to install a Redis cluster in a window environment.
Install package download
1.Redis 3.2 release version. msi
Once the installation is successful, a single Redis service is installed here. Locate the installation path, the current machine is installed in: D:\Redis
Open the console with the administrator, drag the redis-cli.exe into it, enter, surprise to see, I installed successfully, the installation of successful partners to find their own problems. Simply add a few data
Set a test
Get a
Like, it all worked out.
2.Ruby Environment
The reason for installing this environment is because we need to use REDIS-TRIB.RB in Ruby Gems to create and manipulate clusters.
3.Ruby Gems
Use this Ruby package management to get operations on the Redis cluster redis-trib.rb
3.1 After unpacking the installation package, click Setup.rb Install.
3.2 First, to prevent the wall, we need to point the mirror to the new address, open a console
Gem sources--remove https://rubygems.org/Remove the original source
Gem sources-a http://gems.ruby-china.org/Add a Xinyuan
Gem Sources-l View an existing source
Gem install Redis-dependent Redis installation
Cluster construction
With the above steps, a Redis service is built and can be seen in Service Manager. (Note the server port), and we've also built a ruby environment to configure the Redis cluster. Here's how to build a Redis cluster.
In the official cluster document, the minimum cluster needs to contain at least three master nodes. for your first test, it is highly recommended to start a six-node cluster with three master and three slave stations.
My cluster builds 3 master+3 slave in this server, a total of 6 nodes. On the issue of data release, follow-up on Redis research in depth, and then write the article record sharing.
At the beginning, we installed a Redis instance, the default port is 6379, the 6 newly created nodes are 6380,6381,6382,6383,6384,6385, and then the downloaded compressed package files are put in, so that we create 6 nodes, The following is a separate configuration for each node.
In each folder, add the configuration file redis.conf, and modify the configuration to the following
Port 7005cluster-enabled yescluster-config-file nodes.confcluster-node-timeout 5000appendonly Yes
Then turn on the Redis service, open the console, and execute it in the current folder.
Redis-server.exe redis.conf
After all services have been successfully opened, we have created 6+1 Redis instances on a single server (a Redis entity was created when the installation was started)
Subsequent deployments will not be possible with the console to host the service, the following describes how to deploy Redis to the service, the console to execute the following commands, please note that your service name should be modified according to your needs. I'm here directly redis+ port to create a
Redis-server--service-install redis.conf--service-name redis6380
After the creation of a successful we see the database there are 6 services, the service started up, when available, you can use the console to see if the corresponding service can be added to delete data normally.
Nodes are created, the next task is how to create a cluster.
When we created the cluster, we used the redis-trib.rb file.
The file may not be in the downloaded Redis package and can be
Download in the HTTPS://GITHUB.COM/ANTIREZ/REDIS/TREE/UNSTABLE/SRC directory
The previous Ruby environment was intended to run this file.
Enter the Create cluster command, note that this time to check whether the server current port 6380-6385 is open, the creation will fail if it is not opened.
D:\REDISCLUSTER\6380>REDIS-TRIB.RB Create--replicas 192.168.123.90:6380 192.168.123.90:6381 192.168.123.90:6382 192.168.123.90:6383 192.168.123.90:6384 192.168.123.90:6385
After the cluster environment is set up, the following interface will appear, 3master+3slave, at the same time we will find nodes.conf each node, here recorded the node in the cluster of some information, interested can be analyzed.
OK, just enter Yes.
Created successfully, 16,384 slots are covered, here is simply the principle of redis, the key to do CRC16 checksum, according to slot allocation on different servers. In the above information, we can clearly see the data distributed on that server.
Finally, let's simply test the increase and acquisition of the data.
The same way, in the cmd window with REDIS-CLI to handle the data, note that the command and non-clustered compared with a-c
Redis-cli-h 192.168.123.90-p 6380-c
Here, how can forget our favorite sentence: Hello,world
Can clearly see the data put to 6382 node, OK, redis cluster under Windows cluster build that's it, follow-up I'll put it inside the private room behind
Windows Environments Build Redis clusters