当前位置: 首页 > news >正文

redis快速部署、集成、调优

redis快速部署、集成、调优

1.部署

1.1 docker部署

参考:https://blog.csdn.net/taotao_guiwang/article/details/135508643
在这里插入图片描述

1.2 redis部署

  • 资源见,百度网盘:https://pan.baidu.com/s/1qlabJ7m8BDm77GbDuHmbNQ?pwd=41ac
    在这里插入图片描述
  • 执行redis_install.sh,开始部署:
# 赋权,在redis_install目录,执行:
chmod -R 777 .
# 执行
./redis_install.sh.sh

在这里插入图片描述

2. spring boot集成

核心代码,IndexController.java:

package com.redis;import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;@RestController
public class IndexController {private static final Logger logger = LoggerFactory.getLogger(IndexController.class);@Autowiredprivate StringRedisTemplate stringRedisTemplate;@RequestMapping("/test")public void testSentinel() throws InterruptedException {try {stringRedisTemplate.opsForValue().set("testKey", "testValue"); //jedis.set(key,value);System.out.println("设置key:"+ "testKey");}catch (Exception e){logger.error("错误:", e);}}}

application.yml:

server:port: 8080spring:redis:host: 10.86.97.210port: 6379database: 0timeout: 3000password: test@123456
#    sentinel:    #哨兵模式
#      master: mymaster #主服务器所在集群名称
#      nodes: 192.168.65.60:26379,192.168.65.60:26380,192.168.65.60:26381
#    cluster:
#      nodes: 192.168.50.61:8001,192.168.50.62:8002,192.168.50.63:8003,192.168.50.61:8004,192.168.50.62:8005,192.168.50.63:8006lettuce:pool:max-idle: 50min-idle: 10max-active: 100max-wait: 1000

浏览器访问:
http://localhost:8080/test

控制台打印:
在这里插入图片描述
redis desktop manager:
在这里插入图片描述

3.相关资源

百度网盘:https://pan.baidu.com/s/1qlabJ7m8BDm77GbDuHmbNQ?pwd=41ac
在这里插入图片描述

http://www.dtcms.com/a/309085.html

相关文章:

  • Linux通用SPI作为Master——回环测试
  • Redis学习-----Redis的基本数据类型
  • Dify版本升级实操
  • Edge中如何找到原IE浏览器的Internet选项
  • 基于html,css,jquery,django,lstm,cnn,tensorflow,bert,推荐算法,mysql数据库
  • 8月1日RED指令强制生效,您的设备准备好了吗?
  • uniapp 开发微信小程序,获取经纬度(uni.getLocation)并且转化详细地址(‌高德地图逆地理编码API、‌腾讯地图逆地理编码)
  • 【华为机试】127. 单词接龙
  • Python match-case 模式匹配详解
  • 【Mysql】字段隐式转换对where条件和join关联条件的影响
  • 【Java面试题】缓存穿透
  • 什么是doris
  • 优化网站域名的SEO策略指南
  • Qt开发中的安全技术问题详解
  • MySQL(172)如何进行MySQL的全局变量设置?
  • 深度揭秘端口映射:原理、场景、路由映射故障,与内网IP端口映射外网工具的选择
  • 微服务消息队列之RabbitMQ,深入了解
  • 逻辑斯蒂回归的模型优化
  • IO流-文件实例
  • MySQL--组从复制的详解及功能演练
  • 数据赋能(371)——数据挖掘——概述
  • java的冒泡排序算法
  • 从O(n²)到O(n log n):深度剖析快速排序的内存优化与cache-friendly实现
  • Java Map和Set
  • Vue 3.5 defineModel:让组件开发效率提升 10 倍
  • 自行实现log2对数运算
  • Pydantic模块学习
  • TDengine 中 TDgp 中添加机器学习模型
  • AT6668B芯片说明书
  • unity学习——视觉小说开发(一)