安装运行
html
一、前置安装java8java
jdk-8u112-linux-x64.rpmnode
下载地址:http://www.oracle.com/technetwork/java/javase/downloads/index.htmllinux
二、下载git
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.zipgithub
三、解压npm
unzip elasticsearch-5.1.1.zipbootstrap
四、运行vim
./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]
解决方案
一、vi /etc/sysctl.conf
设置fs.file-max=655350
保存以后sysctl -p使设置生效
二、vi /etc/security/limits.conf 新增
* soft nofile 655350
* hard nofile 655350
三、从新使用SSH登陆,再次启动elasticsearch便可。
外网访问:serverip:9200/
安装elasticsearch-head插件
elasticsearch 5之后的版本比较新,不支持直接安装head插件,如下是github上提供的安装方法,以下图示
如下为我本身整理的方法,参考来源:http://blog.csdn.net/qq942477618/article/details/53637817
一、下载head插件wget https://codeload.github.com/mobz/elasticsearch-head/zip/master二、下载nodejsnodejs官网下载地址https://nodejs.org/dist/wget https://nodejs.org/dist/v6.9.2/node-v6.9.2-linux-x64.tar.xz三、配置node环境变量xz –d node-v6.9.2-linux-x64.tar.xztar –xvf node-v6.9.2-linux-x64.tarmv node-v6.9.2-linux-x64 /alidata/app/nodevim /etc/profileexport NODE_HOME=/alidata/app/nodeexport PATH=$PATH:$NODE_HOME/binsource /etc/profile# node –vv6.9.2# npm –v3.10.9四、安装gruntcd elasticsearch-head-masternpm install -g grunt --registry=https://registry.npm.taobao.org五、测试一下cd elasticsearch-head-mastergrunt出现如下提示,为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.orgnpm install grunt-contrib-concat --registry=https://registry.npm.taobao.orgnpm install grunt-contrib-watch --registry=https://registry.npm.taobao.orgnpm install grunt-contrib-connect --registry=https://registry.npm.taobao.orgnpm install grunt-contrib-copy --registry=https://registry.npm.taobao.orgnpm install grunt-contrib-jasmine --registry=https://registry.npm.taobao.org六、运行grunt server七、测试http://serverip:9100/修改head目录下的Gruntfile.js配置,head默认监听127.0.0.1vm Gruntfile.jshostname: '0.0.0.0',八、为es设置跨域访问vi config/elasticsearch.yml #新增两行http.cors.enabled: truehttp.cors.allow-origin: "*"九、启动es,启动head插件