Redis Cluster steps (Windows environment)

Source: Internet
Author: User
Tags download redis redis cluster install redis

Note: The original text is transferred from 73715947, only as a convenient reference

A required software: Redis, Ruby language runtime, Redis's Ruby driver Redis-xxxx.gem, and the tools to create a Redis cluster redis-trib.rb


Two-installation configuration Redis

Redis https://github.com/MSOpenTech/redis/releases; Download Redis-x64-3.2.100.zip.

Cluster planning has three nodes of the cluster, each node has a master one. Requires 6 virtual machines.

After the Redis decompression, and then copied 5 copies, configuration three master three from the cluster. Since the Redis default port number is 6379, the other 5-part ports can be 6380,6381,6382,6383,6384. and name the directory using the port number

Open Directory 6379 has a file redis.windows.conf, modify the port number inside, as well as the cluster support configuration.

Modifying other configurations to support clustering
cluster-enabled Yes
Cluster-config-file nodes-6379.conf
Cluster-node-timeout 15000
AppendOnly Yes

If cluster-enabled is not yes, it will get an error when using Jediscluster cluster code.
Cluster-node-timeout is adjusted to 15000, the cluster will not time out when it is created.
Cluster-config-file nodes-6379.conf is the configuration information for the node, where the nodes-port is used. conf naming method. The file is generated in the directory after the service is started.

Write a bat to start Redis and create Start.bat in each node directory, as follows:
Title redis-6380
Redis-server.exe redis.windows.conf

Three-Mount Ruby

Redis clusters are written using Ruby scripts, so the system needs to have a ruby environment, Http://dl.bintray.com/oneclick/rubyinstaller/:rubyinstaller-2.3.3-x64.exe

3 options are checked at the time of installation.

Quad-Install Redis's Ruby driver Redis-xxxx.gem

Https://rubygems.org/pages/download, unzip after download, current directory switch to extract directory, such as D:\Program files\redis\rubygems-2.6.12 and then execute Ruby on command line Setup.rb.

Then gem installs Redis: Switch to the Redis installation directory and need to execute the gem install Redis on the command line

Five Install cluster script Redis-trib

Https://raw.githubusercontent.com/antirez/redis/unstable/src/redis-trib.rb

Open the link if you do not download, but instead open a page, then save the page as a redis-trib.rb, it is recommended to save to a Redis directory, for example, put in 6379 directory.

The command for the cluster is

REDIS-TRIB.RB Create--replicas 1 127.0.0.1:6379 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

--replicas 1 indicates that each primary database has a number of 1 from the database. The master node cannot be less than 3, so we used 6 Redis

Six start each node and execute the cluster build script

Double-click the Start.bat under each node to start the switch to the Redis directory on the command line to execute REDIS-TRIB.RB create--replicas 1 127.0.0.1:6379 127.0.0.1:6380 127.0.0.1:638 1 127.0.0.1:6382 127.0.0.1:6383 127.0.0.1:6384

Note: There is a friend reaction above the statement execution is unsuccessful. You can add Ruby to the front and run it.

ruby redis-trib.rb create --replicas 1 127.0.0.1:6379 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


Is the Can I set the above configuration appear? (Type ' yes ' to accept): Please confirm and enter Yes. Successful results are as follows:

Seven Tests

Use Redis client Redis-cli.exe to see the number of data records and cluster-related information

Command redis-cli–c–h "Address" –p "Port number"; C represents the cluster

Enter the total number of dbsize query records

Enter cluster info to view the cluster's information from the client

Redis Cluster steps (Windows environment)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.