Dubbo 版本升级 3.0.10 升级到 3.1.11 ,3.0.10升级到3.2.16 (过程素材、仅供参考)
2、原生 REST 协议(Netty Server)不支持设置 HTTP Status Code。3、不能直接使用 JAX-RS 标准的 @Context 注解获取 Servlet 上下文信息。4、不能使用JAX-RS标准的ExceptionMapper。5、不能输出HTTP日志。6、dubbo-rpc-rest包依赖了JAX-RS的实现RESTEasy,但不能处理javax.ws.rs.core
本次涉及 100+ Dubbo 后端服务升级,过程沉淀的一些素材、以及踩过的一些坑,将其整理成文,由于公司安全,暂时没有太多截图。
1. dubbo升级要求
由于安全要求,需要将 Nacos 从本地升级迁移到阿里云 MSE Nacos,但是对 Dubbo 版本有要求,因此需要对 Dubbo 先进行版本升级。当前服务版本是 3.0.10, 因此必须升级最低版本是 3.1。 本文是一些升级过程的素材。
2. 官方版本推荐
针对版本升级,Dubbo 官文推荐最稳定的版本如下:https://cn.dubbo.apache.org/zh-cn/download/

截止2026.3.17 Dubbo官方推荐的最稳定版本,分别是 3.1.11、3.2.19、3.3.6。因此目标版本如上。 不过在升级到这些稳定版本之前,有一些注意事项需要关注。
3. 版本升级详细(各个版本升级详细)
为了彻底了解升级影响,枚举了过程所有版本,了解fixed、feature等情况。具体如下:
主要分三个大版本,分别是3.1.x、3.2.x、3.3.x
3.0.10 -> 3.0.15
3.0.x 版本主要的一些 bug 和 fixed 情况如下:
|
3.0.11 版本 (fixed) |
Bug fixed |
https://github.com/apache/dubbo/releases/tag/dubbo-3.0.11 |
|
3.0.12 版本 (fixed) |
Bug fixed、部分小优化 |
https://github.com/apache/dubbo/releases/tag/dubbo-3.0.12 |
|
3.0.13 版本 (fixed) |
|
https://github.com/apache/dubbo/releases/tag/dubbo-3.0.13 |
|
3.0.14 版本 (feature) |
|
https://github.com/apache/dubbo/releases/tag/dubbo-3.0.14 |
|
3.0.15 版本 (feature) |
https://github.com/apache/dubbo/releases/tag/dubbo-3.0.15 |
3.1 -> 3.1.11
|
版本 |
升级内容 |
链接信息 |
|
3.1 版本 (feature) |
|
https://github.com/apache/dubbo/releases/tag/dubbo-3.1.0 |
|
3.1.1 版本(fixed) |
Bug fixed |
https://github.com/apache/dubbo/releases/tag/dubbo-3.1.1 |
|
3.1.2 版本(feature+fixed) |
Bug fixed |
https://github.com/apache/dubbo/releases/tag/dubbo-3.1.2 |
|
3.1.3版本( fixed 为主) |
Bug fixed 为主 |
https://github.com/apache/dubbo/releases/tag/dubbo-3.1.3 |
|
3.1.4 版本(feature+fixed) |
|
https://github.com/apache/dubbo/releases/tag/dubbo-3.1.4 |
|
3.1.5 版本(feature+fixed) |
Bug fixed |
https://github.com/apache/dubbo/releases/tag/dubbo-3.1.5 |
|
3.1.6 版本(feature+fixed) |
Bug fixed |
https://github.com/apache/dubbo/releases/tag/dubbo-3.1.6 |
|
3.1.7 版本(feature+fixed) |
Bug fixed |
https://github.com/apache/dubbo/releases/tag/dubbo-3.1.7 |
|
3.1.8 版本(fixed) |
Bug fixed |
https://github.com/apache/dubbo/releases/tag/dubbo-3.1.8 |
|
3.1.9 版本(fixed) |
Bug fixed |
https://github.com/apache/dubbo/releases/tag/dubbo-3.1.9 |
|
3.1.10 版本(fixed) |
Bug fixed |
https://github.com/apache/dubbo/releases/tag/dubbo-3.1.10 |
|
3.1.11 版本(feature) |
|
https://github.com/apache/dubbo/releases/tag/dubbo-3.1.11 |
3.2->3.2.16
|
3.2 版本 (core feature) |
|
https://github.com/apache/dubbo/releases/tag/dubbo-3.2.0 |
|
3.2.1 版本 (feature + fixed) |
....... |
https://github.com/apache/dubbo/releases/tag/dubbo-3.2.1 |
|
3.2.2 版本 (feature + fixed) |
....... |
https://github.com/apache/dubbo/releases/tag/dubbo-3.2.2 |
|
.... |
.... |
.... |
|
3.2.16 版本 (feature + fixed) |
Bug fixed |
https://github.com/apache/dubbo/releases/tag/dubbo-3.2.16 |
注意大版本的更新都是跨度比较大的,在更新的时候特别要注意前后兼容。
4. 升级注意实现
4.1. 一些踩坑细节
|
MetadataInfo#getParameter #NPE |
Fastjson2 对特殊字符反序列化失败 |
排除 Fastjson2 |
|
日志不断输出 disconnected、 established (解决) |
dubbo3.2.16 对日志修改,会打印 pod 的就绪探针日志,、NettyServerHandler的disconnect 日志输出 |
日志级别修改。(pod probe 的端口可以改成 QOS) |
|
rest 变动从 servlet server-> netty server |
3.2 版本改动了 rest server 的实现,移除所有 servlet 的server |
可以解决,切换实现类; 但不能兼容上层应用的 API |
|
Unsupported protocol 协议不支持 |
由问题MetadataInfo#getParameter #NPE 导致,生成 empty//xxx 协议 |
排除 Fastjson2 |
|
No Provider 服务找不到(偶现,由多种原因共同组成产生) |
排除问题1.2 ; 且升级版本未重现 |
未重现 |
4.2. 3.2.x 版本(重点变化)
1、REST Server只支持netty,配置成其他最后实例化都是使用NettyHttpRestServer,源码只支持 netty,不再支持其他的 server
2、原生 REST 协议(Netty Server)不支持设置 HTTP Status Code。
3、不能直接使用 JAX-RS 标准的 @Context 注解获取 Servlet 上下文信息。
4、不能使用JAX-RS标准的ExceptionMapper。
5、不能输出HTTP日志。
6、dubbo-rpc-rest包依赖了JAX-RS的实现RESTEasy,但不能处理javax.ws.rs.core.Response。
RpcContext.getContext().getRequest(NettyRequestFacade.class) 兼容; 但上下文传递过程,一旦有未升级的服务,那么上下文获取会失败,导致调用异常、数据丢失等风险。
4.3. 序列化协议升级
- 在
3.1.0版本中,Dubbo 默认支持的序列化协议新增对 Fastjson2 的支持。部分用户可能会考虑在现有的系统中对序列化协议进行升级,但服务端和客户端版本的差异可能导致客户端并不支持服务端的序列化协议。 - 在
3.2.0版本中, Dubbo 的服务端引入新的配置prefer-serialization,该特性可以完美解决服务端序列化升级过程中可能带来的风险。
升级协议需要的注意事项
4.4. github 的问题讨论
关于版本升级,也在 dubbo 官网发起过一些讨论。主要是 3.2 有较大版本的变化。
|
3.2 版本丢弃 servlet server,换成 netty server,如果平滑升级? |
|
|
dubbo repeatedly established and disconnected connections ? |
https://github.com/apache/dubbo/discussions/15159 |
|
dubbo upgrade 3.0.10->3.2.16, occurred NPE ? #15132 |
https://github.com/apache/dubbo/discussions/15132 |
4.5. 兼容注意事项
|
检查项目 |
具体描述 |
|
检查application.yml 是否配置属性: 如果没有配置,则直接跳过 |
从 Dubbo 3.1.0 开始, 点击查询详情 (3.0->3.1) |
|
3.2 版本中,Dubbo 将默认开启序列化白名单的强校验。application.yml 中增加配置 -Ddubbo.application.serialize-check-status=WARN |
在升级 Dubbo 3.2.0 版本前添加 点击查询详情 (3.1->3.2) |
|
Dubbo 3.2.0 版本开始默认序列化方式从 如果序列化没有特殊要求,可以跳过 |
Dubbo 3.2.0 版本开始默认序列化方式从 如果有配置序列化要求,则选择配置: dubbo.provider.prefer-serialization=fastjson2,hessian2 点击查询详情 (3.1->3.2) |
4.6. github常见问题
- https://github.com/apache/dubbo/issues/10732 (多实例部署,部分服务启动的时候报错,找不到provider, 服务提供者是正常部署的)
- https://github.com/apache/dubbo/issues/11310 (Dubbo3.1.2经常找不到服务的提供者 #11310)
- https://github.com/alibaba/fastjson2/issues/1257 (com.alibaba.fastjson2.JSONException: skip not support type INT32 68)
- https://github.com/apache/dubbo/issues/15107
- https://github.com/apache/dubbo/issues/11121(Why does the console always appear ‘All clients has disconnected from)
5. live 存活探针日志 (额外)
https://blog.csdn.net/shupili141005/article/details/137884052
https://support.huaweicloud.com/basics-cce/kubernetes_0026.html
|
https://blog.csdn.net/shupili141005/article/details/137884052
<!-- k8s liveness probe qos日志很多,不打印 --> <logger name="org.apache.dubbo.qos.command" level="warn" additivity="false"/> logging.level.org.apache.dubbo.qos.command=warn |
6. 充分测试
迁移过程离不开充分的测试。包括全链路测试、多维度多角度测试、灰度等,下面是一些测试视角:
- 单服务
- 集群
- 消费者、服务者
- Instance、All 等注册模式
- .......
保障测试到位,避免升级代理的不兼容带来的业务影响。
更多推荐




所有评论(0)