NRedis-Proxy - 高性能中间件服务器
2019獨角獸企業(yè)重金招聘Python工程師標(biāo)準(zhǔn)>>>
高性能中間件服務(wù)器
一、 NRedis-Proxy 介紹
NRedis-Proxy 是一個Redis中間件服務(wù),第一個Java 版本開源Redis中間件,無須修改業(yè)務(wù)應(yīng)用程序任何代碼與配置,與業(yè)務(wù)解耦;以Spring為基礎(chǔ)開發(fā)自定義標(biāo)簽,讓它可配置化,使其更加容易上手;提供RedisServer監(jiān)控以及自動、收到failover等功能;以netty 作為通信傳輸工具,讓它具有高性能,高并發(fā),可分布式擴展部署等特點,單機器單個RedisServer QPS在9千左右。
二、 NRedis-Proxy 架構(gòu)圖
a) 系統(tǒng)架構(gòu)圖
b) 技術(shù)架構(gòu)圖
c) 部署架構(gòu)圖
三、 NRedis-Proxy 優(yōu)勢以及缺點
a) 功能優(yōu)勢
b) 天然缺點
中間件的存在,會自帶網(wǎng)絡(luò)損耗,但是網(wǎng)絡(luò)帶寬足夠,可以忽略不計,最主要損耗在于協(xié)議解析。相比客戶端分片等策略,中間件可以解決客戶端應(yīng)用過多,解決M*N 問題,Redis-Server連接數(shù)不夠,造成機器CPU性能降低;如下圖:
四、 NRedis-Proxy 類邏輯調(diào)用圖
五、 NRedis-Proxy 配置標(biāo)簽
a) redisProxyNode
| 1 | id | Spring 標(biāo)簽唯一標(biāo)志 |
| 2 | redisProxyHost | NRedis-proxy 對外提供主機號 |
| 3 | redisProxyPort | NRedis-proxy 對外提供端口號 |
| 4 | algorithm-ref | NRedis-proxy 多主分片實現(xiàn)類引用 |
| 5 | address | Zookpeer 地址 |
b) redisProxyMaster
| 1 | id | Spring 標(biāo)簽唯一標(biāo)志 |
| 2 | host | RedisServer主主機名 |
| 3 | port | RedisServer主端口號 |
| 4 | algorithm-ref | NRedis-proxy 從分片讀取策略類引用 |
| 5 | config-ref | 連接池配置 |
c) redisProxyCluster
| 1 | id | Spring 標(biāo)簽唯一標(biāo)志 |
| 2 | host | RedisServer主主機名 |
| 3 | port | RedisServer主端口號 |
| 4 | algorithm-ref | NRedis-proxy 從分片讀取策略類引用 |
| 5 | config-ref | 連接池配置 |
| 6 | weight | 權(quán)重 |
d) redisPoolConfig
| 1 | id | Spring 標(biāo)簽唯一標(biāo)志 |
| 2 | connectionTimeout | 連接超時時間 |
| 3 | maxActiveConnection | 最大活躍連接數(shù) |
| 4 | maxIdleConnection | 最大空閑連接數(shù) |
| 5 | minConnection | 最小連接數(shù) |
| 6 | maxWaitMillisOnBorrow | 取出最大等待時間 |
| 7 | initialConnection | 初始化連接數(shù) |
| 8 | timeBetweenEvictionRunsMillis | 每隔多久檢查一次連接池 |
| 9 | minEvictableIdleTimeMillis | 連接池最小生存時間 |
| 10 | minIdleEntries | 最小空閑數(shù) |
| 11 | testOnBorrow | 取出是否檢測 |
| 12 | testOnReturn | 歸還是否檢測 |
| 13 | testWhileIdle | 空閑是否檢測 |
e) 默認兩個分片策略
六、 NRedis-Proxy 部署
###1. 部署環(huán)境要求 ###
- 1.1 JDK 1.7
- 1.2 Redis-Server
- 1.3 Zookpeer3.4.6
###2. 調(diào)試步驟 ###
- ** 2.1 啟動Redis Server 主機器 **
- ** 2.2 啟動Redis Server **
- ** 2.3 啟動 zookpeer **
- ** 2.4 啟動NRedis-Proxy Server **
- ** 2.5 使用Redis 命令行連接NRedis-Proxy **
3. 部署方式
maven執(zhí)行nredis-proxy-bootstrap ,然后再找到 nredis-proxy-server.sh 文件執(zhí)行
七、 redis-monitor監(jiān)控
a) nredis-proxy監(jiān)控
b) redis-server監(jiān)控
c) redis-monitor本身監(jiān)控
八、 redis-monitor 服務(wù)治理
a) 定時器配置
b) 手動服務(wù)治理
c) 自動服務(wù)治理
轉(zhuǎn)載于:https://my.oschina.net/liubingsmile/blog/825474
總結(jié)
以上是生活随笔為你收集整理的NRedis-Proxy - 高性能中间件服务器的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: NETTY keeplive 参数,心跳
- 下一篇: MySQL数据高级查询之连接查询、联合查