- 博客(218)
- 资源 (4)
- 收藏
- 关注
原创 Mybatis Handler中需要注意的ResultSet 基础类型自动转化成false/0等问题
rs.getInt() 返回int类型,默认值为0,而不是数据库中是null,自动转化成0. 解决方式如下,添加抽象基础处理: import org.apache.ibatis.type.BaseTypeHandler; import java.sql.CallableStatement; import java.sql.ResultSet; import java.sql.SQLException; public abstract class BasicBaseTypeHandler<T.
2020-11-05 16:28:40
469
1
原创 缓存【一】缓存穿透、缓存击穿、缓存雪崩
一、缓存穿透: 用户请求的数据在缓存和数据库中都没有,用户却还是一直在请求,造成数据库大量无用数据库操作,造成资源浪费。这种情况很可能是被攻击了。 解决方式: 1、缓存空数据 缺点:造成空间浪费,可以对数据设置有效期。 2、布隆过滤器 二、缓存击穿: 用户请求数据缓存中不存在,数据库中存在。同时用户并发太大造成数据库压力瞬间增大。 解决方式: 增加并发锁,如果数据不存在,同一请求查数据库前先加锁,查询后是否锁 三、缓存雪崩 缓存在同一时刻失效...
2020-09-22 17:24:32
260
原创 docker【二】docker安装redis
参考地址:https://www.runoob.com/docker/docker-install-redis.html 获取镜像:docker pull redis:latest 验证查看镜像列表:docker images 启动:docker run -itd --name redis-test -p 6379:6379 redis shell命令行redis调用:docker exec -it redis-test /bin/bash 已启动,查看容器列表: docker container
2020-09-22 14:19:32
240
原创 排序-JAVA实现【十一】大文件排序
问题说明:有一个无续long型的大文件,超过系统内存,需要对其进行排序。 大文件排序,多线程并发处理: import lombok.SneakyThrows; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import java.io.*; import java.nio.charset.Charse
2020-06-24 18:11:51
951
原创 算法【一】约瑟夫问题
问题描述:n个人(编号0~(n-1)),从0开始报数,报到(m-1)的退出,剩下的人继续从0开始报数。求胜利者的编号。 公式法参考:https://blog.csdn.net/qq_25973267/article/details/50405616?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase&depth_1-utm_source=distribute.pc_r
2020-06-24 11:18:14
228
原创 多线程【一】线程自定义顺序执行
第一题:编写代码,使用3个线程,1个线程打印A,一个线程打印B,一个线程打印C,同时执行连续打印n次"ABC"; 第二题:编写代码,使用m个线程,M小于62,str[m] 为62进制对应的值,第1个线程打印str[1],第二个线程打印str[2],第三个线程打印str[3],第m个线程打印str[m],同时执行连续打印n次"str[1]至str[m]"的值; 第一题: import lombok.SneakyThrows; import java.util.concurrent.lo..
2020-06-24 09:42:03
345
原创 canna-cloud【二十二】spring cloud 2020.0.0-M2 gateway RelProvider must not be null!
环境:spring cloud 2020.0.0-M2 spring boot 2.3.0.release 问题描述: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'halJacksonHttpMessageConverter' defined in class path resource [org/springframework/cloud/openfeign/ha.
2020-05-30 13:20:49
463
原创 docker【一】Centos8 安装docker
#1、参考地址: 官方参考地址:https://docs.docker.com/engine/install/centos/ 参考博客:https://blog.csdn.net/benleng/article/details/103080644 https://www.runoob.com/docker/centos-docker-install.html #2、安装 yum install -y yum-utils yum-config-manager --add-repo http://mirro.
2020-05-21 10:34:04
284
原创 seata【一】seata spring cloud Load balancer does not have available server for client
1、环境说明: seata 1.2.0 spring boot 2.3.0.M3 spring cloud Hoxton.SR3 eureka作为注册中心 spring cloud alibaba seata 2.2.1.RELEASE (master源码install) 集成后,调用接口提示bug:Load balancer does not have available serv...
2020-04-28 16:02:13
2176
原创 cocos creator【一】调试预览时,引入的第三方js无效问题处理
1、找到cocos安装目录,并找到index.jade文件,如下所示: D:\software\CocosCreator_v2.3.0\resources\static\preview-templates\index.jade 2、添加希望引入的第三方js,如下: ...
2020-03-04 02:44:56
1733
原创 spring-hadoop2.5.1【一】最新hadoop、hbase、spring等版本框架支持维护
项目地址:https://github.com/euler-king/spring-hadoop.git NOTICE: start upgrade by euler king to support newest hadoop hbase and others version. 维护说明: 代码来源:fork封版后的代码,可以查看提交记录 修改计划:个人维护,仅支持最新版,不维护旧版。 ...
2020-01-20 18:18:51
349
1
原创 大数据【四】ERROR: org.apache.hadoop.hbase.PleaseHoldException: Master is initializing
hbase shell执行脚本时,报错:ERROR: org.apache.hadoop.hbase.PleaseHoldException: Master is initializing zookeeper集群配置出错,可以先配置一个节点,后续再添加其它节点: 比如修改成如下配置: <property> <name>h...
2020-01-20 11:45:58
510
原创 大数据【三】hbase2.2.2集群部署
cd /data/soft tar xzvf hbase-2.2.2-bin.tar.gz mv hbase-2.2.2 /data/app/ cd /data/app/hbase-2.2.2/ echo "export JAVA_HOME=/data/app/jdk-13.0.1" >> conf/hbase-env.sh echo "export HBASE_MANAGES_Z...
2020-01-20 11:40:36
594
原创 大数据【一】hadoop3.2.1集群部署
环境说明: 操作系统:centos8 jdk:13 hadoop:3.2.1 以下命令可以一键执行: 1、系统配置 echo "192.168.1.154 hadoop1" >> /etc/hosts echo "192.168.1.155 hadoop2" >> /etc/hosts echo "192.168.1.156 hadoop3" >&...
2020-01-14 15:55:36
410
原创 系统命令【二】ssh授信配置
1、服务器说明: xxx.xxx.xxx.154 xxx.xxx.xxx.155 xxx.xxx.xxx.156 2、生成公钥和私钥 xxx.xxx.xxx.154执行: ssh-keygen -t rsa cd ~/.ssh mv id_rsa.pub id_rsa_154.pub scp id_rsa_154.pub root@xxx.xxx.xxx.155:/root/.s...
2020-01-14 14:36:41
800
原创 canna-cloud【二十一】elasticsearch 7.5.1集群部署
1、环境配置 vi /etc/security/limits.conf 新增内容如下: * hard nofile 65536 * soft nproc 65536 * hard nproc 65536 * soft memlock unlimited * hard memlock unlimited vi /etc/sysctl.conf 新增内容如下: vm.max_map_count=6...
2020-01-10 23:45:59
341
原创 canna-cloud【二十】spring-boot data elasticsearch 7.5.1
环境说明: spring boot:2.2.2.RELEASE elasticsearch:7.5.1 1、maven配置: <properties> <elasticsearch.version>7.5.1</elasticsearch.version> </properties> <...
2020-01-10 18:57:03
1025
4
原创 canna-cloud【十九】spring-boot-admin-starter-server二次封装,自定义启动
1、maven依赖添加 <dependencies> <dependency> <groupId>de.codecentric</groupId> <artifactId>spring-boot-admin-starter-server</artifactId>...
2020-01-09 18:06:02
492
原创 canna-cloud【十八】微服务复杂数据关联查询解决方案:CQRS(命令查询职责分离)+DDD(领域驱动模型)
1、前言 使用微服务时,难免会涉及到不同服务之间跨库的数据关联,对于简单的数据关联可以在业务代码中进行关联;但是对复杂的条件关联查询如何处理,这是一个复杂的问题。 2、以下为微服务中复杂数据关联的一种解决方式 CQRS:Command Query Responsibility Segregation,命令查询职责分离 DDD:Domain-Driven Design 领域驱动设计 通过C...
2020-01-09 18:01:10
1818
原创 解决方案【二】网络安全解决方案
解决方案理念: 1、隔离不同用途的网络:生产网、办公网、外网服务网、内网子网等。当网络出现问题时控制问题传播与扩散。 2、生产网物理隔离 3、办公网单向隔离 4、mac地址绑定授信联网 ...
2020-01-09 17:39:35
1305
原创 canna-cloud【十七】微服务架构
设计思路: 1、简化代码调用链路,自上而下调用 2、避免代码循环引用 代码架构: server:对外提供接口服务 gateway:对外提供服务 consumer:服务消费层,调用producer提供的服务接口 task:分布式任务工程 producer:对内提供服务,提供给consumer使用 service:单服务内业务处理,与数据层对接 mapper:数据库操作接口 ...
2020-01-09 17:25:24
294
原创 canna-cloud【十六】Selenium+browsermob渲染网页爬虫
1、maven依赖引入: <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version>3.141.59&...
2020-01-09 13:13:19
384
原创 solr入门【二】solr8.4.0 集群部署
1、zookeeper集群安装: 参考:https://blog.csdn.net/jiangxuexuanshuang/article/details/103799968 2、配置系统信息 echo "* soft nofile 65536" >> /etc/security/limits.conf echo "* ...
2020-01-02 11:06:04
1145
原创 Centos7软件安装系列【二十四】安装zookeeper集群
版本:3.5.6 安装包:apache-zookeeper-3.5.6-bin.tar.gz 下载地址:http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.5.6/apache-zookeeper-3.5.6-bin.tar.gz 一、单机版安装 cd /data/soft tar xzvf apache-zookeeper-...
2020-01-02 10:24:36
335
原创 solr入门【一】solr8.3.0 solr create -c product报错处理
solr create -c product 提示以下问题: 系统找不到指定的批处理标签 - parse_create_args 修改成:solr create_core-c product 查看命令发现参数已修改
2019-11-23 21:35:09
620
原创 canna-cloud【十五】Spring Security 自定义异常返回结果,前后端分离,异常拦截
1、UserNotFoundExceptions未抛出 @Bean public DaoAuthenticationProvider daoAuthenticationProvider() { DaoAuthenticationProvider daoAuthenticationProvider = new DaoAuthenticationProvider(); ...
2019-11-18 16:11:49
381
原创 canna-cloud【十四】微服务多语言数据库设计
/*==============================================================*/ /* Table: canna_base_lang */ /*=========================================================...
2019-07-25 14:15:15
273
原创 windows安装postgresql解压版
下载地址:https://www.enterprisedb.com/download-postgresql-binaries 安装命令 1、解压 2、cd psql 3、mkdir data 4、初始化数据库:bin/initdb.exe --no-locale -D data/ -U postgres 5、启动:bin/pg_ctl -D data/ -l logfile star...
2019-07-21 23:15:17
1845
原创 Centos7软件安装系列【二十三】安装snipe-it
wget https://github.com/snipe/snipe-it/archive/v4.7.5.tar.gz tar xzvf v4.7.5.tar.gz cd snipe-it-4.7.5/ curl -sS https://getcomposer.org/installer | php php composer.phar install --no-dev --prefer-so...
2019-07-09 08:59:35
2238
原创 Centos7软件安装系列【二十二】安装php7.3.7
yum install epel-release -y yum update yum -y install wget vim pcre pcre-devel openssl openssl-devel libicu-devel gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-d...
2019-07-08 12:01:34
524
原创 系统安装【三】vSphere系统复制
#1、进入命令行系统 #2、创建镜像目录 mkdir -p /vmfs/volumes/Datastore3/192.168.1.163-temp #3、复制镜像 cp /vmfs/volumes/datastore1/centos7-mini-src/centos7-mini-src.vmx /vmfs/volumes/Datastore3/192.168.1.163-temp/...
2019-07-08 09:37:24
218
原创 canna-cloud【十三】spring cloud gateway ServerCodecConfigurer 问题
问题描述: Parameter 0 of method modifyRequestBodyGatewayFilterFactory in org.springframework.cloud.gateway.config.GatewayAutoConfiguration required a bean of type 'org.springframework.http.codec.ServerCo...
2019-06-20 10:15:23
3895
9
原创 canna-cloud【十二】spring cloud config center fresh配置
spring cloud版本:Greenwich.RELEASE 一、configserver,依赖引入 <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-config-server</art...
2019-05-16 09:42:58
296
原创 源码看JAVA【四十三】ConcurrentLinkedQueue
ConcurrentLinkedQueue通过使用CAS原子操作保证其相应功能的安全性 1、定义原子变量与原子操作,CAS来判断其操作的准确性 /** * Throws NullPointerException if argument is null. * * @param v the element */ private static vo...
2019-05-09 14:22:47
155
原创 源码看JAVA【四十二】Stack
Stack继承Vector,堆栈添加了pop与push操作,并添加synchronized修饰,保证其安全性 1、push/pop;插入与取出 /** * Pushes an item onto the top of this stack. This has exactly * the same effect as: * <blockquote>&l...
2019-05-09 13:52:55
288
原创 源码看JAVA【四十一】Vector
Vector:线程安全List 1、变量定义,底层依然使用数组保存数据 /** * The array buffer into which the components of the vector are * stored. The capacity of the vector is the length of this array buffer, * and ...
2019-05-09 13:50:04
163
原创 源码看JAVA【四十】ArrayDeque
ArrayDeque继承了AbstractCollection的基本集合实现,同时实现了Deque的接口 1、变量定义 保存在数组对象中,定义了头部位置和尾部位置,最小的数据大小为8 /** * The array in which the elements of the deque are stored. * The capacity of the dequ...
2019-05-09 12:18:59
178
原创 源码看JAVA【三十九】Deque
Deque是双向队列,包含Queue的全部功能,同时添加了双向队列的特有实现 1、在第一个元素前添加元素:添加失败抛出异常 void addFirst(E e); 2、在最后的位置添加元素:添加失败抛出异常 void addLast(E e); 3、调用addFirst方法,添加成功返回true,否则抛出异常 boolean offerFirst(E e); 4、调用addLast...
2019-05-06 17:40:53
253
原创 源码看JAVA【三十八】LinkedBlockingQueue
LinkedBlockingQueue:链表阻塞队列 1、定义单向列表 static class Node<E> { E item; /** * One of: * - the real successor Node * - this Node, meaning the successor ...
2019-04-28 00:42:14
213
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅