处理Elasticsearch 运行报错信息
一、报错信息:SettingsException[Failed to load setting from [elasticsearch.yml]]; nested: ParsingException [Failed to parse object: expecting token of type [START_OBJECT] but found [VALUE_STRING]];'
报错原因:无法解析配置文件elasticsearch.yml。
解决方案:配置文件的语法格式为keyname: value,必须在冒号后面空一格。
二、报错信息:org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
报错原因:不能以root用户运行
解决方案:另建用户运行elasticsearch。
三、报错信息:Exception in thread "main" java.nio.file.AccessDeniedException: /usr/local/elasticsearch/config/jvm.options
报错原因:运行用户没有elasticsearch文件夹足够权限
解决方案:赋予运行用户相关权限,chown -R elasticsearch:elasticsearch /usr/local/elasticsearch
四、报错信息:ERROR:[4] bootstrap checks failed
[1]:max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535].
原因分析:每个进程同时打开的文件数目是有限制的。使用 ulimi -Hn查看。
解决方式:修改/etc/security/limits.conf配置文件
elasticsearch soft nofile 65535
elasticsearch hard nofile 65535
备注:elasticsearch 是运行elasticsearch程序的用户
[2]: memory locking requested for elasticsearch process but memery is not locked.
elasticsearch soft memlock unlimited
elasticsearch hard memlock unlimited
备注:elasticsearch 是运行elasticsearch程序的用户
[3]: max virtual memory areas vm.max_map_count [6530] is too low, increase to at least [262144].
解决方式:
在 /etc/sysctl.conf文件最后添加一行
vm.max_map_count=262144
[4]:the default discovery are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured.
解决方式:修改elasticsearch.yml配置文件
cluster.initial_master_nodes: ["node-1"]