Elasticsearch-head插件安装

准备

安装npm
npm install -g cnpm --registry=https://registry.npm.taobao.org
下载n模块并,安装NodeJS

npm install -g n 
n latest

在/etc/profile配置环境变量(版本号可能不一样)

export NODE_HOME=/usr/local/n/versions/node/11.1.0
export PATH=$PATH:$NODE_HOME/bin/
export NODE_PATH=$NODE_HOME/lib/node_modules

应用配置
source /etc/profile
使用npm安装grunt

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

版本确认

node -v
npm -v
grunt -version

下载

安装wget
yum install -y wget
使用wget下载head源码
wget https://github.com/mobz/elasticsearch-head/archive/master.zip
安装zip压缩解压工具
yum install -y unzip zip;
解压
unzip master.zip
下载依赖,进入elasticsearch-head-master目录执行
npm install

配置

停止ElasticSearch,在config/elasticsearch.yml配置 ElasticSearch,使得HTTP对外提供服务

# 增加新的参数使head插件能访问es
http.cors.enabled: true
http.cors.allow-origin: "*"

修改Head插件配置文件elasticsearch-head-master/Gruntfile.js,添加hostname一项

connect: {
	server: {
		options: {
			hostname: '0.0.0.0',
			port: 9100,
			base: '.',
			keepalive: true
		}
	}
}

启动

启动elasticsearch
./bin/elasticsearch -d
启动head

grunt server
// 或者 npm run start

访问9100端口
http://ip:9100/

猜你喜欢

转载自blog.csdn.net/sinat_33609161/article/details/84028017