Redis Multi-machine cluster

Source: Internet
Author: User
Tags redis cluster install redis

Redis cluster. Many tutorials on the web, just follow its steps to do only on a single run, it is not a bit resistant. and no password verification.

Begin:

1:redis cluster requires a minimum of 6 server-side, so first 6 virtual machines I use centOS-7 mini each to give a minimum of memory

IP fixed to: 200, 201, 202, 203, 204, 205, 206

Vi/etc/sysconfig/network-scripts/ifcfg-xxx in the change

Generally only modified

Bootproto=static

Onboot=yes

ipaddr=192.168.1.200 #IP

netmask=255.255.255.0

gateway=192.168.1.1 #网关

dns1=192.168.1.1 #写路由地址

?

Install Ruby, zlib, RubyGems (general installation of Ruby will install the other two components at the same time)

Note : It is best not to download ruby.gz to install. After the installation of the test will appear can not find zlib error message, tried the online a lot of methods are not. are interested in tossing can play, also may be my hand cheap

Yum Install–y Ruby

Download Ruby Redis Interface (can be installed with gem install Redis directly but with very slow speed)

Choose the version you want to download Https://rubygems.org/gems/redis

Install gem install Redis-xx.gem (Redis-xx.gem the gem script downloaded above URL)

?

Download Install Redis (Speaking of installing this stuff, tried once to interview was asked this stuff will install it?) The answer will be. The interviewer is very forthright, go to me to install to see. Why not ask this in the development of where to use? Why do you use it? Sleep is to be regarded as the name of the company to apply to do the manager is also very not open their own guess it is a company in Panyu, Guangzhou is an Austrian garden subsidiary called: O MY GOD)

Official installation Tutorial: Install yum install GCC first

$ wget http://download.redis.io/releases/redis-3.2.1.tar.gz

$ tar xzf redis-3.2.1.tar.gz

$ CD redis-3.2.1

$ make

If an error is given, make specifies the parameter: make MALLOC=LIBC run again

Install (can be omitted): Make install

Run: Src/redis-server &

Client Connection: SRC/REDIS-CLI

Test Get/set can enter shutdown to turn off Redis

?

Configure Redis

Copy one: CP redis.conf cluster.conf

modifying cluster.conf related parameters

Port? -

daemonize? Yes # The background service must be

Cluster-enabled? Yes

cluster-config-file?nodes.conf # Cluster information (auto-generated)

AppendOnly? Yes

#bind 127.0.0.1 Note off

Protected-mode no # ensure that the null password can be connected

?

with SCP put Redis copying to other machines

SCP redis-xx [email protected]:/tmp/redis-xx

After you've copied all of them, put each one Redis Open up

daemonize? Yes This parameter is paired with a YES After starting the service is not prompted to start whether it is normal, you can use the client connection to see, but also to see whether the port in the listening

Netstat–tln

If the tool is not installed Yum install–y net-tools installation

Everything's fine.

Building a cluster :

./src/redis-trib.rb Create?--replicas?1?192.168.1.200:2000 ..... 192.168.1.205:2000

?

--replicas?1 1 indicates how many slave machines a master can have.

?

Middle to enter Yes Enter

Complete.

Connect with a client just try it on a random one.

viewing information on the client :

CLUSTER INFO

CLUSTER SLOTS

?

To this cluster complete

After the cluster is complete, connection password verification may now be configured

cluster.conf Modify

Requirepass 123456

or with client settings

Config?set?requirepass 123456

Note: The password that can be set by the client disappears after a reboot.

redis-trib.rb There are more features, add nodes, delete nodes, and so on. There is also a redis-cli on a single client base on the cluster after each get/set operation will return [err]move .... The jump information, which is normal.

Redis Multi-machine cluster

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.