版本
- jdk1.8
- elasticsearch 5.6.16
下载
安装
shell> wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.16.tar.gz //下载
shell> tar zxcf elasticsearch-5.6.16.tar.gz //解压
shell> cd elasticsearch-5.6.16
shell> ./bin/elasticsearch //启动(5.0.0之后由于安全升级,所以不可以root启动,详细在下方)
安装过程出现的问题
- JVM内存问题(由于启动默认内存为2G,可以将内存变小,根据自身情况而定)
shell> cd config
shell> vi jvm.option
#-Xms2g
#-Xmx2g
-Xms512m
-Xmx512m
- 权限执行问题(由于es5.0.0以后不允许root操作)
image.png
shell> groupadd esearch
shell> useradd esearch -g esearch -p esearch
shell> chown -R esearch:esearch /home/esearch
shell> chmod -R 770 /home/esearch
shell> chown -R esearch /usr/local/elasticsearch-5.6.16
设置es远程连接
shell> vi ./config/elasticsearch.yml
network.host:0.0.0.0 //设置ip
设置远程连接出现的问题(可能出现其他错误,后续补充 )
- 问题1: max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]
解决方案:
shell> vi /etc/security/limits.conf //编辑该页面并追加如下内容
soft nofile 65536
hard nofile 131072
soft nproc 2048
hard nproc 4096
- 问题2: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
解决方案:
shell> vi /etc/sysctl.conf //编辑该页面,添加如下配置
vm.max_map_count=655360
设置es启动时后台运行
运行命令 ./bin/elasticsearch 变更为 ./bin/elasticsearch -d