安裝redis集群

2021-08-21 14:16:48 字數 2617 閱讀 5613

安裝zlib

yum install -y zlib

安裝ruby

yum install -y ruby

gem install redis-3.3.5.gem

> tar xvf redis-4.0.6.tar.gz

> cd redis-4.0.6

> make

> make test

> mkdir -p /redis/redis-4.0.6/cluster/8001

> cp /redis/redis-4.0.6/redis.conf /redis/redis-4.0.6/cluster/8001

> vi redis.conf

bind 192.168.0.47

port 8001

daemonize yes #以守護程序執行

pidfile /redis/redis-4.0.6/cluster/8001/redis_8001.pid

logfile /redis/redis-4.0.6/cluster/8001/redis_8001.log

dir /redis/redis-4.0.6/cluster/8001/

masterauth redis_ #集群密碼

requirepass redis_ #登陸密碼

maxclients 2048

目錄加入path

export path=./:/redis/redis-4.0.6/src/:$

所有節點啟動redis

redis-server ./redis.conf

建立集群

> redis-trib

.rbcreate

--replicas 1 192.168

.0.47

:8001 192.168

.0.48

:8001 192.168

.0.49

:8001 192.168

.0.50

:8001 192.168

.0.51

:8001 192.168

.0.52

:8001

>>> creating

cluster

>>> performing

hash

slots

allocation

on 6 nodes...

using 3 masters:

192.168

.0.47

:8001

192.168

.0.48

:8001

192.168

.0.49

:8001

adding

replica 192.168

.0.50

:8001

to 192.168

.0.47

:8001

adding

replica 192.168

.0.51

:8001

to 192.168

.0.48

:8001

adding

replica 192.168

.0.52

:8001

to 192.168

.0.49

:8001

問題

> redis-trib.rb info 192.168

.0.47:8001

/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file

-- redis (loaderror)

from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'

from /redis/redis-4.0

.6/src/redis-trib.rb:25:in `'

> ruby -v

ruby 2.0

.0p648 (2015-12-16) [x86_64-linux]

ruby缺少redis庫

.5> gem install redis-3.3

.5.gem

增加reids密碼後無法連線

> redis-trib.rb create --replicas 1 192.168.0.47:8001 192.168.0.48:8001 192.168.0.49:8001 192.168.0.50:8001 192.168.0.51:8001 192.168.0.52:8001

>>> creating cluster

[err] sorry, can't connect to node 192.168

.0.47:8001

client.rb路徑可以通過find命令查詢:find / -name 'client.rb'

修改client.rb檔案

:password => "passwd123"

Redis集群安裝

第一步 安裝和解壓 root node1 tar zxvf redis 3.2.6.tar.gz c usr local root node1 mv redis 3.2.6 redis root node1 cd usr local redis root node1 make 配置環境變數 root...

redis集群安裝

上次咱們講到了 的安裝,這次咱們來說說 集群的搭建,並且在這篇部落格中,我會總結一下我遇到的問題 安裝版本 現在的最新版本 執行環境 yum install ruby yum install rubygems 安裝環境使用的包 root localhost gem install redis 3.0...

redis集群安裝

一 安裝redis 1.安裝redis依賴 yum install gcc c 3.解壓reids包,進入redis根目錄編譯make cd redis make 得到src目錄 即安裝目錄 4.修改配置 5.啟動 redis server redis.conf 指定配置檔案 6.停止 redis ...