1. 程式人生 > >Redis之——叢集搭建(基於CentOS6.X單機多節點)

Redis之——叢集搭建(基於CentOS6.X單機多節點)

一、安裝redis

1、安裝gcc環境

yum install gcc-c++

2、下載原始碼包並解壓

wget http://download.redis.io/releases/redis-3.2.12.tar.gz
tar -zxvf redis-3.2.12.tar.gz
cd redis-3.2.12.tar.gz

3、安裝ruby2.4.1並編譯(一定要安裝大於2.2.2的ruby,要不然redis在make的時候會報錯)

wget http://ftp.ruby-lang.org/pub/ruby/2.4/ruby-2.4.1.tar.gz
tar -zxvf ruby-2.4.1.tar.gz
cd ruby-2.4.1
mkdir -p /usr/local/ruby
./configure --prefix=/usr/local/ruby
make && make install
ln -s /usr/local/ruby/bin/ruby /usr/bin/ruby

4、安裝

make
make install PREFIX=/usr/local/redis
cp redis.conf /usr/local/redis/bin/redis.conf
chmod /usr/local/redis/bin/redis.conf

5、啟動redis

./redis-server redis.conf

6、驗證

[[email protected] bin]# ./redis-cli -p 6379
127.0.0.1:6379> get
(error) ERR wrong number of arguments for 'get' command
127.0.0.1:6379> set name liuyazhuang
OK
127.0.0.1:6379> get name
"liuyazhuang"

二、搭建redis叢集(叢集模式)

1、在/usr/local/下面建立redis-cluster目錄

mkdir -p /usr/local/redis-cluster

2、複製/usr/local/redis/bin目錄到redis-cluster裡面並重命名為redis1

cd /usr/local
cp -r redis/bin redis-cluster/redis1

3、將redis1在同目錄複製3份分別起名redis2,redis3,redis4,redis5,redis6(必須6個節點以上才能建立叢集)

[[email protected] redis-cluster]# pwd
/usr/local/redis-cluster
[
[email protected]
redis-cluster]# cp -r redis1 redis2 [[email protected] redis-cluster]# cp -r redis1 redis3 [[email protected] redis-cluster]# cp -r redis1 redis4 [[email protected] redis-cluster]# cp -r redis1 redis5 [[email protected] redis-cluster]# cp -r redis1 redis6

分別修改為redis-7001.conf,redis-7002.conf 後面依次到redis-7006.conf

以redis-7001為例:

daemonize yes 
Port 7001
logfile "./redis-7001.log"
protected-mode no
pidfile /var/run/redis_7001.pid
cluster-enabled yes

4、將redis-trib.rb復到制redis-cluster目錄裡面

[[email protected] redis-cluster]# cp /root/redis-3.2.4/src/redis-trib.rb .
[[email protected] redis-cluster]# ll
total 76
drwxr-xr-x 2 root root  4096 Oct 19 22:37 redis1
drwxr-xr-x 2 root root  4096 Oct 19 22:48 redis2
drwxr-xr-x 2 root root  4096 Oct 19 22:49 redis3
drwxr-xr-x 2 root root  4096 Oct 19 22:49 redis4
drwxr-xr-x 2 root root  4096 Oct 19 22:49 redis5
drwxr-xr-x 2 root root  4096 Oct 19 22:49 redis6
-rwxr-xr-x 1 root root 60852 Oct 19 22:52 redis-trib.rb

5、安裝gem

yum install rubygems -y

6、安裝ruby的redis包

gem install redis

上面這一步可能會出現:

ERROR: Loading command: install (LoadError)
cannot load such file -- zlib
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass

解決辦法是:

  • 進入ruby原始碼資料夾
  • 安裝ruby自身提供的zlib包
#cd ext/zlib
#ruby ./extconf.rb
#make
#make install
  • 進入ruby原始碼資料夾
  • 安裝ruby自身提供的openssl包

如果執行make的時候報錯:make: *** No rule to make target ,

錯誤原因:makefile裡面的檔案依賴關係有問題,導致標頭檔案找不到。

解決辦法:開啟編譯相關模組的makefile檔案,找到.o檔案的依賴關係,找到.h檔案的路徑,檢視是否出錯並改正。

原因分析:這種情況有時候是因為工程所在的目錄改變,例如原來在C盤,現在移到了D盤,而makefile裡面的.h檔案路徑沒有改變

以上問題解決後再執行:

[[email protected] include]# gem install redis
Fetching: redis-4.0.1.gem (100%)
Successfully installed redis-4.0.1
Parsing documentation for redis-4.0.1
Installing ri documentation for redis-4.0.1
Done installing documentation for redis after 1 seconds
gem installed

表示ruby的redis依賴包安裝成功。

7、分別進入redis1,redis2,redis3,redis4,redis5,redis6裡面執行

./redis-server redis-7001.conf
......

將四個節點啟動

[[email protected] redis4]# ps -ef|grep redis
root      3167     1  0 02:49 ?        00:00:00 ./redis-server 127.0.0.1:7001 [cluster]
root      3176     1  0 02:50 ?        00:00:00 ./redis-server 127.0.0.1:7002 [cluster]
root      3187     1  0 02:51 ?        00:00:00 ./redis-server 127.0.0.1:7003 [cluster]
root      3191     1  0 02:52 ?        00:00:00 ./redis-server 127.0.0.1:7004 [cluster]
root      3191     1  0 02:52 ?        00:00:00 ./redis-server 127.0.0.1:7005 [cluster]
root      3191     1  0 02:52 ?        00:00:00 ./redis-server 127.0.0.1:7006 [cluster]
root      3195  1852  0 02:52 pts/0    00:00:00 grep redis

8、用redis-trib.rb構建叢集

cd /usr/local/redis-cluster/
[[email protected] redis-cluster]# ./redis-trib.rb create --replicas 1 172.16.80.177:7001 172.16.80.177:7002 172.16.80.177:7003 172.16.80.177:7004 172.16.80.177:7005 172.16.80.177:7006
>>> Creating cluster
[ERR] Sorry, can't connect to node 172.16.80.177:7001

以上錯誤原因是redis.conf裡面未開起遠端訪問

開啟每個redis裡面的.conf檔案,找到

# JUST COMMENT THE FOLLOWING LINE.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bind 127.0.0.1

# Protected mode is a layer of security protection, in order to avoid that
# Redis instances left open on the internet are accessed and exploited.

將上面的bind 127.0.0.1改成bind 192.168.209.121(外部可以訪問的ip),然後重啟各服務

root      3383     1  0 03:12 ?        00:00:00 ./redis-server 192.168.209.121:7001 [cluster]
root      3458     1  0 03:20 ?        00:00:00 ./redis-server 192.168.209.121:7002 [cluster]
root      3464     1  0 03:20 ?        00:00:00 ./redis-server 192.168.209.121:7003 [cluster]
root      3470     1  0 03:20 ?        00:00:00 ./redis-server 192.168.209.121:7004 [cluster]
root      3506     1  0 03:25 ?        00:00:00 ./redis-server 192.168.209.121:7005 [cluster]
root      3518     1  0 03:25 ?        00:00:00 ./redis-server 192.168.209.121:7006 [cluster]
root      3523  1852  0 03:26 pts/0    00:00:00 grep redis

再用redis-trib.rb建立叢集:

[[email protected] redis-cluster]# ./redis-trib.rb create --replicas 1 192.168.209.121:7001 192.168.209.121:7002 192.168.209.121:7003 192.168.209.121:7004 192.168.209.121:7005 192.168.209.121:7006
>>> Creating cluster
>>> Performing hash slots allocation on 6 nodes...
Using 3 masters:
192.168.209.121:7001
192.168.209.121:7002
192.168.209.121:7003
Adding replica 192.168.209.121:7004 to 192.168.209.121:7001
Adding replica 192.168.209.121:7005 to 192.168.209.121:7002
Adding replica 192.168.209.121:7006 to 192.168.209.121:7003
M: 40bbe8a979fe39f1f0941cc8e118443436fc71d8 192.168.209.121:7001
   slots:0-5460 (5461 slots) master
M: e6b76ee1540c9be6c44abc3dec42378f8cfd0191 192.168.209.121:7002
   slots:5461-10922 (5462 slots) master
M: fdc248e24bd9f8690c652213a5781f4e567208e8 192.168.209.121:7003
   slots:10923-16383 (5461 slots) master
S: 38faede9dd348983b1b8b80edc975e8d34105e5c 192.168.209.121:7004
   replicates 40bbe8a979fe39f1f0941cc8e118443436fc71d8
S: 38faede9dd348983b1b8b80edc975e8d34105e5c 192.168.209.121:7005
   replicates e6b76ee1540c9be6c44abc3dec42378f8cfd0191
S: 38faede9dd348983b1b8b80edc975e8d34105e5c 192.168.209.121:7006
   replicates fdc248e24bd9f8690c652213a5781f4e567208e8
Can I set the above configuration? (type 'yes' to accept): yes
>>> Nodes configuration updated
>>> Assign a different config epoch to each node
>>> Sending CLUSTER MEET messages to join the cluster
Waiting for the cluster to join...
>>> Performing Cluster Check (using node 192.168.209.121:7001)
M: 40bbe8a979fe39f1f0941cc8e118443436fc71d8 192.168.209.121:7001
   slots:0-5460 (5461 slots) master
additional replica(s)
M: e6b76ee1540c9be6c44abc3dec42378f8cfd0191 192.168.209.121:7002
   slots:5461-10922 (5462 slots) master
additional replica(s)
S: 38faede9dd348983b1b8b80edc975e8d34105e5c 192.168.209.121:7004
   slots: (0 slots) slave
   replicates 40bbe8a979fe39f1f0941cc8e118443436fc71d8
M: fdc248e24bd9f8690c652213a5781f4e567208e8 192.168.209.121:7003
   slots:10923-16383 (5461 slots) master
additional replica(s)
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.

至此,redis叢集建立成功

 9、驗證叢集是否成功

[[email protected] redis2]# ./redis-cli -h 192.168.209.121 -c -p 7002
192.168.209.121:7002> set hello helloword
-> Redirected to slot [866] located at 192.168.209.121:7001
OK
192.168.209.121:7006> get hello
-> Redirected to slot [866] located at 192.168.209.121:7001
"helloword"

三、搭建redis叢集(哨兵模式) 

1、在/usr/local/下面建立redis-sentinel目錄

mkdir -p /usr/local/redis-sentinel

 2、將一大節中的/usr/local/redis/bin複製到redis-sentinel目錄底下起名叫redis1,redis2,redis3,redis4,sentinel1,sentinel2

修改4個redis的配置檔案(以redis1為例,將redis.conf重新命名為redis-7001.conf)

daemonize yes 
port 7001
#Bind 127.0.0.1
logfile "./redis-7001.log"
protected-mode no
cluster-config-file nodes-7001.conf

其他三個redis的埠號為7002,7003,7004

3、將redis解壓包裡面的sentinel.conf複製到sentinel1和sentinel2裡面並重命名為sentinel-7005.conf,sentinel-7006.conf,並賦予可執行許可權

修改配置(以sentinel-7005.conf為例)

port 7005
sentinel monitor mymaster 192.168.209.121 7001 2
protected-mode no

注:我們稍後要啟動四個redis例項,其中埠為7001的redis設為master,其他三個設為slave 。所以my mymaster 後跟的是master的ip和埠,最後一個’2’代表我要啟動只要有2個sentinel認為master下線,就認為該master客觀下線,啟動failover並選舉產生新的master。通常最後一個引數不能多於啟動的sentinel例項數。

4.啟動4個redis例項

./redis-server redis-7001.conf
......
[[email protected] redis4]# ps -ef|grep redis
root     29967     1  0 22:02 ?        00:00:00 ./redis-server 192.168.209.121:7001
root     29971     1  0 22:02 ?        00:00:00 ./redis-server 192.168.209.121:7002
root     29976     1  0 22:02 ?        00:00:00 ./redis-server 192.168.209.121:7003
root     29985     1  0 22:02 ?        00:00:00 ./redis-server 192.168.209.121:7004

然後分別登陸7002 7003 7004三個例項,動態改變主從關係,成為7005的slave:

./redis-cli -h 192.168.209.121 -p 7002
192.168.209.121:7002> SLAVEOF 192.168.209.121 7001

5、以後臺啟動模式啟動兩個sentinel(哨兵):

[[email protected] sentinel1]# ./redis-sentinel sentinel-7005.conf &
[1] 30038
[[email protected] sentinel1]# 30038:X 22 Oct 22:10:49.712 * Increased maximum number of open files to 10032 (it was originally set to 1024).
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 3.2.4 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in sentinel mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 7005
 |    `-._   `._    /     _.-'    |     PID: 30038
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

30038:X 22 Oct 22:10:49.713 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
30038:X 22 Oct 22:10:49.744 # Sentinel ID is cbd44de127d84fd7d21f9e4a73e62b94c3b0ea00
30038:X 22 Oct 22:10:49.744 # +monitor master mymaster 192.168.209.121 7001 quorum 2
30038:X 22 Oct 22:10:49.745 * +slave slave 192.168.209.121:7004 192.168.209.121 7004 @ mymaster 192.168.209.121 7001
30038:X 22 Oct 22:10:49.768 * +slave slave 192.168.209.121:7002 192.168.209.121 7002 @ mymaster 192.168.209.121 7001
30038:X 22 Oct 22:10:49.792 * +slave slave 192.168.209.121:7003 192.168.209.121 7003 @ mymaster 192.168.209.121 7001
[[email protected] redis-3.2.4]# ps -ef|grep sentinel
root     30038 29505  0 22:10 pts/0    00:00:00 ./redis-sentinel *:7005 [sentinel] 
root     30059 29505  0 22:13 pts/0    00:00:00 ./redis-sentinel *:7006 [sentinel] 

6、驗證

 sentinel的基本命令

① INFO 
sentinel的基本狀態資訊 
②SENTINEL masters 
列出所有被監視的主伺服器,以及這些主伺服器的當前狀態 
③ SENTINEL slaves 
列出給定主伺服器的所有從伺服器,以及這些從伺服器的當前狀態 
④SENTINEL get-master-addr-by-name 
返回給定名字的主伺服器的 IP 地址和埠號 
⑤SENTINEL reset 
重置所有名字和給定模式 pattern 相匹配的主伺服器。重置操作清除主伺服器目前的所有狀態, 包括正在執行中的故障轉移, 並移除目前已經發現和關聯的, 主伺服器的所有從伺服器和 Sentinel 。 
⑥SENTINEL failover 
當主伺服器失效時, 在不詢問其他 Sentinel 意見的情況下, 強制開始一次自動故障遷移,但是它會給其他sentinel傳送一個最新的配置,其他sentinel會根據這個配置進行更新

[[email protected] redis1]# ./redis-cli -h 192.168.209.121 -p 7001
192.168.209.121:7001> 
192.168.209.121:7001> set name hzb
OK
192.168.209.121:7001> get name
"hzb"
192.168.209.121:7001> exit
[[email protected] redis1]# cd ../redis2
[[email protected] redis2]# ./redis-cli -h 192.168.209.121 -p 7002
192.168.209.121:7002> get name
"hzb"
192.168.209.121:7002> set age 32
(error) READONLY You can't write against a read only slave.

上面可以看到slave是隻讀的

登入一個sentinel,用sentinel masters命令檢視哪個是master

[[email protected] sentinel1]# ./redis-cli -h 192.168.209.121 -p 7005
192.168.209.121:7005> 
192.168.209.121:7005> 
192.168.209.121:7005> sentinel masters
1)  1) "name"
    2) "mymaster"
    3) "ip"
    4) "192.168.209.121"
    5) "port"
    6) "7001"
    7) "runid"
    8) "8b5d064e4195a1ee6279f5fb06f3fa88e4605854"
    9) "flags"
   10) "master"
   11) "link-pending-commands"
   12) "0"
   13) "link-refcount"
   14) "1"
   15) "last-ping-sent"
   16) "0"
   17) "last-ok-ping-reply"
   18) "624"
   19) "last-ping-reply"
   20) "624"
   21) "down-after-milliseconds"
   22) "30000"
   23) "info-refresh"
   24) "5427"
   25) "role-reported"
   26) "master"
   27) "role-reported-time"
   28) "85727"
   29) "config-epoch"
   30) "0"
   31) "num-slaves"
   32) "3"
   33) "num-other-sentinels"
   34) "1"
   35) "quorum"
   36) "2"
   37) "failover-timeout"
   38) "180000"
   39) "parallel-syncs"
   40) "1"

目前7001是master, 我們強制kill掉 7001 的程序以後,可以看到sentinel打出的資訊:

30325:X 22 Oct 22:51:24.138 # +sdown master mymaster 192.168.209.121 7001
30325:X 22 Oct 22:51:24.557 # +new-epoch 1
30325:X 22 Oct 22:51:24.599 # +vote-for-leader 3948b4c445549c51d67bf829553372bca8bc67c8 1
30325:X 22 Oct 22:51:25.174 # +config-update-from sentinel 3948b4c445549c51d67bf829553372bca8bc67c8 192.168.209.121 7006 @ mymaster 192.168.209.121 7001
30325:X 22 Oct 22:51:25.174 # +switch-master mymaster 192.168.209.121 7001 192.168.209.121 7003
30325:X 22 Oct 22:51:25.175 * +slave slave 192.168.209.121:7004 192.168.209.121 7004 @ mymaster 192.168.209.121 7003
30325:X 22 Oct 22:51:25.175 * +slave slave 192.168.209.121:7002 192.168.209.121 7002 @ mymaster 192.168.209.121 7003
30325:X 22 Oct 22:51:25.175 * +slave slave 192.168.209.121:7001 192.168.209.121 7001 @ mymaster 192.168.209.121 7003
30325:X 22 Oct 22:51:55.202 # +sdown slave 192.168.209.121:7001 192.168.209.121 7001 @ mymaster 192.168.209.121 7003
[[email protected] sentinel1]# ./redis-cli -h 192.168.209.121 -p 7005
192.168.209.121:7005> sentinel masters
1)  1) "name"
    2) "mymaster"
    3) "ip"
    4) "192.168.209.121"
    5) "port"
    6) "7003"
    7) "runid"
    8) "31721c8d1371697d78bf3c6acc2f8d4ba829825a"
    9) "flags"
   10) "master"
   11) "link-pending-commands"
   12) "0"
   13) "link-refcount"
   14) "1"
   15) "last-ping-sent"
   16) "0"
   17) "last-ok-ping-reply"
   18) "454"
   19) "last-ping-reply"
   20) "454"
   21) "down-after-milliseconds"
   22) "30000"
   23) "info-refresh"
   24) "7168"
   25) "role-reported"
   26) "master"
   27) "role-reported-time"
   28) "27254"
   29) "config-epoch"
   30) "1"
   31) "num-slaves"
   32) "3"
   33) "num-other-sentinels"
   34) "1"
   35) "quorum"
   36) "2"
   37) "failover-timeout"
   38) "180000"
   39) "parallel-syncs"
   40) "1"

上面顯示了,master自動從7001變成了7003節點

再次將7001啟動起來

30385:X 22 Oct 22:55:15.544 * +convert-to-slave slave 192.168.209.121:7001 192.168.209.121 7001 @ mymaster 192.168.209.121 7003

可以看到自動將7001變成了7003的slave

 下面加一個批量啟動和停止的指令碼:

#!/bin/bash

start(){
  ./redis1/redis-server ./redis1/redis.conf  &
  ./redis2/redis-server ./redis2/redis.conf  &
  ./redis3/redis-server ./redis3/redis.conf  &
  ./redis4/redis-server ./redis4/redis.conf  &
  ./sentinel1/redis-sentinel ./sentinel1/sentinel.conf  &
  ./sentinel2/redis-sentinel ./sentinel2/sentinel.conf  &

}

stop(){
 ps -ef | grep "redis" | grep -v "grep" |awk '{print $2}'| while read pid 
 do
    C_PID=$(ps --no-heading $pid | wc -l)
    echo "當前PID=$pid"
    if [[ $C_PID == "1" ]]; then
        kill -9 $pid
        echo "PID=$pid 已經結束"
    else
        echo "PID=$pid 不存在"
    fi
 done

}

case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
printf 'Usage: %s {start|stop|restart}\n'"$prog"
exit 1
;;
esac

相關推薦

Redis——叢集搭建(基於CentOS6.X單機節點)

一、安裝redis 1、安裝gcc環境 yum install gcc-c++ 2、下載原始碼包並解壓 wget http://download.redis.io/releases/redis-3.2.12.tar.gz tar -zxvf redis-3.2.1

Redis叢集搭建

OS:Ubuntu16.04LTS Resis:3.2.11(3.x以後支援叢集) 單機 1、先決條件 sudo apt install build-essential

基於centos6.x環境下GRE隧道的搭建及分析

gre GRE一、網絡拓撲二、環境介紹所有服務器系統均是centos6.5,內核:2.6.32-431.el6.x86_64centos1:一張網卡eth1:192.168.10.10,gw:192.168.10.1,僅主機vmnet1R:兩張網卡eth0:192.168.20.1,僅主機vmnet2

Redis sentinel叢集搭建

環境 由於不太熟悉docker,所以,把docker當虛擬機器來用,伺服器環境如下: Redis Server 環境搭建  Redis Server 01 搭建 並且製作Redis映象 容器建立 # docker run -i -t --name redis_server_01 --

redis單機節點叢集搭建

注意:        在叢集過程前一定要把字尾為aof,rdb的redis資料儲存檔案刪除(或者備份到其他資料夾,只要不是/root/下就可以),否則會叢集失敗。第一步:安裝Redis(redis安裝)Reids安裝包裡有個叢集工具,要複製到/usr/local/bin裡去c

Hadoop2.7.2叢集搭建單機

下載安裝Hadoop 1、下載地址 http://hadoop.apache.org/releases.html 我下載的是2.7.2,官網在2.5之後預設提供的就是64位的,這裡直接下載下來用即可 2、安裝Hadoop tar -

Hyperledger Fabric v1.1 單機節點叢集環境搭建

Fabric v1.1 1.環境安裝 1).安裝go 1.9.x 下載地址 http://golang.org/dl/ 配置環境 #go的安裝根目錄 export GOROOT=/usr/local/go #go的工作路徑根目錄 export GOPAT

使用docker redis-cluster叢集搭建

參考https://www.cnblogs.com/cxbhakim/p/9151720.html此文 主要搭建過程參考上文,此處講下主要過程和遇到的坑 首先是映象的基礎搭建,我不知道是否是作者編寫時和我現在的版本不同了,第一個坑點Dockerfile中FROM Centos:7,這去掉算

自然語言處理搭建基於HanLP的開發環境(轉)

環境搭建比FNLP的簡單,具體參考:https://github.com/hankcs/HanLP 各個版本的下載:https://github.com/hankcs/HanLP/releases 完畢後有一個報錯: 字元型別對應表載入失敗: D:/eclipse_workspace

Redis學習筆記(5)—— Redis的持久化方案&Redis叢集搭建

一、Redis的持久化方案   Redis的高效能是由於其將所有資料都儲存在了記憶體中,為了使Redis在重啟之後仍能保證資料不丟失,需要將資料從記憶體中同步到硬碟中,這一過程就是持久化。        Redis支援兩種方式的持久化,一種是RDB方式,一種是AOF

Redis 5 叢集搭建

實驗環境 在VMware中準備3個虛擬機器,每個虛擬機器部署2個redis,實現一個總共6個節的redis叢集。 redis服務使用單獨的redis使用者和使用者組啟動。所有檔案都在/home/redis目錄下。 OS: CentOS-7-x86_64-Minimal

redis cluter叢集搭建+springboot整合

Redis Sentinel提供高可用,通過Redis Cluster提供自動分割槽.記錄一下redis 叢集搭建及與springboot整合 Redis Cluster 將所有資料劃分為 16384 的 slots,Cluster預設會對key值使用crc1

Redis叢集部署

部署 ① 環境準備 準備三臺機器(192.168.124.1、192.168.124.2、192.168.124.3),每臺部署兩個Redis例項 192.168.124.1部署7001,7002埠例項的Redis  192.168.124.2部署7003,7004

7.redis cluster叢集搭建(6個節點)

本文是3臺伺服器,1:7001,7002 ; 2: 7003,7004 ; 3:7005,7006 1.安裝redis,同前面文章所提的安裝過程(僅安裝,暫不配置配置檔案) 注意: (1).在etc目錄下新建幾個資料夾 a. redis 用於存放redis.

redis cluster叢集搭建與深入分析(1)

對於之前所講的master+slave進行讀寫分離同時通過sentinel叢集保障高可用的架構,對於一般的資料量系統已經足夠。但是對於資料量龐大的T級別的資料,單master可能就無法滿足橫向擴充套件的場景。所以redis cluster支援多master

Redis-Cluster 叢集搭建(三主三從)

搭建Ruby yum install ruby yum install rubygems 安裝redis 和 gcc,tcl [[email protected] src]# yum install -y gcc-c++ [[ema

Spark叢集搭建+基於zookeeper的高可用HA

export JAVA_HOME=/usr/java/jdk1.8.0_20/ export SCALA_HOME=/home/iespark/hadoop_program_files/scala-2.10.6/ export HADOOP_HOME=/home/iespark/hadoop_program

千萬級使用者Redis快取叢集搭建以及專案實戰

Redis單機版搭建 3.1安裝redis ?版本說明 本教程使用redis3.0版本。3.0版本主要增加了redis叢集功能。 安裝的前提條件: 需要安裝 gcc:yum install gcc-c++ 1、下載redis的原始碼包。 2

Redis叢集刪除-yellowcong

有的同學,在搭建Redis的叢集的時候,搭建出了錯誤,比如配置檔案錯了,想修改後,再建立叢集,遇到節點不為空的情況,需要刪除redis每個節點的叢集配置檔案和aof和rdb檔案,然後才可以重新建立

Redis詳細叢集搭建管理_2018_lcf

      目前Redis叢集搭建的方式有多種,例如使用zookeeper等,但從redis 3.0之後版本支援redis-cluster叢集,Redis-Cluster採用無中心結構,每個節點儲存資料和整個叢集狀態,每個節點都和其他所有節點連線 其結構特點: