环境说明:
CentOS7.4(CentOS-7-x86_64-DVD-1810.iso)
VMware® Workstation 12 Pro
搭建:
一、安装nodejs和rpm
cd /soft
su - root
yum install epel-release
yum install nodejs npm
二、下载并安装elasticsearch-head
git clone https://github.com/mobz/elasticsearch-head.git
cd elasticsearch-head
npm install
npm run start
三、 修改elasticsearch参数,以便于head插件访问ES
在elasticsearch下的elasticsearch.yml下新增一下两行:
http.cors.enabled: true
http.cors.allow-origin: "*"
四、修改es-head的localhost地址
cd ./elasticsearch-head #(elasticsearch-head源码文件夹)
vim Gruntfile.js
Add hostname
connect: {
server: {
options: {
hostname: '0.0.0.0',
port: 9100,
base: '.',
keepalive: true
}
}
}
五、修改head的连接地址
cd ./elasticsearch-head #(elasticsearch-head源码文件夹)
vim ./_site/app.js
将localhost修改为ESdeIP地址
修改前:this.base_uri = this.config.base_uri;
修改后: this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://you ip address:9200";
六、启动elasticsearch-head
方式1:
cd /soft/elasticsearch-head
npm run start
方式2:
cd elasticsearch-head(elasticsearch-head源码目录)
./node_modules/grunt/bin/grunt server
七、访问
地址:http://you ip address:9100