高速缓存利用内存保存数据,读写速度远超硬盘
高速缓存可以减少I/0操作,减少I/O压力
淘宝APP首页 : 热数据-->redis、普通数据-->mysql
切分存储,引入冗余节点
Master-->复制Slave
Redis不配置负载均衡,Spring配置好了
docker pull yyyyttttwwww/redis
创建容器:docker run -it -d --name r1 -p 5001:6379 --net=net2 --ip 172.19.0.2 redis bash
解除docker集群:docker swarm leave -f
docker network ls
docker network rm docker_gwbridge
创建docker network2网络:docker network create --subnet=172.19.0.0/16 net2
执行容器:docker exec -it r1 bash
/usr/redis/redis.conf
<pre spellcheck="false" class="md-fences md-end-block md-fences-with-lineno ty-contain-cm modeLoaded" lang="shell" cid="n66" mdtype="fences" style="box-sizing: border-box; font-variant-ligatures: none; overflow: visible; font-family: "JetBrains Mono"; break-inside: avoid; word-wrap: break-word; font-size: 0.9em; display: block; text-align: left; white-space: normal; background-color: rgb(238, 238, 238); position: relative !important; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; color: rgb(85, 85, 85); padding: 0.4em 1em 0.4em 0px; overflow-wrap: break-word; margin: 0px 0px 20px; line-height: 1.5em; width: inherit; background-position: initial initial; background-repeat: initial initial;"> daemonize yes # 以后台进程运行
cluster-enabled yes # 开启集群
cluster-config-file nodes.conf # 集群配置文件
cluster-node-timeout 15000 # 超时时间
appendonly yes # 开启AOF模式,日志功能,一旦宕机,自动回复</pre>
--replicas 1 参数表示为每个主节点创建一个从节点
./redis-trib.rb create --replicas 1 ip1 ip2 ip3 ip4 ip5 ip6
利用redis-trib.rb创建集群
gem install redis
apt-get install rubygems
apt-get install ruby
cd /usr/redis/cluster
mkdir -r /usr/redis/cluster
cp /usr/redis/src/redis-trib.rb /usr/redis/cluster
redis-trib是基于Ruby的Redis集群命令行工具
创建6个相同节点
./redis-server ../redis.conf
cd /usr/redis/src
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有