设为首页 收藏本站
查看: 1797|回复: 0

[经验分享] Elasticsearch 5常见问题解决方案

[复制链接]

尚未签到

发表于 2019-1-29 10:36:29 | 显示全部楼层 |阅读模式
  安装运行

  1、前置安装java8
  jdk-8u112-linux-x64.rpm
  下载地址:http://www.oracle.com/technetwork/java/javase/downloads/index.html
  2、下载
  wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.zip
  3、解压
  unzip elasticsearch-5.1.1.zip
  4、运行
  ./bin/elasticsearch
  ./bin/elasticsearch -d          #后台运行
  tail -f logs/elasticsearch.log           #查看日志
  

  注:ES有执行脚本的能力,因安全因素,不能在root用户下运行,强行运行会报如下错误:
  org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
  解决方案:
  groupadd es          #增加es组
  useradd es -g es -p pwd          #增加es用户并附加到es组
  chown -R es:es elasticsearch-5.1.1          #给目录权限
  su es          #使用es用户

  ./bin/elasticsearch -d          #后台运行es

  

  外网访问
  vi conf/elasticsearch.yml
  修改network.host: 0.0.0.0
  再次启动linux可能出现如下类似错误

  bootstrap checks failed
  max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]
  解决方案
  1、vi /etc/sysctl.conf
  设置fs.file-max=655350
  保存之后sysctl -p使设置生效
  2、vi /etc/security/limits.conf 新增
  * soft nofile 655350
  * hard nofile 655350
  3、重新使用SSH登录,再次启动elasticsearch即可。
  外网访问:serverip:9200/
  

  安装elasticsearch-head插件
  elasticsearch 5以后的版本比较新,不支持直接安装head插件,以下是github上提供的安装方法,如下图示


  以下为我自己整理的方法,参考来源:http://blog.csdn.net/qq942477618/article/details/53637817

  1、下载head插件

wget https://codeload.github.com/mobz/elasticsearch-head/zip/master

2、下载nodejs

nodejs官网下载地址https://nodejs.org/dist/

wget https://nodejs.org/dist/v6.9.2/node-v6.9.2-linux-x64.tar.xz

3、配置node环境变量

xz –d node-v6.9.2-linux-x64.tar.xz
tar –xvf node-v6.9.2-linux-x64.tar
mv node-v6.9.2-linux-x64 /alidata/app/node

vim /etc/profile
export NODE_HOME=/alidata/app/node
export PATH=$PATH:$NODE_HOME/bin
source /etc/profile

# node –v
v6.9.2
# npm –v
3.10.9

4、安装grunt

cd elasticsearch-head-master
npm install -g grunt --registry=https://registry.npm.taobao.org

5、测试一下

cd elasticsearch-head-master
grunt

出现以下提示,为Gruntfile.js引用的,缺少以下包

>> Local Npm module "grunt-contrib-clean" not found. Is it installed?
>> Local Npm module "grunt-contrib-concat" not found. Is it installed?
>> Local Npm module "grunt-contrib-watch" not found. Is it installed?
>> Local Npm module "grunt-contrib-connect" not found. Is it installed?
>> Local Npm module "grunt-contrib-copy" not found. Is it installed?
>> Local Npm module "grunt-contrib-jasmine" not found. Is it installed?
Warning: Task "connect:server" not found. Use --force to continue.

Aborted due to warnings.

安装

npm install grunt-contrib-clean --registry=https://registry.npm.taobao.org

npm install grunt-contrib-concat --registry=https://registry.npm.taobao.org

npm install grunt-contrib-watch --registry=https://registry.npm.taobao.org
npm install grunt-contrib-connect --registry=https://registry.npm.taobao.org
npm install grunt-contrib-copy --registry=https://registry.npm.taobao.org
npm install grunt-contrib-jasmine --registry=https://registry.npm.taobao.org

6、运行

grunt server


7、测试

http://serverip:9100/

修改head目录下的Gruntfile.js配置,head默认监听127.0.0.1

vm Gruntfile.js

hostname: '0.0.0.0',

8、为es设置跨域访问

vi config/elasticsearch.yml         #新增两行

http.cors.enabled: true

http.cors.allow-origin: "*"

9、启动es,启动head插件
  





运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-669074-1-1.html 上篇帖子: elasticsearch red 无法修复,查看发现是unassigned shards 有无法分配的节点的分片 下篇帖子: Elasticsearch2.X升级至5.X问题汇总
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表