Some problems and solutions in installing redis3.2 cluster

Source: Internet
Author: User
Tags install openssl openssl centos redis cluster install redis

The installation system is on top of the CentOS. There are deficiencies and also to correct the point.

System version centOS6.5.

The Redis cluster configuration is as follows:


Node 1
=============================================
Main 192.168.135.128:1000
/usr/local/redis-cluster-test/cluster1/master
From 192.168.135.128:1001
/usr/local/redis-cluster-test/cluster1/slave

Node 1 master Configuration
Pidfile/usr/local/redis-cluster-test/cluster1/master/redis_1000.pid
Logfile/usr/local/redis-cluster-test/cluster1/master/redist-1000.log
Port 1000
Bind 192.168.135.128
AppendOnly Yes
Daemonize Yes
dir/usr/local/redis-cluster-test/cluster1/master/
cluster-enabled Yes
Cluster-config-file nodes-1000.conf

Node 1 from the configuration
Pidfile/usr/local/redis-cluster-test/cluster1/slave/redis_1001.pid
Logfile/usr/local/redis-cluster-test/cluster1/salve/redist-1001.log
Port 1001
Bind 192.168.135.128
AppendOnly Yes
Daemonize Yes
dir/usr/local/redis-cluster-test/cluster1/slave/

cluster-enabled Yes

Cluster-config-file nodes-1001.conf


Node 2
=============================================
Node 2 main 192.168.135.128:2000
/usr/local/redis-cluster-test/cluster2/master
/usr/local/redis-cluster-test/cluster2/slave


Pidfile/usr/local/redis-cluster-test/cluster2/slave/redis_2001.pid
Logfile/usr/local/redis-cluster-test/cluster2/salve/redist-2001.log
Port 2001
Bind 192.168.135.128
AppendOnly Yes
Daemonize Yes
cluster-enabled Yes
dir/usr/local/redis-cluster-test/cluster1/slave/
Cluster-config-file nodes-2000.conf

Node 2 from 192.168.135.128:2001

/usr/local/redis-cluster-test/cluster2/slave

Pidfile/usr/local/redis-cluster-test/cluster2/slave/redis_2001.pid
Logfile/usr/local/redis-cluster-test/cluster2/salve/redist-2001.log
Port 2001
Bind 192.168.135.128
AppendOnly Yes
Daemonize Yes
dir/usr/local/redis-cluster-test/cluster1/slave/

cluster-enabled Yes

Cluster-config-file nodes-2001.conf

Node 3

=============================================
Node 3 main 192.168.135.128:3000
/usr/local/redis-cluster-test/ Cluster3/master
/usr/local/redis-cluster-test/cluster2/slave         &NBSP
pidfile/usr/ Local/redis-cluster-test/cluster3/slave/redis_3000.pid
logfile/usr/local/redis-cluster-test/cluster3/salve/ Redist-3000.log
Port 3000
Bind 192.168.135.128
appendonly Yes
daemonize Yes
cluster-enabled Yes
dir/usr/local/redis-cluster-test/cluster1/slave/
Cluster-config-file nodes-3000.conf

Node 3 from   192.168.135.128:3001
redis.conf    /usr/local/redis-cluster-test/cluster3/slave

Pidfile    /USR/LOCAL/REDIS-CLUSTER-TEST/CLUSTER3/SLAVE/REDIS_3001.PID
LogFile    /usr/local/ Redis-cluster-test/cluster3/salve/redist-3001.log
Port   3001
Bind 192.168.135.128
AppendOnly Yes
Daemonize Yes

dir/usr/local/redis-cluster-test/cluster1/slave/

cluster-enabled Yes

Cluster-config-file nodes-3001.conf

The above configuration is set to one less cluster-node-timeout 15000 This configuration can be set by itself.

The following is the theme of the group.

There are also some wild ways to configure the cluster, seen on the internet, tried, can also be used, but in the deletion and increase the node is not so flexible. Ruby is recommended on official documents, and REDIS-TRIB.RB files are built into the redis3.2, so it's OK to install Ruby on CentOS. But I was in a tangle all afternoon. Ruby's operating environment may be that I installed CentOS too pure, and some dependencies did not find a problem.

Some of the questions are as follows:

Question 1:

Execute command:./redis-trib.rb
/usr/local/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in ' require ': Cannot load such file--Redis ( Loaderror)
From/usr/local/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in ' require '
From./redis-trib.rb:25:in ' <main> '
Workaround: Download and install Rubygem into the unpack package. Configure make && make install

You can now run the Gem intall redis command to install the dependent dependencies of ruby execution Redis.

Question 2:

Issues with gem install Redis command

Error:loading Command:install (Loaderror)
Cannot load such file--OpenSSL
Error:while Executing gem ... (Nomethoderror)
Undefined method ' Invoke_with_build_args ' for nil:nilclass manually install OPENSLL, this problem is resolved.

Question 3:

Then execute the command: Gem install Redis

Error:loading Command:install (Loaderror)
Cannot load such file--zlib
Manually install the Zlib package (this may be the system is too pure, there are no packets of problems). Installation process is not much said, manual download installation package installation.

Question 3:

Then execute the command: Gem install Redis

Error:while Executing gem ... (gem::exception)
Unable to require OpenSSL, install OpenSSL and rebuild Ruby (preferred) or use NON-HTTPS sources
Online Search Solution: Gem sources--add https://ruby.taobao.org/--remove https://rubygems.org/
Error:while Executing gem ... (gem::exception)
Unable to require OpenSSL, install OpenSSL and rebuild Ruby (preferred) or use NON-HTTPS sources

Or the problem with the old.

Workaround:

Gem sources-a https://gems.ruby-china.org/convert HTTPS address to gem Sources-a http://gems.ruby-china.org/

Successful execution, view gem source-l mirror address modification succeeded.

Execute again: Gem install Redis success.

View by command:

The Gem list has successfully installed Redis dependencies.

Execute the RUBY-TRIB.RB in the Redis directory

The command format is as follows:

./redis-trib.rb Create--replicas 1 192.168.135.128:1000 192.168.135.128:2000
192.168.135.128:3000 192.168.135.128:1001 192.168.135.128:2001 192.168.135.128:3001

Note:--replicas 1 represents a slave for each master, and the first three are the main service, followed by three from the service address, and the cluster configuration succeeds.

As shown in the figure:



These are the problems that you encounter when you configure your individual cluster.

Java Program Test cluster:

Jedispoolconfig poolconfig=jedispoolconfig ();
sethashsethostandport (host,1000));
Nodelist.add (hostandport (host,1001));
Nodelist.add (hostandport (host,2000));
Nodelist.add (hostandport (host,2001));
Nodelist.add (hostandport (host,3000));
Nodelist.add (hostandport (host,3001));
Jediscluster cluster=jediscluster (nodelist,poolconfig);
String name=cluster.get ("name");
System. out. println ("]");
The effect of program operation is as follows:



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.