ElasticSearch5.x 安装
1.java8,安装 ES5.x 版本必须要有 java 8的环境;
2.下载 ElasticSearch5.x,使用以下命令进行下载。可以去官网进行下载,本篇文章安装的是5.6.3版本;
curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.3.tar.gz
tar -xvf elasticsearch-5.6.3.tar.gz
cd elasticsearch-5.6.3/bin
./elasticsearch
安装成功后会出现输入在浏览器输入localhost:9200,出现以下信息说明安装成功。
现在有一个问题,现在在本地环境下可以对 ES 进行访问,但是我们怎样从其它机器来访问它了,修改两个地方:
1. 修改config/elasticsearch.yml, network.host修改为0.0.0.0
2. 修改/etc/sysconfig/iptables,开启9200端口,重启防火墙(service iptables restart)
-A INPUT -m state --state NEW -m tcp -p tcp --dport 9200 -j ACCEPT
这样,你就可以使用ip-address:9200进行访问了,ip-address指的是你电脑的 ip 地址。
安装过程遇见问题
1.max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
root 用户编辑 vim /etc/security/limits.conf 文件, 添加以下内容
* hard nofile 65536
2.max number of threads [1024] for user [henry] is too low, increase to at least [2048]
root 用户编辑 vim /etc/security/limits.d/90-nproc.conf 修改以下内容
* soft nproc 2048
3.max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
root 用户编辑 vim /etc/sysctl.conf 添加以下内容
vm.max_map_count=262144
并执行命令 sysctl -p
4.system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
henry 用户编辑 vim config/elasticsearch.yml 文件, 添加以下内容
bootstrap.system_call_filter: false
可能需要重启服务器, 然后重启 ES 服务. 在外部通过浏览器访问 http://ip-address:9200, 如果看到如上图图所示的输出, 那么说明你配置成功啦!