惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

GbyAI
GbyAI
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Jina AI
Jina AI
H
Help Net Security
月光博客
月光博客
Y
Y Combinator Blog
I
InfoQ
博客园 - Franky
W
WeLiveSecurity
The Register - Security
The Register - Security
博客园 - 叶小钗
Google DeepMind News
Google DeepMind News
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Blog — PlanetScale
Blog — PlanetScale
H
Hacker News: Front Page
L
LangChain Blog
S
Security @ Cisco Blogs
Hacker News - Newest:
Hacker News - Newest: "LLM"
罗磊的独立博客
V2EX - 技术
V2EX - 技术
H
Heimdal Security Blog
博客园_首页
SecWiki News
SecWiki News
N
News and Events Feed by Topic
B
Blog RSS Feed
S
Secure Thoughts
TaoSecurity Blog
TaoSecurity Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
AI
AI
Google Online Security Blog
Google Online Security Blog
MongoDB | Blog
MongoDB | Blog
T
Troy Hunt's Blog
A
About on SuperTechFans
WordPress大学
WordPress大学
小众软件
小众软件
The Last Watchdog
The Last Watchdog
J
Java Code Geeks
PCI Perspectives
PCI Perspectives
博客园 - 聂微东
N
News | PayPal Newsroom
Schneier on Security
Schneier on Security
Help Net Security
Help Net Security
Martin Fowler
Martin Fowler
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
U
Unit 42
博客园 - 司徒正美
Forbes - Security
Forbes - Security
酷 壳 – CoolShell
酷 壳 – CoolShell
S
Security Affairs

博客园 - 锐洋智能

windows 下 降级迁移 Redis 8.8.0(源) → Redis 8.6.3(目标) Eclipse IDE for Enterprise Find/Replace 窗口可以"停驻" 安装 SDelete 方式 SDelete 的核心作用,不是 “删文件”,而是 “把你已经删掉的文件,彻底从磁盘上抹干净”,同时帮你把虚拟机里的 “空闲空间” 变成连续的、可被回收的状态。 windows 10 启动就运行了一个批处理文件 在什么地方修改?启动项中? 让 Spring Framework7.0.7 支持 velocity Java 9+ 开启了模块化安全限制,不允许 Ignite 直接访问底层内存地址,导致 Ignite 启动失败 Spring 5.x + 老项目的 JWT 拦截器 + 自动续期 接口鉴权:Session/Cookie 与 JWT 的核心区别 Redis-8.6.3-Windows-x64-cygwin 与 Redis-8.6.3-Windows-x64-msys2 有什么不一样? commons-fileupload2 M4 升级 M5 报错解决方案 阿里云的网络安全策略 ip 地址详细说明 Paralithic、 QLExpress、AviatorScript、exp4j 性能对比一下 java 序列化影响(重要!) paralithic 与 Aviator 表达式那一个更快 券商接受委托的完整时间线 jQuery 4.0 移除了许多已废弃的方法和特性 xheditor插件无限递归错误解决方法 jedis-7.1.0.jar 升级至 jedis-7.2.0.jar 就提示:The type JedisPoolConfig is deprecated The type JedisPooled is deprecated Spring 从 5.x 到 6.x 和 7.x 区别 js 原生 剪切板 复制功能 安装 Microsoft Visual C++ 运行时 Java与Python进程通信优化方案 Autocomplete | jQuery UI 同一面页定义不同的 .ui-autocomplete Quartz的misfire处理策略设置不当导致Job在应用启动时立即执行。 mysql-connector-j-9.5.0.jar BUG 推荐几款好用的CSS在线压缩工具 CSS 变量 定义及引用 TLS virtual host [_default_], certificate type [RSA] configured from keystore [d:/reyo/jks/localhost.jks] using alias [tomcat] with trust store [null] okhttp5.x 需要在 请求级别 控制是否使用重试拦截器,而不是在客户端级别 Apache Commons FileUpload 1.x 与 2.x 的主要区别
下是针对 RedisSessionManager 的 Tomcat context.xml 配置示例,覆盖基础单机 Redis、带密码 / 指定库、Redis 哨兵集群、自定义序列化 / 持久化策略 等常见场景
锐洋智能 · 2026-05-21 · via 博客园 - 锐洋智能

核心说明

配置中所有 className 需指向实际的 RedisSessionManager 全类名(示例中为 reyo.redis.session.manager.tomcat9.RedisSessionManager),Valve 需配置 RedisSessionHandlerValve 用于请求后会话持久化。


示例 1:基础单机 Redis 配置(最简版)


示例 2:单机 Redis(带密码 / 自定义超时 / 指定 DB)

适配生产环境单机 Redis(指定密码、超时时间、数据库):

<Context>
    <Manager className="reyo.redis.session.manager.tomcat9.RedisSessionManager"
             host="192.168.1.100"  <!-- Redis 服务器IP -->
             port="6380"           

示例 3:Redis 哨兵集群配置(高可用)

适配 Redis 哨兵模式(主从 + 哨兵),需指定哨兵主节点名和哨兵列表:

<Context>
    <Manager className="reyo.redis.session.manager.tomcat9.RedisSessionManager"
             sentinelMaster="mymaster"  <!-- 哨兵配置的主节点名称 -->
             sentinels="192.168.1.101:26379,192.168.1.102:26379,192.168.1.103:26379"  

示例 4:自定义序列化策略 + 多持久化策略

指定自定义序列化类(替代默认 JavaSerializer),并组合持久化策略:

<Context>
    <Manager className="reyo.redis.session.manager.tomcat9.RedisSessionManager"
             host="192.168.1.100"
             port="6379"
             password="redis@123"
             serializationStrategyClass="com.custom.serializer.FastJsonSerializer"  <!-- 自定义序列化类 -->
             sessionPersistPolicies="SAVE_ON_CHANGE,ALWAYS_SAVE_AFTER_REQUEST"/>  

注:自定义 serializationStrategyClass 需实现 reyo.redis.session.manager.tomcat9.Serializer 接口。


示例 5:完整生产级配置(含 JVM 路由 / 会话超时)

适配分布式 Tomcat 集群(指定 JVM Route,配合负载均衡):

<Context jvmRoute="tomcat-node1">  

关键配置参数说明

注意事项

  1. 需确保 Redis 客户端依赖(jedis)已放入 Tomcat 的 lib 目录;
  2. RedisSessionHandlerValve 必须配置,否则请求结束后会话无法持久化到 Redis;
  3. 哨兵模式下,host/port 配置会被忽略,以 sentinelMaster/sentinels 为准;
  4. 自定义序列化类需保证可序列化 / 反序列化 Tomcat 会话对象,避免类加载异常