【Linux(CentOS7)下應用的安裝部署】:八、搭建Redis+sentinel高可用服務
Step 1:Redis的下載安裝
官網下載redis 解壓並安裝:
[[email protected] ~]# cd /home/
[[email protected] home]# wget http://download.redis.io/releases/redis-4.0.11.tar.gz
[[email protected] home]# tar -zxvf -C redis-4.0.11.tar.gz
[[email protected] home]# cd redis-4.0.11/src
[[email protected] src]# make
編譯中.... ....
CC setproctitle.oCC hyperloglog.oCC latency.oCC sparkline.oLINK redis-serverINSTALL redis-sentinelCC redis-cli.oLINK redis-cliCC redis-benchmark.oLINK redis-benchmarkCC redis-check-dump.oLINK redis-check-dumpCC redis-check-aof.oLINK
redis-check-aof Hint: It’s a good idea to run ‘make test’ ;)
[[email protected] src]# make install
安裝中...... 完成
安裝完成,可以看到此時,src資料夾下出現了一些綠色的檔案,這些檔案就是我們以後需要用到的命令檔案
Step 2:Redis 主從複製的配置
1.在 redis 目錄下建立 config 和 data 資料夾:config 用來存放 redis.conf/sentinel.conf 配置檔案, data 用來存放 .log 檔案和 .rdb 檔案
[[email protected] redis-4.0.11]# mkdir config
[[email protected]
[[email protected] redis-4.0.11]# cd config/
2.配置 redis master 埠 7000 : 建立 redis_7000.conf
# Redis configuration file master.
#bind 127.0.0.1
#################### 埠 #############################
port 7000
#################### 是否以守護程序啟動 #################
daemonize yes
#################### 程序id檔案 ##############
pidfile /var/run/redis_7000.pid
####################### 系統日誌 ###############
logfile "redis_7000.log"
###################### rdb資料檔案 #############
dbfilename dump_7000.rdb
###################### 工作目錄 ###############
dir "/home/redis-4.0.11/data"
######################## 密碼 #####################
requirepass 123456
###################### 主要是以上的配置 #################
protected-mode no
tcp-backlog 511
timeout 0
tcp-keepalive 300
supervised no
loglevel notice
databases 16
always-show-logo yes
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
slave-priority 100
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
slave-lazy-flush no
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
# appendfsync no
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble no
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes
3.配置 redis slave 埠 7001/7002/7003 ...... : 建立 redis_7001.conf/redis_7002.conf/redis_7003.conf .......
# Redis configuration file slave NO.1.
#bind 127.0.0.1
####################### 主從複製:複製127.0.0.1 的資料 埠7000
slaveof 123.45.57.14 7000
#################### 埠 #############################
port 7001
#################### 是否以守護程序啟動 #################
daemonize yes
#################### 程序id檔案 ##############
pidfile "/var/run/redis_7001.pid"
####################### 系統日誌 ###############
logfile "redis_7001.log"
###################### rdb資料檔案 #############
dbfilename "dump_7001.rdb"
###################### 工作目錄 ###############
dir "/home/redis-4.0.11/data"
######################## 密碼 #####################
requirepass "123456"
# master 節點的密碼
masterauth "123456"
###################### 主要是以上的 #################
protected-mode no
tcp-backlog 511
timeout 0
tcp-keepalive 300
supervised no
loglevel notice
databases 16
always-show-logo yes
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
slave-priority 100
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
slave-lazy-flush no
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
# appendfsync no
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble no
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes
3.分別啟動 master/slave 的 redis 服務:
[[email protected] redis-4.0.11]# cd src
[[email protected] src]# ./redis-server /home/redis-4.0.11/config/redis_7000.conf
[[email protected] src]# ./redis-server /home/redis-4.0.11/config/redis_7001.conf
[[email protected] src]# ./redis-server /home/redis-4.0.11/config/redis_7002.conf
這樣就啟動好了 redis 主從服務
Step 3:Sentinel 高可用配置
在 config 目錄下建立多個 sentinel.conf 檔案 :sentinel_26379.conf/sentinel_26380.conf/sentinel_26381.conf ....(埠號不同就行)
port 26379
daemonize yes
dir "/home/redis-4.0.11/data"
logfile "sentinel_26379.log"
sentinel myid ac633fe2e30979a6e63e5bc26199ab2ace08f242
sentinel monitor mymaster redis服務ip 7000 2
sentinel auth-pass mymaster 123456
sentinel config-epoch mymaster 1
protected-mode no
[[email protected] redis-4.0.11]# cd src
[[email protected] src]# ./redis-sentinel /home/redis-4.0.11/config/sentinel_26379.conf
[[email protected] src]# ./redis-sentinel /home/redis-4.0.11/config/sentinel_26380.conf
[[email protected] src]# ./redis-sentinel /home/redis-4.0.11/config/sentinel_26381.conf
完成此操作即實現了 Redis sentinel 高可用
ps:
1. master /slave 的 redis.conf 最好配置密碼(一定要配置密碼:否則 JedisSentinelPool 報錯)
2. master /slave 的 redis.conf 最好配置的密碼相同
3. master /slave 的 redis.conf 配置 protected-mode no(sentinel.conf 裡面同樣需要配置)
相關推薦
【Linux(CentOS7)下應用的安裝部署】:八、搭建Redis+sentinel高可用服務
Step 1:Redis的下載安裝 官網下載redis 解壓並安裝: [[email protected] ~]# cd /home/ [[email protected] home]# wget http://download.redis.io/r
【Linux(CentOS7)下應用的安裝部署】:五、Maven安裝
下載安裝包 wget http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.5.2/binaries/apache-maven-3.5
【Linux(CentOS7)下應用的安裝部署】:二、Tomcat安裝
首先還是下載 [[email protected]_0_4_centos ~]# wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-8/v8.5.34/bin/apache-tomcat-8.5.34.tar.g
【Linux(CentOS7)下應用的安裝部署】:一、Java 安裝
1 :下載JDK 也可以直接用wget下載到 linux [[email protected] ~]# wget http://download.oracle.com/otn-pu
【Linux(CentOS7)下應用的安裝部署】:六、git客戶端安裝
git --version檢測到我的環境自帶的git版本,先解除安裝低版本的git。 使用命令:yum remove git解除安裝git 從官網上下載的git 官網地址https://git-scm.com/ 安裝依賴 yum install curl
Linux(Centos7)下,阿帕奇(Apache)伺服器的安裝與配置
Y6 Apache是世界使用排名第一的Web伺服器軟體。它可以執行在幾乎所有廣泛使用的計算機平臺上,由於其跨平臺和安全性被廣泛使用,是最流行的Web伺服器端軟體之一。它快速、可靠並且可通過簡單的API擴充,將Perl/Python等直譯器編譯到伺服器中。 下面介紹Apac
win10與linux(CentOS7)雙系統安裝
坑多,一個一個講。 1、儲存問題。 win10硬碟格式一般為NTFS,而linux下的硬碟格式通常為xfs。所以在安裝雙系統前,要對硬碟的格式進行整理。 win10的安裝簡單,此處不表。在win10安裝完畢之後,不管是用系統的硬碟管理也好,還是用硬碟格式化工具也好,要先空閒
Linux(Ubuntu)下如何安裝JDK
from website:http://www.cnblogs.com/savagemorgan/p/3650926.html 一、下載 首先,當然是要下載了。 按照需要選擇不同的版本。筆者選擇的是 jdk-7u45,如圖: 二、 解壓 將下載下來的 .tar.gz
在Linux(centos)下,安裝Apache和PHP環境
1.Apache安裝 # yum install httpd (centos之下,Apache的名字叫httpd,和Apache的主程式 httpd.exe 同名) 2.開啟並測試Apache (1)先確保,雲伺服器的80埠,是允許外網訪問的
linux(centos7)下SVN伺服器如何搭建
linux(centos)下SVN伺服器如何搭建?說到SVN伺服器,想必大家都知道,可以是在LINUX下如何搭建SVN伺服器呢?那麼今天給大家分享一下linux(centos)搭建SVN伺服器的思路! 雖然在windows上搭建SVN很簡單,但是效能卻不高,這
linux (centos)下安裝 mongodb v3.2 筆記
安裝 i686 src gpa logs http 權限 fig 說明 1.下載mongodb 默認都是64位的,這個有點尷尬。。。 64位系統下載地址: https://www.mongodb.org/dl/linux/x86_64-debian81?
linux(centos)下安裝ffmpeg
視頻 prior mir php 源碼編譯 category 緩存 www 一個 【備忘】windows環境下20行php代碼搞定音頻裁剪 上次我的這篇文章將了windows下web中如何操作ffmpeg的文章,這裏則記錄下linux(centos)下的安裝 首先:我花了中
Linux(ubuntu)下安裝pycharm出錯Unsupported major.minor version 52.0
version -i sim one line height 檢測 cin 變量 已安裝python 已安裝jdk 在pycharm文件夾中bin中執行sh ./pycharm.sh 時出錯:Unsupported major.minor version 52.0 這個錯誤
Linux(redhatcentos)下安裝xrdp
list 錯誤 端口 config cheng 根據 ase eas ssh Linux下安裝xrdp 使用rdp協議訪問遠程Linux桌面 一般情況下,如果需要登陸遠程Linux系統,我們會使用ssh/telnet來完成,如果需要登陸到遠程Linux系統的
Linux(CentOS)下安裝JDK和Tomcat
1.下載jdk-8u18 1-linux-x64.tar.gz2.上傳到伺服器3.解壓 tar -zxvf jdk-8u181-linux-x64.tar.gz4.配置環境變數 vi /etc/profil
Linux學習之路:第一章下載並安裝Linux(CentOS7)
備註:屬於個人分享,文章如有問題請留言,謝謝! 第一章下載並安裝Linux 1、官方下載地址: DVD ISO 基本安裝包 大小4.16G Everything ISO 最全安裝包
Linux(Ubuntu)下的OpenGl的環境安裝, 在qt程式中使用opengl庫
OpenGl的環境安裝 以下參考自: https://blog.csdn.net/wasaiheihei/article/details/52085397 1. 建立基本編譯環境 首先不可或缺的,就是編譯器與基本的函式庫,如果系統沒有安裝的話,請依照下面的方式安裝: $ sudo a
Linux(CentOS) 下安裝PhpStorm --CHL
#下載好jdk-8u60-linux-x64.gz 安裝檔案 tar -zxvf jdk-8u60-linux-x64.gz mv jdk1.8 jdk #進入安裝目錄 cd jdk #配置環境變數 vi /etc/profile export JAVA_HO
linux(centos7)中安裝mysql,修改密碼,遠端連線,從sqlyog連線一套教程(自己整理,筆記)
2.開啟MySQL遠端訪問許可權 允許遠端連線 改表法: use mysql; update user set host = '%' where user = 'root'; FLUSH PRIVILEGES; ps:網上還要修改防火牆的方法,我沒成功,
Linux(centos7)安裝
前期準備: 必須讓虛擬機器聯⽹網 關閉防⽕火牆 #停⽌止firewall服務 systemctl stop firewalld.service #禁⽌止firewall開機啟動 systemctl