---
title: "暂时记录-es"
author: "xiaohu7924"
date: "2016-12-07T20:06:47Z"
tags: []
categories: ["互联网"]
slug: "es"
draft: false
lastmod: "2016-12-09T16:57:34Z"
id: 2343584
url: "https://xiaohu7978.iteye.com/blog/2343584"
---

[http://www.cnblogs.com/xing901022/p/4704319.html](http://www.cnblogs.com/xing901022/p/4704319.html)

[http://wiki.jikexueyuan.com/project/elasticsearch-definitive-guide-cn/310\_Geopoints/00\_Intro.html](http://wiki.jikexueyuan.com/project/elasticsearch-definitive-guide-cn/310_Geopoints/00_Intro.html)

[http://kibana.logstash.es/content/kibana/v5/production.html](http://kibana.logstash.es/content/kibana/v5/production.html)

[http://www.infoq.com/cn/articles/review-the-logstash-book/](http://www.infoq.com/cn/articles/review-the-logstash-book/)

[http://es.xiaoleilu.com/index.html](http://es.xiaoleilu.com/index.html)

[http://www.tuicool.com/articles/qYvUfuz](http://www.tuicool.com/articles/qYvUfuz) 5.0优化

[http://blog.csdn.net/jiuqiyuliang/article/details/51240800](http://blog.csdn.net/jiuqiyuliang/article/details/51240800) 安装介绍  
[http://rockelixir.iteye.com/blog/1883373](http://rockelixir.iteye.com/blog/1883373) 配置

http://www.cnblogs.com/xing901022/p/6030296.html 5.0安装

[http://blog.csdn.net/ming\_311/article/details/50619859](http://blog.csdn.net/ming_311/article/details/50619859) kibana介绍

logstash+Kibana+ElasticSearch

 

./bin/elasticsearch -Epath.conf=/opt/zh\_es/zhaohu\_appes0/config/ -d -p /opt/zh\_es/zhaohu\_appes0/elasticsearch\_0.pid

Linux下虚拟内存设置：  
查看  
sysctl -a|grep vm.max\_map\_count

 # sysctl -w vm.max\_map\_count=262144  
永久生效：

 update the vm.max\_map\_count setting in /etc/sysctl.conf.  
  # echo "vm.max\_map\_count=262144" &gt;&gt; /etc/sysctl.conf && sysctl -p

./bin/elasticsearch -d -p pid  
kill \`cat pid\`

API:  
查看状态：  
[http://99.12.90.6:9200/\_cluster/health?pretty](http://99.12.90.6:9200/_cluster/health?pretty)

关闭集群：  
curl -XPOST [http://99.12.90.6:9200/\_cluster/nodes/\_shutdown](http://99.12.90.6:9200/_cluster/nodes/_shutdown)  
 关闭单一节点 xx标示  
curl -XPOST [http://99.12.90.6:9200/\_cluster/nodes/xxxxx/\_shutdown](http://99.12.90.6:9200/_cluster/nodes/xxxxx/_shutdown)  
  查看节点标示  
curl -XGET [http://99.12.90.6:9200/\_cluster/state/nodes/](http://99.12.90.6:9200/_cluster/state/nodes/)

查询  
[http://99.12.90.6:9200/books/\_search?pretty&q=title:elatsticsearch](http://99.12.90.6:9200/books/_search?pretty&q=title%3Aelatsticsearch)

 

 

ES的5.0版本听说在性能上大大优化**，**于是老大说准备换5.0版本。由于在技术群看到很多人都说ES 5.0 安装有问题**，**在这里贴出自己在使用最新版5.0遇到的问题和解决方法

1、Elasticsearch 的插件： 现在marvel等插件都包含在x-pack的插件中**，**可通过以下命令安装：

 

```
./bin/elasticsearch-plugin install x-pack
```

 

注意：安装了x-pack后**，**es会包含security模块**，**因此不能再直接访问**，**而是需要通过用户名和密码才能访问**，**这点很不一样**，**详细未曾深究**，**已经将x-pack去掉

2、安装出现的错误一： []()**max** file descriptors \[4096] []()**for** elasticsearch process likely too low**,** increase to at least \[65536]

 解决方法：切换到root用户**，**进入vi /etc/security/limits.conf  **，**增加配置（保存后注意切回work用户的时候才能生效**，**sudo 修改的不能立即生效）：

 

```
work soft nofile 819200
work hard nofile 819200
```

 

3、安装错误二： **max** []()**number** []()**of** []()**threads** \[[]()**1024**] **for** []()**user** \[work] likely too low**,** increase to at least \[2048]

 

解决方法：进入limits.d下的配置文件：vi /etc/security/limits.d/90-nproc.conf **，**修改配置如下：

 

```
*          soft    nproc     1024
修改为：
*          soft    nproc     2048
```

4、安装错误三： **max** virtual memory areas vm.**max**\_map\_count \[65530] likely too low**,** increase to at least \[262144]

 

 

解决方法：修改sysctl文件：vi /etc/sysctl.conf **，**增加下面配置项：

 

```
增加改行配置：vm.max_map_count=655360
保存退出后，执行：
sysctl -p
```

4、另外再配置ES的时候**，**threadpool.bulk.queue\_size 已经变成了thread\_pool.bulk.queue\_size **，**ES\_HEAP\_SIZE**，**ES\_**MAX**\_MEM等配置都变为ES\_JAVA\_OPTS这一配置项**，**如限制内存最大最小为1G：

 

 

```
export ES_JAVA_OPTS="-Xms1g -Xmx1g"
```