- 博客(96)
- 收藏
- 关注
原创 java 8 新特性 computeIfAbsent
// 方法定义default V computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction) { ...}// java8之前。从map中根据key获取value操作可能会有下面的操作Object key = map.get("key");if (key == null) { key = new Object(); map.put("key", key);}// jav
2021-07-05 15:58:51
359
原创 springboot使用拦截器,feign拦截器
总体来说就是 两步1. 编写拦截器2. 注册拦截器代码1 编写一个 拦截器public class LogInterceptor implements HandlerInterceptor { @Override public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception {
2021-07-01 14:28:40
1972
原创 golang相关github
es 相关1. hub.docker.com2. github.com/olivere/elastic3. github.com/olivere/elastic/wiki4. java-rest-high-level5. 官方elastic-api6. java-ES查询示例7. IK分词器8. Elasticsearch原理19. Elasticsearch原理210. Elasticsearch原理211. elasticsearch为什么比mysql快12. es中的term
2021-03-03 13:07:55
197
原创 golang 使用 es
golang 使用 eshttps://github.com/olivere/elastic/wikihttps://github.com/olivere/elasticik分词器https://github.com/medcl/elasticsearch-analysis-ik安装参照词表找对应的 ik 版本IK versionES versionmaster7.x -> master6.x6.x5.x5.x1.10.62.4.6
2021-03-03 13:06:23
1871
原创 golang 使用 es 遇到的问题
golang 使用 es 遇到的问题1.使用Golang客户端连接docker中es报错:no active connection found: no Elasticsearch node available使用的第三方库:"github.com/olivere/elastic"节点的 es ip 必须使用 本机ip,不能使用 127.0.0.1 或者 localhost ,其他地方可以不用指定,否则必须显性的指示操作的typees7 type 只能为 _doc 可以省略 3. do
2021-03-03 13:05:35
627
原创 elasticsearch 简介
elasticsearch 简介简介Elasticsearch(ES)是一个基于Lucene构建的开源、分布式、RESTful接口的全文搜索引擎。Elasticsearch还是一个分布式文档数据库,其中每个字段均可被索引,而且每个字段的数据均可被搜索,ES能够横向扩展至数以百计的服务器存储以及处理PB级的数据。可以在极短的时间内存储、搜索和分析大量的数据。Elasticsearch基本概念Near Realtime(NRT) 几乎实时Elasticsearch是一个几乎实时的搜索平台。
2021-03-03 13:04:58
3771
原创 golang 携程 errgrou使用
Go团队在实验仓库中添加了一个名为sync.errgroup的新软件包。 sync.ErrGroup再sync.WaitGroup功能的基础上,增加了错误传递,以及在发生不可恢复的错误时取消整个goroutine集合,或者等待超时Go()方法不仅允许你传一个匿名的函数,而且还能捕获错误信息,你只要像这样返回一个错误 return err,这使开发者使用goroutines时开发效率显著提高工具方法封装示例// Copyright 2016 The Go Authors. All rights re.
2020-12-01 14:47:37
361
原创 springboot2.x 使用 restHighLevelClient 整合Es7
项目git地址初始化 springboot 项目编写application.yml 配置文件server: port: 8111spring: # mysql 配置 datasource: url: jdbc:mysql://localhost:3306/test?useSSL=false&serverTimezone=UTC&characterEncoding=utf8 username: root password: 123456
2020-12-01 14:44:39
1810
原创 elasticsearch学习相关博客整理(golang方向)
1. hub.docker.com2. github.com/olivere/elastic3. github.com/olivere/elastic/wiki4. java-rest-high-level5. 官方elastic-api6. java-ES查询示例7. IK分词器8. Elasticsearch原理19. Elasticsearch原理210. Elasticsearch原理211. elasticsearch为什么比mysql快12. es中的term和match.
2020-12-01 14:28:36
180
原创 golang 整合es6, es7, xorm
1. 新建项目项目git代码2.初始化go.mod3.编写配置package configimport ( "fmt" _ "github.com/go-sql-driver/mysql" xorm "github.com/go-xorm/xorm" elastic6 "github.com/olivere/elastic" elastic7 "github.com/olivere/elastic/v7" "log")var GlobalConfig *Configtype
2020-12-01 14:26:43
794
原创 golang 使用 es 遇到的问题
golang 使用 es 遇到的问题1.使用Golang客户端连接docker中es报错:no active connection found: no Elasticsearch node available使用的第三方库:"github.com/olivere/elastic"节点的 es ip 必须使用 本机ip,不能使用 127.0.0.1 或者 localhost ,其他地方可以不用指定,否则必须显性的指示操作的typees7 type 只能为 _doc 可以省略 3. do
2020-12-01 14:13:31
641
原创 golang 使用 elasticsearch ik 分词器
golang 使用 elasticsearchhttps://github.com/olivere/elastic/wikihttps://github.com/olivere/elasticik分词器https://github.com/medcl/elasticsearch-analysis-ik安装参照词表找对应的 ik 版本IK versionES versionmaster7.x -> master6.x6.x5.x5.x1.10
2020-12-01 14:09:02
2033
2
原创 docker 安装kibana
docker 安装kibana1.下载镜像docker pull kibana:6.6.2docker pull kibana:7.4.12.编辑配置文件// kibana.yml配置文件放在宿主机/data/elk/目录下,内容如下:// Default Kibana configuration for docker target// elasticsearch.hosts 使用docker是要配置本机的ip 不能为 127.0.0.1 或 localhost// 注意:elastic
2020-12-01 14:05:02
149
原创 docker 安装 elasticsearch
docker 安装 elasticsearch1. 创建映射路径mkdir -p /data/apps/elasticsearch/configmkdir -p /data/apps/elasticsearch/data需要的话设置 /data 目录权限 chmod 7772.写入配置文件// http.host: 后边必须有空格否则会,启动容器会报错// Exception in thread "main" SettingsException[Failed to load setting
2020-12-01 14:03:53
129
原创 MAC查看端口占用情况
命令(port替换成端口号,比如6379)可以查看该端口被什么程序占用,并显示PID,方便KILL lsof -i tcp:port lsof -i :port
2020-12-01 13:58:55
1558
原创 IDEA 的Http工具小结
IDEA 的Http工具小结通过这个工具我们可以完成绝大部分http请求,是一个不错的post-man替代工具,接下来详细讲讲它如何简化你的操作1.请求示例描述: 所有HTTP请求需要在后缀为.http的文件中进行,新建一个test.http文件。基本格式为:请求类型(如:GET, POST,PUT) + 请求地址(http://www.baidu.com)请求头...请...
2020-04-15 15:39:10
2422
原创 16. springcloud 网关 post 重试问题,Ribbon的饥饿加载(eager-load)模式
背景post 重试,如果项目中接口没有做幂等,就会产生脏数据!ribbon: ConnectTimeout: 2000 # 请求连接的超时时间: 1s ReadTimeout: 2000 # 请求处理的超时时间: 1s OkToRetryOnAllOperations: false # 是否对所有操作重试 MaxAutoRet...
2020-04-14 14:52:55
846
原创 1. redis 相关面试题
1、为什么要用缓存?主要有两个用途:高性能、高并发。高性能对于一些需要复杂操作耗时查出来的结果,且确定后面基本不会变化,但是有很多读请求,那么直接将查询出来的结果放在缓存中,后面直接读缓存就好。高并发mysql 单机支撑到2000并发就开始扛不住了。假如系统高峰期一秒钟过来的请求有 1万,那一个 mysql 单机绝对会死掉。你这个时候就只能上缓存。缓存功能简单,说白了就是...
2020-04-14 09:25:37
179
原创 springboot 学习的相关网站地址
springboot 学习的相关网站地址http://www.ityouknow.com/spring-boot.htmlhttps://www.zhihu.com/question/53729800http://tengj.top/2017/04/24/springboot0/https://segmentfault.com/a/1190000008539153Spri...
2020-04-14 09:16:41
211
原创 15. 微服务 切面调用失败 解决方案
调用方式 ((EmployeeService) AopContext.currentProxy()).update(emp);使用 切面调用方法时,报错Cannot find current proxy: Set 'exposeProxy' property on Advised to 'true' to make it available.解决方法(启动类上)@...
2020-04-14 09:13:52
622
原创 vue-cli 安装太慢解决方案,以及mac 初始化项目报错 EACCES: permission denied
vue-cli 安装太慢解决方案npm config set registry https://registry.npm.taobao.org安装 vue-clinpm install -g @vue/cli初始化项目vue init webpack zy-cms-webEACCES: permission denied, unlink '/Users/xian...
2020-04-14 09:12:23
775
原创 6.linux 安装 mongo
1.配置MongoDB的yum源vim /etc/yum.repos.d/mongodb-org-4.0.repo#增加以下内容[mongodb-org-4.0]name=MongoDB Repositorybaseurl=https://repo.mongodb.org/yum/redhat/7Server/mongodb-org/4.0/x86_64/gpgcheck=1...
2020-04-10 11:55:56
153
原创 springboot 整合 ftp 简单流程
1、导入pom 文件 <dependency> <groupId>commons-net</groupId> <artifactId>commons-net</artifactId> <version>3.3</versio...
2020-01-09 18:30:55
992
原创 Java 读取 Excel 文件内容, 根据 pdf 模板动态生成对应的 pdf 文件
1. 下载 adobe acrobathttps://www.cr173.com/soft/11135.html2. 编辑 pdf 模板1用 acrobat 打开 pdf编辑模板添加表单元素保存模板 “moban-1.pdf”3. Java 动态生成 pdfpom 依赖 <!-- pdf 依赖--> <...
2020-01-05 21:12:32
1154
原创 7.linux 安装 nginx
1.yum install gcc-c++2.yum install yum install -y pcre pcre-devel3.yum install -y openssl4.yum install -y zlib zlib-devel5.cd /opt6.tar -zxvf nginx-1.14.1.tar.gz -C /usr/local7.cd /usr/loc...
2019-12-26 16:57:39
120
原创 5.Linux 安装 es
1.上传安装包cd /optrz 或 filezilla2.解压tar -zxvf elasticsearch-6.6.1.tar.gz -C /usr/local/3.cd /usr/local/cd elasticsearch-6.6.1/cd configvim elasticsearch.yml修改config/elasticsearch.yml文件...
2019-12-26 16:36:53
139
原创 4.Linux 安装 mysql,及配置
1.下载mysql源安装包2.安装mysql源yum localinstall mysql57-community-release-el7-8.noarch.rpm3.检查mysql源是否安装成功yum repolist enabled | grep "mysql.*-community.*"4.安装mysqlyum install -y mysql-server5.启...
2019-12-26 16:32:39
120
原创 3.linux 安装 gitlab
1.安装sshsudo yum install -y curl policycoreutils-pythonopenssh-server2.将SSH服务设置成开机自启动sudo systemctl enable sshd3.启动SSH服务sudo systemctl start sshd4.添加http服务到firewalld,pemmanent表示永久生效,若不加--pe...
2019-12-26 16:26:09
176
原创 2.Linux 安装 jdk
1. 查看系统是否安装过javayum list installed | grep java2.如果有旧版本的java,可以用如下方法卸载javayum -y remove java-1.8.0-openjdk*3.查看java软件包列表yum -y list java*4.下载安装java1.8的所有软件包,中途需要输入y来确认下载yum install jav...
2019-12-26 16:21:54
149
原创 1.安装Linux 系统,及环境配置
linux系统下centos用的比较多。centos7的安装也比较简单,本经验给咗嚛您截图演示如何安装centos7.6系统方法/步骤1设置光盘系统或刻录到U盘里面,选择安装系统。第二项是测试光盘并启动2按enter回车进行测试。可以按esc跳过3然后是选择安装时候的语言。(是安装界面的,不是系统里面的)4设置安装磁盘接着镜像键盘和时区等设...
2019-12-26 16:18:43
542
原创 1. RabbitMQ 介绍 ,以及和springboot 的整合
1.概述RabbitMQ有几个重要的概念:虚拟主机,交换机,队列和绑定 虚拟主机:一个虚拟主机持有一组交换机、队列和绑定,我们可以从虚拟主机层面的颗粒度进行权限控制 交换机:Exchange用于转发消息,它并不存储消息,如果没有Queue队列绑定到Exchange,它会直接丢弃掉生产者发来的数据。 交换机还有个关联的重要概念:路由键,消息转发到哪个队列根据路由键决定 ...
2019-12-05 14:07:57
232
原创 Spring-Profile 根据配置环境的 不同,实例化不同的实例
Profile为不同环境下使用不同配置提供了支持(开发环境下的配置和生产环境下的配置肯定是不同的,例如,数据库的配置)。通过设定Environment的ActiveProfiles来设定当前context需要使用的配置环境。在开发中使用@Profile注解类或者方法,达到在不同环境下选择实例化不同的Bean;示例代码public class DynamicDataSourceConf...
2019-12-05 10:04:20
401
原创 springboot 整合 Mail ,支持发送 流附件功能
1.首先引入 mail 依赖,可以使用 freemarker 模板,本教程没有使用,用到了 lombok <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-start...
2019-12-05 09:46:04
1319
2
原创 10、带返回值的 多线程实现 Callable
package com.example.study01.common.LockDemo;import java.util.concurrent.Callable;import java.util.concurrent.FutureTask;/** * 多线程的方法 :Runnable */class MyThread implements Runnable{ @Over...
2019-11-28 10:09:56
122
原创 springboot 整合 Mail 邮件功能
application 配置文件修改 mail: host: smtp.geotmt.com username: y***@geotmt.com # 邮箱和密码自行配置 password: y***66 default-encoding: UTF-8 properties: mail: smtp: ...
2019-11-28 10:09:46
951
原创 java 下载文件
下载的工具类完成package com.geotmt.billingcenter.common.utils;import javax.servlet.http.HttpServletResponse;import java.io.*;import java.net.MalformedURLException;import java.net.URL;import java.n...
2019-11-27 10:22:55
187
原创 SpringBoot 导出 Excel
添加 maven 依赖 <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>1....
2019-11-27 10:22:44
148
原创 java FIle 常用工具方法类
文件工具类package com.geotmt.billingcenter.common.utils;import org.slf4j.Logger;import org.slf4j.LoggerFactory;import java.io.File;/** * @Description 文件操作工具类 * @Author yanghanwei * @Ma...
2019-11-27 10:22:22
159
原创 java 实用 jdbc 链接 hive
此种方式 可以链接 zookeeper 集群hivepackage com.geotmt.billingcenter.common.utils;import org.slf4j.Logger;import org.slf4j.LoggerFactory;import org.springframework.beans.factory.InitializingBean;imp...
2019-11-27 10:22:11
262
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人