- 博客(9)
- 资源 (15)
- 收藏
- 关注
原创 RestTemplate下载大文件时OOM问题解决
1 背景代码中使用RestTemplate下载大文件,发现会OOM,代码如下:RestTemplate restTemplate = new RestTemplate();// 会OOMResponseEntity<byte[]> entity = restTemplate.getForEntity("http://localhost:8088/1.jar", byte[].class);log.info(entity.toString());报错信息如下:Excep
2021-03-21 13:04:33 1814
原创 Apache httpd禁用特定的接口URL
1 背景Spring Cloud微服务架构:有很多个服务服务暴露到公网:使用Apache httpd实现反向代理暴露到公网存在的问题:一些接口存在安全漏洞,在安全漏洞未解决前需要停用该接口,但其它服务及接口依然保持正常运行。目标:对特定接口进行禁用,使得调用方无法访问。2 解决假设目前Apache httpd配置如下:<VirtualHost *:39999> ServerName localhost:39999 ProxyPass
2021-03-21 13:00:30 1100 2
原创 Consul移除不使用的服务(Deregister Service)
1 背景项目中有两个Consul,第一次用的Consul1,后面迁移到了Consul2。但是Consul1依然使用,但是发现应该注册到Consul2的服务在Consul1中也可以看到。所以需要把服务从Consul1中剔除掉。2 解决2.1 找到Consul中要剔除的服务及其服务IDhttp://localhost:8500/ui/dc1/services单击"api-gateway-consul"服务,可以看到ID是"api-gateway-consul-5555"2
2021-03-21 12:58:24 3401
原创 SpringBoot升级到2.3.x后返回message为空
1 背景SpringBoot项目版本升级:2.1.6.RELEASE -> 2.3.9.RELEASE版本升级后,原有一些自定义异常的的错误message无法返回了。// 预期结果{ "timestamp": "2021-03-02T06:36:09.458+00:00", "status": 500, "error": "Internal Server Error", "message": "用户名已存在", "path": "/user"}
2021-03-21 12:50:25 735 3
原创 Redis Cluster(集群)模式下批量删除key
1 背景SpringSecurity版本升级后,发现会有反序列化失败问题。所以需要将Redis中存储token相关key批量删除掉:access:* auth_to_access:* auth:* refresh_auth:* refresh:* refresh_to_access:* client_id_to_access:* uname_to_access:*2 解决2.1 单机Redis批量删除方法# 最简单的例子:实现批量删除auth:开头的keyredis-
2021-03-21 12:45:22 2693
原创 SpringSecurity版本升级后报错:local class incompatible: stream classdesc serialVersionUID = 510, local class
背景版本升级:SpringBoot: 2.1.6.RELEASE -> 2.3.9.RELEASE SpringSecurity:5.1.5.RELEASE ->5.3.8.RELEASE认证鉴权设计:SpringSecurity JWT + Redis升级完成后,认证时报错:Caused by: java.io.InvalidClassException: org.springframework.security.core.authority.SimpleGr...
2021-03-21 12:42:24 2784
原创 Nginx路径重写(rewrite)案例 - 根据$query_string进行重写
1 背景FastDFS-Nginx:http://192.168.1.33:9001业务服务:http://192.168.1.34:5001/zs/api/v1下载接口:http://192.168.1.34:5001/zs/api/v1/file/bytes前置Nginx(外部访问都通过这个Nginx):http://localhost:80881.1 FastDFS与Nginx项目中有使用FastDFS,并使用Nginx访问FastDFS中的附件(通过fastdfs-nginx
2021-03-21 12:39:32 1624
原创 长事务导致的一次生产故障
1 背景项目信息:Oracle11g,空间超时时间为10min Spring Boot 2.1.6.RELEASE ORM:MyBatis-Plus DataSource:Druid业务逻辑:Controller调用Service,Service(实现类上加了@Transaction注解)中包含两段代码:大量RPC调用来汇聚数据,持续时间为40min左右,调用次数为2400次左右 将上述数据saveOrUpdateBatch到数据库中去MyBatisPlus的saveOrUpdate
2021-03-04 20:33:54 1094 1
原创 Oracle表空间数据文件扩展:解决ORA-01653: unable to extend table xxx by 8192 in tablespace xxx
1 背景项目使用Oracle 11g数据库,初期每个Schema只有一个数据文件。当时创建Scheme的语句大致如下:create tablespace xjxnh datafile '/oracle/oradata/orcl/xjxnh.dbf' size 200m reuse autoextend on next 100m extent management local segment space management auto;可以看到,初始200MB,也能够自动扩展空间。但是,在
2021-03-04 20:27:43 1800 3
NWJS(NodeJS)调用小票机demo.zip
2021-03-22
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人