linux elasticsearch-5.1.1的安装

(一)下载elasticsearch linux安装包

https://www.elastic.co/downloads/past-releases,然后解压,然后要有对应的java8,即必须先安装java,可以参照:https://www.cnblogs.com/chenmz1995/p/10197859.html

(二)创建用户,es需用非root用户启动。

useradd elasticsearch

passwd elasticsearch

su elasticsearch

(三)启动es

在bin目录下,./elasticsearch即可。

启动可能遇到的问题:

1. main ERROR Could not register mbeans java.security.AccessControlException: access denied ("javax.management.MBeanTrustPermission" "register")

解决办法:切换到root用户

chown -R elasticsearch elasticsearch-5.1.1

把安装目录的读权限给当前用户。elasticsearch表示用户。

 2.

ERROR: bootstrap checks failed
max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

解决办法:

切换到root用户:vi /etc/security/limits.conf

添加如下内容:

* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096

 这个需要切换到root然后切换到es用户才能生效,就是用户需要重新登入 。

3.

ERROR: bootstrap checks failed
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

 解决办法:
切换到root用户

vi /etc/sysctl.conf

添加:

vm.max_map_count=655360

然后:

sysctl -p

 

(四)开启某个端口号

然后找到对应的elasticsearch.yml,在安装目录对应的config目录下,添加:

network.host: 192.168.111.130          #修改一下ES的监听地址,改为当前主机的ip,这样别的机器也可以访问 
http.port: 9200               #端口号,默认就好

 

然后切换到root用户,开启相应的端口:

firewall-cmd --add-port=9200/tcp --permanent
firewall-cmd --reload

然后相对应的9300端口也要打开,9200开了浏览器访问,要想通过Java api操作还得开启9300端口。

 

 然后访问对应的,http://192.168.111.130:9200/

看到如下的,就表示成功了:

 

posted @ 2018-12-29 21:04  护花使者  Views(494)  Comments(0Edit  收藏  举报