elasticsearch 学习笔记

来源:互联网 发布:mac .m2 文件夹在哪里 编辑:程序博客网 时间:2024/06/05 21:01

elasticsearch是一个性能强大的全文搜索引擎,之所以强大是因为其基于Lucene,而Lucene又是基于java的。所以elasticsearch也需要jvm的支持。

安装

jvm的安装这里不做介绍。
elasticsearch提供了众多的安装方法,我们选择源码安装,这样可以方便的制定配置文件。
官网:https://www.elastic.co/downloads/elasticsearch
截至发文,最新版本5.5.2

其实解压后就已经可以执行了,这里记录一下,elasticsearch的常遇到的错误。

1.

/LICENSE.txt/plugin-descriptor.properties: Not a directory

类似的错误因为plugins下存放了插件,而插件的路径有问题,我们可以先删除plugins下所有的文件,把它置为一个空文件夹。

2.

can not run elasticsearch as root

es不能以root权限运行,因为他又运行脚本的能力,为了安全起见,不能够使用root启动。但是这个我在官网上却没看到安装说明,官网的安装真的太简单。。

创建一个新的用户,并把es文件夹chown。

配置外网访问./config/elasticsearhc.yml

# Set the bind address to a specific IP (IPv4 or IPv6):#network.host: 0.0.0.0

去掉network前的注释,注意冒号后面有个空格。
再次重启可能遇到下面的错误。

3.

max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]

修改 vim /etc/security/limits.conf

* soft nofile 65536* hard nofile 65536

如果更改后还是不行,reboot下

4.

max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

虚拟机个数太少,
在root权限下执行

sysctl -w vm.max_map_count=655360

检查一下

sysctl -a | grep "vm.max_map_count"

上面的方法重启失效。
vi /etc/sysctl.conf

vm.max_map_count=655360

sysctl -p 重新加载

重新启动完成安装。