ElasticSearch安装

ElasticSearch安装

环境基础

JDK及相应环境变量

安装ElasticSearch

下载地址,相应安装包根据相应方法运行即可

https://www.elastic.co/downloads/elasticsearch


功能实现

设置IP访问与集群配置

修改配置文件 %es_home%/config/elasticsearch.yml
参数功能
cluster.name设置集群名称, 配置单个节点可不设置,集群则必须设置且集群内各个节点一致
node.name设置节点名称, 配置单个节点可不设置,集群则必须设置且集群内各个节点不可重复
network.host设置绑定IP
http.port绑定端口
discovery.zen.ping.unicast.hosts设置集群各个节点IP, 配置单个节点可不设置
discovery.zen.minimum_master_nodes设置master最少数,推荐为节点半数+1, 配置单个节点可不设置

设置数据与日志保存位置

修改配置文件 %es_home%/config/elasticsearch.yml
参数功能
path.data设置数据保存位置, 启动ElasticSearch的用户必须拥有此目录权限
path.log设置日志保存位置, 启动ElasticSearch的用户必须拥有此目录权限

常见错误及解决方案

错误一

Error occurred during initialization of VM  
Could not allocate metaspace: 1073741824 bytes

解决方案

ElasticSearch JVM使用量太大, 调小即可。
修改配置文件 %es_home%/config/jvm.options
-Xms1g  #修改为200m Xms200m
-Xms1g  #修改为200m Xms200m

错误二

Caused by: java.lang.RuntimeException: can not run elasticsearch as root

解决方案

无法使用root用户启用ElasticSearch,创建ElasticSearch专用用户即可

错误三

max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

解决方案

主要原因是没有配置符合Elasticsearch的配置造成的
修改配置文件 /etc/systctl.conf
增加或修改 "vm.max_map_count=655360"
使用"sysctl -p"命令立即生效

错误四

Error: Could not find or load main class org.elasticsearch.bootstrap.Elasticsearch

解决方案

原因是该账号不是root权限,无法cd到指定目录,多半是你把程序解压在了/root/目录下,随便移动到其他位置即可

错误五

system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk

解决方案

 因为当前版本linux不支持SecComp,而高版本ES默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。详见>https://github.com/elastic/elasticsearch/issues/22899
修改配置文件 %es_home%/config/elasticsearch.yml
设置参数:
    bootstrap.memory_lock: false 
    bootstrap.system_call_filter: false

错误六

max file descriptors [8192] for elasticsearch process is too low, increase to at least [65536] 
max size virtual memory [52729364480] for user [elastic] is too low, increase to [unlimited]

解决方案

主要原因是没有配置符合Elasticsearch的配置造成的
修改配置文件 /etc/security/limits.conf 
设置参数:
    * hard nofile 65536 
    * soft nofile 65536  
    * hard nproc 2048  
    * soft nproc 2048 
    * hard memlock unlimited 
    * soft memlock unlimited 
    *  - as unlimited

参考文档

https://blog.csdn.net/qq_38486203/article/details/80149185#设置外网访问
http://www.mamicode.com/info-detail-2171277.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值