ES及其插件的安装

一、elasticsearch安装运行
1、前置安装java8
jdk-8u112-linux-x64.rpm
下载地址:http://www.oracle.com/technetwork/java/javase/downloads/index.html
2、下载
curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.1.tar.gz
3、解压
tar -xvf elasticsearch-5.5.1.tar.gz
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.5.1          #给目录权限
su es          #使用es用户
./bin/elasticsearch -d          #后台运行es
外网访问
vi conf/elasticsearch.yml
修改network.host: 0.0.0.0

注:当再次启动,可能会出现如下错误。
问题一
ERROR: bootstrap checks failed

max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]

原因:无法创建本地文件问题,用户最大可创建文件数太小

解决方案:
切换到root用户,编辑limits.conf配置文件, 添加类似如下内容:

vi /etc/security/limits.conf

添加如下内容:
*  soft nofile 65536

* hard nofile 131072

* soft nproc 2048

* hard nproc 4096
备注:* 代表Linux所有用户名称(比如 hadoop)
问题二:
max number of threads [1024] for user [es] likely too low, increase to at least [2048]
原因:无法创建本地线程问题,用户最大可创建线程数太小
解决方案:切换到root用户,进入limits.d目录下,修改90-nproc.conf 配置文件。

vi /etc/security/limits.d/90-nproc.conf

找到如下内容:

* soft nproc 1024

#修改为

* soft nproc 2048
问题三:
max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
原因:最大虚拟内存太小
解决方案:切换到root用户下,修改配置文件sysctl.conf

vi /etc/sysctl.conf

添加下面配置:

vm.max_map_count=655360

并执行命令:

sysctl -p
问题四:
启动异常:ERROR: bootstrap checks failed
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.2.1默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。
解决方法:在elasticsearch.yml中配置bootstrap.system_call_filter为false,注意要在Memory下面:
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
二、安装elasticsearch-head插件
elasticsearch 5以后的版本比较新,不支持直接安装head插件。
1.下载head插件
wget https://codeload.github.com/mobz/elasticsearch-head/zip/master
2、下载nodejs
wget https://nodejs.org/dist/v6.9.2/node-v6.9.2-linux-x64.tar.xz
注意,这里提示错误,需要—no-check-certificate 参数,强制下载。
3、配置node环境变量

tar –xvf node-v6.9.2-linux-x64.tar.xz
mv node-v6.9.2-linux-x64 /usr/node/

vim /etc/profile
export NODE_HOME=/usr/node/node-v6.9.2-linux-x64
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 grunt --registry=https://registry.npm.taobao.org
进入目录:
/usr/elasticsearch-head-master/node_modules/grunt/bin
执行./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://localhost: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插件
三、Kibana的安装
1.下载
Wget https//artifacts.elastic.co/downloads/ibana/kibana-5.5.1-linux-x86_64.tar.gz
tar -xvf kibana-5.5.1-Linux-x86_64.tar.gz
2、配置Kibana
vim config/kibana.yml
server.host:“0.0.0.0”
elasticsearch.url:http://localhost:9200
3.启动kabana
./kabana
4.访问
http://localhost:5601

猜你喜欢

转载自girl-luo.iteye.com/blog/2391844
今日推荐