elasticsearch 安装 配置 启动

一 下载elasticsearch 及相应的jdk

1.1  进入es官网https://www.elastic.co/cn/downloads/elasticsearch,下载elasticsearch6.0

1.2 进入http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html下载jdk1.8

二 安装elasticsearch及启动
2.1 jdk安装略
2.2 安装elasticsearch:
 进入安装目录:cd /usr/local/wutongyu/tools/
  解压:tar -zxvf elasticsearch-6.0.0.tar.gz
2.3 启动   
(1) es出于安全考虑,只能用非root用户启动,创建es用户 :useradd es -p es    
(2) 修改配置文件config/elasticsearch.yml配置参数,必要参数如下:        
path.data: /opt/data/elasticsearch/data        
path.logs: /opt/log/elasticsearch/logs        

 

network.host: 0.0.0.0  (或者localhost,如果Java API通过ip链接elasticsearch,需配置成ip)         

 

http.port: 9200    

 

(3) 修改config/jvm.options参数,根据具体情况分配elasticsearch的内存:        
-Xms1g       
-Xmx1g    
(4) 赋权:
chown -R es /usr/local/wutongyu/tools/elasticsearch-6.0.0               
chown -R es /opt/data/elasticsearch/             
chown -R es /opt/log/elasticsearch/logs             
chown -R es /opt/log/elk/    
(5) 运行es        

 

方法一:

su  es                  

sh /usr/local/wutongyu/tools/elasticsearch-6.0.0/bin/elasticsearch -d       

方法二:

nohup su es -s /usr/local/wutongyu/tools/elasticsearch-6.0.0/bin/elasticsearch 1 >> /opt/log/elk/elasticsearch.log 2 >> /opt/log/elk/elasticsearch.log &    
(6) 运行报错解决方案        
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]    
原因:无法创建本地文件问题,用户最大可创建文件数太小    
解决方案:    
切换到root用户,编辑limits.conf配置文件, vi /etc/security/limits.conf    
添加如下内容:        
*  soft nofile 65536        
* hard nofile 131072        
* soft nproc 4096       
* hard nproc 4096    
备注:* 代表Linux所有用户名称(比如 hadoop),保存、退出、重新登录才可生效
[2]: max number of threads [1024] for user [es] is too low, increase to at least [4096]    
原因:无法创建本地线程问题,用户最大可创建线程数太小    
解决方案:切换到root用户,进入limits.d目录下,修改90-nproc.conf 配置文件。       
vi /etc/security/limits.d/90-nproc.conf    
找到如下内容: * soft nproc 1024  
修改为  * soft nproc 4096
[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
原因:最大虚拟内存太小
解决方案:切换到root用户下,修改配置文件sysctl.conf
vi /etc/sysctl.conf
添加下面配置:
vm.max_map_count=655360
并执行命令:
sysctl -p
然后重新启动elasticsearch,即可启动成功。
[4]: system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
原因:这是在因为Centos6不支持SecComp,而ES5.6.4默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。
解决:在elasticsearch.yml中配置bootstrap.system_call_filter为false,注意要在Memory下面:
bootstrap.memory_lock: false

 

bootstrap.system_call_filter: false

 

更多启动报错详见:http://www.dajiangtai.com/community/18136.do?origin=csdn-geek&dt=1214

修改完成后重启系统。

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值