Elasticsearch5 及 head插件 安装说明

Elasticsearch5.Xhead插件 安装说明:

1、下载elasticsearch安装文件:

a) 下载官方源码:

https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.0.0.tar.gz

b) 解压压缩文件

tar -zxvf elasticsearc-5.0.0.tar.gz

c) 修改es配置文件:elasticsearch.yml

cluster.name: kd-cluster //集群名称,所有主机相同的集群名称用于发现集群节点

node.name: node01 //节点名称

node.master: true //该节点是否用做管理节点

node.data: true //该节点是否用做数据节点

node.attr.rack: r1

path.data: 数据存储路径(文件夹)

path.logs: 日志存储路径(文件夹)

bootstrap.memory_lock: false

network.host: 172.16.8.229 //节点ip地址

http.cors.enabled: true //head插件的配置

http.cors.allow-origin: "*" //head插件的配置

http.port: 9200 //集群访问端口

discovery.zen.ping.unicast.hosts: ["node01"] //配置了互信的话这个位置可以使用节点名称(一般节点名成和计算机名称的相同的)。未配置互信的话使用主机ip,用于发现管理节点。

discovery.zen.minimum_master_nodes: 1 //集群最大管理节点数(防止脑裂的配置)

gateway.recover_after_nodes: 1

d) 修改主机配置

vi /etc/security/limits.conf 

* soft nofile 65536

* hard nofile 131072

* soft nproc 2048

* hard nproc 4096

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

* soft nproc 2048

vi /etc/sysctl.conf 

vm.max_map_count=655360

并执行命令:sysctl -p

重启计算机。

2、下载elasticseatch-head插件:

a) 下载head插件文件:

https://github.com/mobz/elasticsearch-head(下载后上传到服务器)

git clone git://github.com/mobz/elasticsearch-head.gitgit下载)

b) 下载Node.js

wget https://nodejs.org/dist/v4.6.1/node-v4.6.1-linux-x64.tar.gzlinux命令直接下载)

https://nodejs.org/dist/(官方网站下载后上传到服务器)

c) 配置node.js环境变量:

vim /etc/profile

export PATH=/data/elasticsearch/node-v4.6.1-linux-x64/bin:$PATH(根据实际情况添加,路径和格式参照本机环境)

执行source /etc/profile使环境变量生效

(修改profile文件需要root权限,使环境生效的命令在当前es集群使用用户下执行)

d) 查看当前head插件目录下有无node_modules/grunt目录:

没有:执行命令创建:npm install grunt --save

e) 安装head插件:

npm install

或者使用重定向安装:npm install -g cnpm --registry=https://registry.npm.taobao.org

f) 安装grunt

npm install -g grunt-cli

g) 编辑Gruntfile.js

文件93行添加hostname:’0.0.0.0’

h) 检查head根目录下是否存在base文件夹

没有:将 _site下的base文件夹及其内容复制到head根目录下

i) 启动grunt server

head下运行grunt server -d启动head插件

j) 访问head插件:

http://localhost:9100(启动后会有提示:Started connect web server on http://localhost:9100

  可以发邮件给我:1492370189@qq.com

 

原文地址:https://www.cnblogs.com/rethink-east/p/6547171.html