摘要: //冒泡排序 public static void sort1(int[] arr){ for (int i=0;iarr[j]){ int tmp = arr[i]; arr[i] = arr[j]; arr[j] = tmp; } } } }... 阅读全文
posted @ 2019-07-17 18:12 努力挣扎的小兵 阅读(518) 评论(0) 推荐(0) 编辑
摘要: //需要时加锁,双重校验 class CustomSingleton{ private static CustomSingleton customSingleton = null; private CustomSingleton(){}; public static CustomSingleton getCustomSingleton(){ if(custom... 阅读全文
posted @ 2019-07-17 17:11 努力挣扎的小兵 阅读(161) 评论(0) 推荐(0) 编辑
摘要: public class TestCglibProxy { public static void main(String[] args) { UserService userService = new UserServiceImpl(); CglibProxy cglibProxy = new CglibProxy(); Enha... 阅读全文
posted @ 2019-07-17 17:04 努力挣扎的小兵 阅读(125) 评论(0) 推荐(0) 编辑
摘要: public class TestJdkProxy { public static void main(String[] args) { UserService userService = new UserServiceImpl(); JdkProxy jdkProxy = new JdkProxy(userService); Us... 阅读全文
posted @ 2019-07-17 17:02 努力挣扎的小兵 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 回文:aba abcba 双重循环遍历字符串,外层从第一个开始找,内层循环从最后一个开始找。当外层的字符和内存循环的字符相等时则组成新的数组,判断是否是回文 阅读全文
posted @ 2019-07-17 16:34 努力挣扎的小兵 阅读(264) 评论(0) 推荐(0) 编辑
摘要: 1.注册一个新的license,每一项都要填写,每次可以使用一年,一年到期后再来注册一个新的 2.更新license (官方文档:https://www.elastic.co/guide/en/x-pack/5.6/installing-license.html)上传license文件后执行下面的命 阅读全文
posted @ 2019-07-17 12:23 努力挣扎的小兵 阅读(1604) 评论(0) 推荐(0) 编辑
摘要: 当索引一个文档的时候,文档会被存储到一个主分片中。 Elasticsearch 如何知道一个文档应该存放到哪个分片中呢?当我们创建文档时,它如何决定这个文档应当被存储在分片 1 还是分片 2 中呢?首先这肯定不会是随机的,否则将来要获取文档的时候我们就不知道从何处寻找了。实际上,这个过程是根据下面这 阅读全文
posted @ 2019-07-17 12:20 努力挣扎的小兵 阅读(1675) 评论(0) 推荐(0) 编辑
摘要: https://www.elastic.co/guide/cn/elasticsearch/guide/current/mapping.html如果有两个不同的类型,每个类型都有同名的字段,但映射不同(例如:一个是字符串一个是数字),将会出现什么情况?简单回答是,Elasticsearch 不会允许 阅读全文
posted @ 2019-07-17 12:16 努力挣扎的小兵 阅读(8717) 评论(0) 推荐(0) 编辑
摘要: 1.Cluster(集群)# 集群名称标识了你的集群,自动探查会用到它。默认值为elasticsearch# 如果你在同一个网络中运行多个集群,那就要确保你的集群名称是独一无二的。## cluster.name: my-application 2.Node(节点)# 节点名称会在启动的时候自动生成, 阅读全文
posted @ 2019-07-17 12:16 努力挣扎的小兵 阅读(644) 评论(0) 推荐(0) 编辑
摘要: discovery.zen.minimum_master_nodes: 2这个参数决定了要选举一个Master需要多少个主节点(最少候选主节点数)。默认值是1。官方给出的建议是 N/2 + 1,N是集群中主节点的数量,例如一个有3个主节点的集群,minimum_master_nodes 应该被设置成 阅读全文
posted @ 2019-07-17 12:15 努力挣扎的小兵 阅读(378) 评论(0) 推荐(0) 编辑
摘要: https://www.elastic.co/guide/cn/elasticsearch/guide/current/dynamic-mapping.html#dynamic-mapping当 Elasticsearch 遇到文档中以前 未遇到的字段,它用 dynamic mapping 来确定字 阅读全文
posted @ 2019-07-17 12:14 努力挣扎的小兵 阅读(1036) 评论(0) 推荐(0) 编辑
摘要: 查看所有索引的配置信息GET /_settings 查看某个索引的配置信息 创建索引时设置 设置索引的副本信息(分片个数不允许修改) index.mapping.total_fields.limit:索引中的最大字段数。默认值为1000。index.mapping.nested_fields.lim 阅读全文
posted @ 2019-07-17 12:12 努力挣扎的小兵 阅读(3491) 评论(0) 推荐(0) 编辑
摘要: 1. 查看ES集群健康状态 查看指定索引库的健康状态http://localhost:9200/_cluster/health/index_name?prettyhttp://localhost:9200/_cluster/health/index_name,index_name2?pretty 阅读全文
posted @ 2019-07-17 12:11 努力挣扎的小兵 阅读(21670) 评论(0) 推荐(0) 编辑
摘要: 1.单条所以插入//第一个参数:索引名;第二个参数:索引类型;第三个参数:索引ID(相同的id时修改数据,默认为随机字符串)IndexResponse indexResponse = client.prepareIndex("twitter", "json","1").setSource(json) 阅读全文
posted @ 2019-07-17 12:10 努力挣扎的小兵 阅读(2656) 评论(0) 推荐(0) 编辑
摘要: 索引别名API允许使用一个名字来作为一个索引的别名,所有API会自动将别名转换为实际的索引名称。 别名也可以映射到多个索引,别名不能与索引具有相同的名称。别名可以用来做索引迁移和多个索引的查询统一,还可以用来实现视图的功能 查看所有别名GET /_aliases 查看某个别名下的索引GET /_al 阅读全文
posted @ 2019-07-17 12:09 努力挣扎的小兵 阅读(3880) 评论(0) 推荐(0) 编辑
摘要: 使用sql插件执行如下语句的时候报错http://10.127.0.1:9200/_sql?sql=select * from test limit 1000000 错误信息:{"error":{"root_cause":[{"type":"query_phase_execution_excepti 阅读全文
posted @ 2019-07-17 11:41 努力挣扎的小兵 阅读(4542) 评论(0) 推荐(0) 编辑
摘要: 检查bootstrap.memory_lock设置是否生效 如果您看到mlockall为false,则表示mlockall请求失败。您还将在日志中看到一行"Unable to lock JVM Memory"。在Linux / Unix系统上最可能的原因是运行Elasticsearch的用户没有锁定 阅读全文
posted @ 2019-07-17 11:39 努力挣扎的小兵 阅读(2144) 评论(0) 推荐(0) 编辑
摘要: 原因:报了一大串错误,大家不必惊慌,其实只是一个警告,主要是因为你Linux版本过低造成的。 解决方案:1、重新安装新版本的Linux系统2、警告不影响使用,可以忽略 ERROR: bootstrap checks failedmax file descriptors [65535] for ela 阅读全文
posted @ 2019-07-17 11:37 努力挣扎的小兵 阅读(521) 评论(0) 推荐(0) 编辑
摘要: 编辑bin/elasticsearch 可以看到elasticsearch使用环境变量JAVA_HOME中配置的jdk:if [ -x "$JAVA_HOME/bin/java" ]; then JAVA="$JAVA_HOME/bin/java"else JAVA=`which java`fi 直 阅读全文
posted @ 2019-07-17 11:26 努力挣扎的小兵 阅读(6146) 评论(0) 推荐(0) 编辑
摘要: https://www.elastic.co/guide/cn/elasticsearch/guide/current/custom-dynamic-mapping.html如果你想在运行时增加新的字段,你可能会启用动态映射。 然而,有时候,动态映射 规则 可能不太智能。幸运的是,我们可以通过设置去 阅读全文
posted @ 2019-07-17 11:25 努力挣扎的小兵 阅读(1597) 评论(1) 推荐(0) 编辑