CentOS 7 安装 Elasticsearch5.2.2

C# + Web Api + Elasticsearch  参考 =>  http://www.cnblogs.com/eggTwo/p/4039779.html


一、准备工作

*安装JDK7及以上版本 

*下载ElasticSearch安装包(https://www.elastic.co/downloads/elasticsearch  用 zip或 tar.gz)


二、解压
mv elasticsearch-5.2.2.tar.gz /usr/local/
cd /usr/local
tar zxvf elasticsearch-5.2.2.tar.gz 

ln -sv elasticsearch-5.2.2 elasticsearch


三、创建elsearch用户组及elsearch用户
groupadd elsearch
useradd elsearch -g elsearch -p elasticsearch
cd /usr/local
chown -R elsearch:elsearch elasticsearch


四、修改文件


#修改配置文件
vim /usr/local/elasticsearch/config/elasticsearch.yml
 #必须设置ip,设成外部能访问的地址
network.host:192.168.1.105
#用head插件时,设置成跨域
http.cors.enabled:true
http.cors.allow-origin:"*"


#修改系统参数
vim /etc/security/limits.conf
* soft nproc  65536
* hard nproc  65536
* soft nofile  65536
* hard nofile  65536


#修改系统参数
vim /etc/sysctl.conf
vm.max_map_count= 262144
sysctl -p


五、切换到elsearch用户再启动
su elsearch
cd elasticsearch/bin
./elasticsearch


六、正常的话就可以访问 http://192.168.1.105:9200



==========================异常排查======================================



Exception in thread "main" java.lang.RuntimeException: bootstrap checks failed


常见错误一
initial heap size [268435456] not equal to maximum heap size [2147483648]; this can cause resize pauses and prevents mlockall from locking the entire heap
#/usr/java/elasticsearch/config/jvm.options
#将-Xmx2g改成-Xmx256m,也就是heap size [268435456] /1024/1024的值
 

常见错误二
please set [discovery.zen.minimum_master_nodes] to a majority of the number of master eligible nodes in your cluster
# /usr/local/elasticsearch/config/elasticsearch.yml
# discovery.zen.ping.unicast.hosts: ["192.168.1.105"]
# discovery.zen.minimum_master_nodes: 3

 
常见错误三
max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
#/etc/security/limits.conf  修改配置

 


常见错误四
max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]  
# /etc/sysctl.conf 修改配置

常见错误五

如果是用root账号启动,会报以下错误
Exception in thread "main" java.lang.RuntimeException: don't run elasticsearch as root.

#新见elsearch账号 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值