本篇文章主要介绍了centos7虚拟机安装elasticsearch5.0.x-安装篇,具有一定的参考价值,感兴趣的小伙伴们可以参考一下。
centos7虚拟机安装elasticsearch5.0.x-安装篇
请预先安装jdk详细步骤请参考://www.jb51.net/softjc/193398.html
创建新用户(非root用户)
elasticsearch只能用非root启动,这里我创建了一个叫seven的用户
1 2 |
|
下载elasticsearch
1 2 3 4 5 |
|
解压并运行elasticsearch
解压
1 |
|
移动到指定文件夹并重命名(方便管理)
1 |
|
修改访问elasticsearch的IP及端口
1 |
|
找到如下代码段,并取消network.host及http.port所在行的注释,修改IP及端口
1 2 3 4 5 6 7 8 9 10 11 12 |
|
直接运行bin/elasticsearch文件启动elasticsearch
1 2 |
|
启动时发现报错了。。。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
|
于是我临时提高了vm.max_map_count的大小
*此操作需要root权限
1 |
|
查看修改结果
1 2 |
|
或者永久性修改
1 2 3 4 5 6 7 8 9 10 11 12 |
|
上面还有一个错误是关于jvm内存分配的问题heap size [268435456] not equal to maximum heap size [2147483648],需要修改的jvm配置
1 |
|
将-Xmx2g改成-Xmx256m,也就是heap size [268435456] /1024/1024的值
又有新的错误。。。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
|
这个问题折腾了我一下午,最后还是找到了解决方案,同样回到config/elasticsearch.yml文件,找到如下配置,开放discovery.zen.ping.unicast.hosts及discovery.zen.minimum_master_nodes
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
然后修改max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]这个错误(切换到root操作)
1 2 3 4 5 |
|
修改后重新登录seven用户,使用如下命令查看是否修改成功
1 2 |
|
接下来就可以启动elasticsearch了,启动完成使用浏览器访问http://192.168.0.155:9200
1 2 3 4 5 6 7 8 9 10 11 12 |
|
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。