摘要: 1、如果在(a,b,c)三个字段上建立联合索引,那么它能够加快 a | (a,b) | (a,b,c) 三组查询速度。 select count(distinct left(code, 5))/count(*) from device; 说明:建索引时使用上述语句看看区分度,选择合适的长度,通常区分 阅读全文
posted @ 2020-04-22 10:21 御简 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 项目中遇到一种情况:前端有一个对外接口,可将用户交互信息保存到数据库,这个接口没有访问限制,有恶意攻击的风险。 采用了限制IP请求次数的方式,示例如下: // 通过HttpServletRequest获取ip地址 String ip = request.getRemoteAddr(); // 制定r 阅读全文
posted @ 2020-04-17 10:11 御简 阅读(418) 评论(0) 推荐(0) 编辑
摘要: 直接上代码: 1、在vue中main.js中引入echarts import echarts from 'echarts' Vue.prototype.$echarts = echarts 2、折线图 drawLine(id, data) { const ct = this.$echarts.ini 阅读全文
posted @ 2020-04-01 11:02 御简 阅读(616) 评论(0) 推荐(0) 编辑
摘要: 需求说明: 前端某个折线图需要展示历史数据,时效性并不强,主要是看一个大体的趋势。但是数据量较大,为了提高查询速度,采用对数据稀释和引入Redis缓存。 1、首先是获取数据,我获取回来的是List<Map<String, Object>>类型 2、稀释数据,我把它稀释到不超过200条,这样对于一个展 阅读全文
posted @ 2020-04-01 10:29 御简 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 直接上代码: 1、定义静态方法 import com.alibaba.fastjson.JSON; public class MessageUtils implements Cloneable { private static final MessageUtils instance = new Me 阅读全文
posted @ 2020-04-01 09:57 御简 阅读(745) 评论(0) 推荐(0) 编辑
摘要: 直接上代码: 1、定义配置类 import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframe 阅读全文
posted @ 2020-04-01 09:40 御简 阅读(1396) 评论(0) 推荐(0) 编辑
摘要: 直接上代码: 1、定义一个配置类 import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframe 阅读全文
posted @ 2020-04-01 09:13 御简 阅读(2528) 评论(0) 推荐(0) 编辑
摘要: 项目情况: springboot: 2.2.2 grpc-spring-boot-starter: 2.6.1.RELEASE 项目目录: mypro: - person - grpc服务端 - lib - 公共库 - device - grpc客户端 项目建立可参考:项目建立部分可参考我另一篇随笔 阅读全文
posted @ 2020-01-16 15:33 御简 阅读(1705) 评论(2) 推荐(0) 编辑
摘要: 项目情况说明: ubuntu - 16.04 java - openjdk:8 springboot - 2.2.2.RELEASE mysql - 5.7 mongodb - 4.0.14 redis - 3.0.6 grpc - grpc-spring-boot-starter - 2.6.1. 阅读全文
posted @ 2020-01-16 14:58 御简 阅读(3596) 评论(0) 推荐(0) 编辑
摘要: 该文章已更新,更新时间:2020-9-22 14:11:18 ubuntu16.04 docker 19.03.12 k8s 1.18.0 istio 1.5.0 准备工作: 关闭交换空间,虚拟化技术必须关闭交换空间 swapoff -a 查看交换空间 free -h 避免开机启动交换空间,打开下面 阅读全文
posted @ 2020-01-09 18:11 御简 阅读(1192) 评论(0) 推荐(0) 编辑