Ubuntu12.04 安装 redis-3.2.1集群_Ruby_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > Ruby > Ubuntu12.04 安装 redis-3.2.1集群

Ubuntu12.04 安装 redis-3.2.1集群

 2016/7/16 5:33:37  greatwqs  程序员俱乐部  我要评论(0)
  • 摘要:安装的整个过程参考:http://www.cnblogs.com/gomysql/p/4395504.html一.环境信息1.redis-3.2.1:(http://redis.io/)http://download.redis.io/releases/redis-3.2.1.tar.gztarxvfredis-3.2.1.tar.gzmake&&makeinstall2.ruby2.3.1p112(2016-04-26revision54768)[x86_64
  • 标签:Ubuntu 安装

安装的整个过程参考:

http://www.cnblogs.com/gomysql/p/4395504.html

?

一. 环境信息

1. redis-3.2.1:

(http://redis.io/)?http://download.redis.io/releases/redis-3.2.1.tar.gz

tar xvf?redis-3.2.1.tar.gz

make && make install

?

2.?ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]

https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.1.tar.gz

tar xvf?ruby-2.3.1.tar.gz

./configure

make && make install

?

3.?gem --version

class="p1">2.5.1

?

4.?gem install redis

?

最后在安装集群时遇到的一些问题和解决方案:

1.?/usr/local/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- redis (LoadError)

from /usr/local/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'

from ./redis-trib.rb:25:in `<main>'

报此问题大多是环境信息有误, 请参照上面成功的环境信息, 如果低于上面的版本可以考虑升级;

?

2. ./redis-trib.rb create --replicas 1 192.168.100.101:6381 192.168.100.101:6382 192.168.100.101:6383 192.168.100.101:6384 192.168.100.102:6381 192.168.100.102:6382 192.168.100.102:6383 192.168.100.102:6384

出现错误:

>>> Creating cluster

?

[ERR] Sorry, can't connect to node?192.168.100.101:6381

搜索到的解决方案一般为:

集群中不要设置密码 / redis.conf配置cluster-enabled yes / 服务器之间能PING/TELNET(除开防火墙原因)

/ redis.conf中配置bind?192.168.100.101 127.0.0.1, 再重启服务器 这一条为自创, Google百度本博客外搜不到的解决方案;

?

由于can't connect to node?192.168.100.101:6381, 就试着链接192.168.100.101:6381一下, 输入命令keys *测试, 发现有如下4点可能对解决问题有用, 红色部分是配置bind ip地址, 最简单常用(其他几条没有测试):

redis@redis-cache-1:~/redis-3.2.1/src$ ./redis-cli ?-h 192.168.100.101 -p 6381

10.160.16.221:6381> keys *

DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions:?

1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent.?

2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server.?

3) If you started the server manually just for testing, restart it with the '--protected-mode no' option.?

?

4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside.

?

最后附件传上集群的配置mochabin.zip, 说明redis.conf中有配置dir /data/redis/cluster/6381/

/data是挂载的新硬盘, 专存储redis集群的日志, aof, dump数据, 为给后面线上redis维护带来方便.

  • mochabin.zip (26.6 KB)
  • 下载次数: 0
发表评论
用户名: 匿名