前言:在上一文中,我講到了—為什麼要搭建集群及redis集群搭建的詳細步驟。今天給大家講解一下spring如何整合redis集群
而集群確包含了分片和哨兵的兩者的優點,既實現了記憶體資料的擴容,也實現了redis的高可用,而且集群確保了乙個或一定數量的redis宕機,也能夠讓程式正常的執行,這也是為什麼我們運用的集群,而不是分片或哨兵。
--------廢話有點多啊,下面進入今天的主題
之後ps -ef |grep redis
檢測所有的redis伺服器是否開啟
!--spring整合redis --
測試成功!!!
#標識ip位址和埠號資訊 ip:port
redis.node=
192.168
.126
.166
:6379
redis.nodes=
192.168
.126
.166
:6379
,192.168
.126
.166
:6380
,192.168
.126
.166
:6381
redis.sentinel=
192.168
.126
.166
:26379
redis.cluster=
192.168
.126
.166
:7000
,192.168
.126
.166
:7001
,192.168
.126
.166
:7002
,192.168
.126
.166
:7003
,192.168
.126
.166
:7004
,192.168
.126
.166
:7005
//標識配置類
最後進行測試,測試成功,那就spring整合redis集群成功!!!
Spring Boot系列筆記 整合Redis
autowired stringredistemplate stringredistemplate autowired redistemplate redistemplate redistemplate類中提供了redis常見的五種資料型別 stringredistemplate.opsforval...
如何使用Spring整合Mybatis?
1 在 spring 配置檔案中配置資料來源,首先引入外部資料原始檔,源 properties 檔案應放在 resources 資料夾下 propertyconfigurer class org.springframework.beans.factory.config.propertyplaceho...
Spring與Struts如何整合
struts,spring,hibernate三者也學習得差不多了,是時候該去深入了解如何去用spring來融合其他兩個 spring與struts如何整合 以下技術文件 網路 為了在struts中載入spring context,需要在struts config.xml檔案中加入如下部分 通過st...