Linux安装es ゞ 浴缸里的玫瑰 2022-03-17 20:26 139阅读 0赞 **安装运行** **1、前置安装java8** jdk-8u112-linux-x64.rpm 下载地址:http://www.oracle.com/technetwork/java/javase/downloads/index.html **2、下载** wgethttps://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.zip **3、解压** unzipelasticsearch-5.1.1.zip **4、运行** ./bin/elasticsearch ./bin/elasticsearch-d \#后台运行 tail -flogs/elasticsearch.log \#查看日志 **注:[ES][]有执行脚本的能力,因安全因素,不能在root用户下运行,强行运行会报如下错误:** org.elasticsearch.bootstrap.StartupException:java.lang.RuntimeException: can not run elasticsearch as root **解决方案:** groupadd es \#增加es组 user add es -g es -p pwd \#增加es用户并附加到es组 chown -R es:es elasticsearch-5.1.1 \#给目录权限 sues \#使用es用户 ./bin/elasticsearch-d \#后台运行es **外网访问** viconf/elasticsearch.yml 修改network.host: 0.0.0.0 **再次启动linux可能出现如下类似错误 ** bootstrapchecks failed max filedescriptors \[65535\] for elasticsearch process is too low, increase to at least\[65536\] **解决方案** 启动失败,检查没有通过,报错 \[2018-05-18T17:44:59,658\]\[INFO \]\[o.e.b.BootstrapChecks \] \[gFOuNlS\] bound or publishing to a non-loopback address, enforcing bootstrap checks ERROR: \[2\] bootstrap checks failed \[1\]: max file descriptors \[4096\] for elasticsearch process is too low, increase to at least \[65536\] \[2\]: max virtual memory areas vm.max\_map\_count \[65530\] is too low, increase to at least \[262144\] \[1\]: max file descriptors \[65535\] for elasticsearch process is too low, increase to at least \[65536\] 编辑 /etc/security/limits.conf,追加以下内容; \* soft nofile 65536 \* hard nofile 65536 此文件修改后需要重新登录用户,才会生效 \[2\]: max virtual memory areas vm.max\_map\_count \[65530\] is too low, increase to at least \[262144\] 编辑 /etc/sysctl.conf,追加以下内容: vm.max\_map\_count=655360 保存后,执行: sysctl -p 重新启动,成功。 3、重新使用SSH登录,再次启动elasticsearch即可。 外网访问:serverip:9200/ **安装elasticsearch-head插件** elasticsearch5以后的版本比较新,不支持直接安装head插件,以下是github上提供的安装方法,如下图示 以下为我自己整理的方法,参考来源:http://blog.csdn.net/qq942477618/article/details/53637817 1、下载head插件 wgethttps://codeload.github.com/mobz/elasticsearch-head/zip/master 2、下载nodejs nodejs官网下载地址https://nodejs.org/dist/ wgethttps://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" notfound. 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插件 [ES]: https://www.baidu.com/s?wd=ES&tn=24004469_oem_dg&rsv_dl=gh_pl_sl_csd
还没有评论,来说两句吧...