My Redis cluster-building path

Source: Internet
Author: User
Tags bind download redis redis iptables redis cluster install redis
To make a platform, the design requires the ability to read and write 10,000 times per second in a database of 80.01 billion records.
I chose a redis cluster. My approach is implemented in conjunction with the documentation provided by the Great God Gong-java and some of the discoveries that I have joined.
The first is to download redis-3.2.1.tar.gz, this has nothing to say, to the official web site to find links and then wget on it.
After the download is complete TAR-ZXVF, my habit is to unzip it and put it under the/usr/local/directory.
Under the/USR/LOCAL/REDIS-3.2.1/directory, if you do not have GCC installed, you will need to install GCC with the command yum installed.
After GCC is installed, compile under the/USR/LOCAL/REDIS-3.2.1/directory, execute make, and if execution fails look at the error, if the error is as follows,
Compile interrupts.
MAKE[1]: * * [ADLIST.O] Error 1
MAKE[1]: Leave directory "/USR/LOCAL/REDIS-STABLE/SRC"
Make: * * * [ALL] Error 2
The solution is:
Make MALLOC=LIBC
Execute make install after compilation is complete. The role is to copy the execution commands of the/usr/local/redis/redis-3.2.1/src/-related redis into the/usr/local/bin directory
The configuration file will be modified below. The configuration file is in/usr/local/redis/redis-3.2.1/redis.conf. The following parameters are mainly modified.
Bind 0.0.0.0 indicates that the IP address of the linked native service is not restricted. Any computer can initiate a connection. Here to pay special attention, I began to think that the IP binding here to access the 6379 port, the result of a modification will not start the Redis service, then carefully looked at the configuration file on the instructions to understand that the original bind is not to access the IP, but the physical address of the local network card.
Daemonize Yes to allow background running
cluster-enabled Yes indicates the cluster is turned on
Cluster-node-timeout 15000 for setting time-out
Cluster-config-file node Save cluster configuration file
After configuration, start the Redis service, Redis-server redis.conf
[Root@t91 redis-3.2.1]# Ps-ef | grep Redis
Root 2352 1 0 09:39? 00:00:00 redis-server 192.168.1.91:7001 [cluster]
Root 2450 2006 0 09:56 pts/0 00:00:00 grep--color=auto Redis
If you use Ps-ef | grep Redis, printing the above, indicates that the boot was successful.
Next, because the Redis cluster configuration is written with a ruby script, you'll need at least Ruby (Apt-get install ruby) and Gem. What's more, you have to use the Redis modules that you need to install Ruby.
Yum-y Install zlib Ruby RubyGems
# Redis Library with Ruby installed

Gem Install Redis

"Add: If the execution times are wrong, you cannot connect. Can be manually downloaded down to install

1, go to https://rubygems.org/gems/redis/download Redis-x.x.x.gem file

2. Gem Install-l/root/redis-3.3.1.gem

"Well, now you can start creating the cluster. I'm using redis-trib.rb create.
REDIS-TRIB.RB Create--replicas 1 192.168.1.91:7001 192.168.1.92:7002 192.168.1.93:7003 192.168.1.94:7004 192.168.1.95:7005 192.168.1.96:7006
The creation process has been tossing me for a long time, the beginning always error:
>>> Creating Cluster
[ERR] Sorry, can ' t connect to node 192.168.1.91:7001
I've been looking for a lot of articles on the Internet, mostly to say that Ruby or gem versions are too low. I tried to upgrade, but I still couldn't. And I didn't study the reason. Because later met the great God Gong-java, I completely follow his document operation, on a server successfully created 6 instances of the Redis cluster.
At this time I thought that had already done, did not think the thing behind is really twists.
Now that the cluster is successful on a single server, you should be able to implement it on platform 6.
I'll start deploying right away. When the results are created, the error starts again.
>>> Creating Cluster
[ERR] Sorry, can ' t connect to node 192.168.1.91:7001
Check to check to see that it was the configuration file I mentioned earlier redis.conf the problem of bind 0.0.0.0 inside. After many failures, only to have patience to see the explanation, the results only understand. Hey, I really need to look at the explanation later.
Then execute the Create, smooth link, I was happy, and the results found to execute to waiting for the cluster to join ... did not proceed downward. It's always been this state.
Didn't see?, check it online. There's a brother on the internet saying:
The creation of the cluster has always been in the "waiting for the cluster to join ..." state of ..................
The cause of this problem is unknown, but the workaround is to change the bind 127.0.0.1 local loopback port to the physical interface in the redis.conf file.
But I've already configured the redis.conf bind. Again and again, I found that after I created the cluster, the cluster members communicated to the server that created the cluster via a random port. This communication is not redis.conf inside port.
All right, apart. Modify Iptables
-A input-s 192.168.1.91-j ACCEPT
-A input-s 192.168.1.92-j ACCEPT
-A input-s 192.168.1.93-j ACCEPT
-A input-s 192.168.1.94-j ACCEPT
-A input-s 192.168.1.95-j ACCEPT
-A input-s 192.168.1.96-j ACCEPT
Then create the cluster, or the old way ... At this time, I think of the Redis cluster communication mode, the cluster members should not only communicate with the cluster creator. So the iptables of the cluster members are all configured identically.
Then create the cluster and you are done.
Special thanks to the great help of Comrade Gong-java.
Documents attached to Gong-java: Https://github.com/gonghard/redis

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.