centos7下安装elasticSearch错误总结(单节点模式)
1、首先确定你安装了jdk,版本需要1.8以上
2、上传elasticsearchjar包,只需配置一个文件即可
修改配置文件config/elasticsearch.yml
network.host: 192.168.100.211
3、启动测试
进入到elasticsearch主目录执行 bin/elasticsearch
4、报错
os::commit_memory(0x000000008a660000, 1973026816, 0) failed; error='Cannot allocate memory' (errno=12)
原因:由于elasticsearch5.0以上默认分配jvm空间大小为2g,修改jvm空间分配
解决方案:
5、配好之后再次启动 bin/elasticsearch 报如下错
#出现错误
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
解决办法 设置如下2个参数
#用户最大可创建文件数太小
sudo vi /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
#最大虚拟内存太小
sudo vi /etc/sysctl.conf
vm.max_map_count=262144
6、重启linux
shutdown -r now
7、如果不是root运行也会报错
-
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
-
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:100) ~[elasticsearch-5.1.1.jar:5.1.1]
-
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:176) ~[elasticsearch-5.1.1.jar:5.1.1]
-
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:306) ~[elasticsearch-5.1.1.jar:5.1.1]
-
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:121) ~[elasticsearch-5.1.1.jar:5.1.1]
解决:新建一个用户
adduser xxx
password xxx
切换用户 用普通用户访问 结果OK
如有不对的的地方 ,请多多指教