安装ES6及HEAD插件

时间:2023-12-20 21:35:32

1.下载相应npm包

es6地址:https://www.elastic.co/downloads/elasticsearch
head插件地址:https://github.com/mobz/elasticsearch-head/

2.安装ES

#yum install elasticsearch-6.2.2.rpm

2.1 修改ES配置文件

# egrep -v "^#|^$" elasticsearch.yml
cluster.name: elk6 #集群名字
node.name: "elk-a1" #节点名字
node.master: true #主节点
node.data: true
discovery.zen.ping.unicast.hosts: ["192.168.x.x"]
discovery.zen.fd.ping_timeout: 60s
discovery.zen.fd.ping_retries: 5
indices.fielddata.cache.size: 40%
bootstrap.system_call_filter: false
http.cors.enabled: true #允许插件
http.cors.allow-origin: "*"
path.data: /xx/elasticsearch #数据目录
path.logs: /var/log/elasticsearch #日志目录
network.host: 0.0.0.0

2.2 启动ES

ES6依赖jdk1.8,并且ulimit要大于65535,数据目录权限需要是elasticsearch
修改ulimit
#vim /etc/security/limits.conf
\* soft nofile 65536
\* hard nofile 65536
chown -R elasticsearch.elasticsearch /xx/elasticsearch
service elasticsearch start

3.安装head插件

3.1 安装nodejs

# yum install -y nodejs

3.2 安装npm

# yum install npm

3.3 通过npm安装grunt

# npm install -g grunt-cli --registry=https://registry.npm.taobao.org

3.4 确认版本

`# node -v
v0.10.48

npm -v

1.3.6

grunt --version

grunt-cli v1.3.1`

3.5 下载head插件

# wget https://github.com/mobz/elasticsearch-head/archive/master.zip
# unzip master.zip
# mv elasticsearch-head-master/ /usr/local

3.6 安装head插件

# cd /usr/local/elasticsearch-head-master/
# npm install --registry=https://registry.npm.taobao.org
# 修改Head插件配置文件
# vim Gruntfile.js
# 找到connect:server,添加hostname一项,如下
connect: {
server: {
options: {
hostname: '0.0.0.0',
port: 9100,
base: '.',
keepalive: true
}
}

3.7 启动head插件

# nohup npm run start &

3.8 浏览器观察效果

访问:http://192.168.XX.XX:9100/
安装ES6及HEAD插件
若显示未连接,将localhost改成IP,点击连接即可
安装ES6及HEAD插件