elasticsearch 5.x安装head插件
2019-03-05 本文已影响0人
心水Diana
5.x还未支持head插件,所以需要单独运行
- 下载head
yum install –y git
# 不能放在elasticsearch的plugins/
git clone https://github.com/mobz/elasticsearch-head.git
- 安装node
wget https://nodejs.org/dist/v4.2.2/node-v4.2.2-linux-x64.tar.gz -c
tar -zxf node-v4.2.2-linux-x64.tar.gz; mv node-v4.2.2-linux-x64.tar.gz /usr/local/node
ln -sv /usr/local/node/bin/* /usr/bin/
- 安装grunt
cd elasticsearch-head
npm install grunt-cli
- 修改配置文件
# elasticsearch-head下 Gruntfile.js 文件
增加hostname 绑定本机ip 或者 '*'
90 connect: {
91 server: {
92 options: {
93 port: 9100,
94 base: '.',
95 hostname: '192.168.28.100',
96 keepalive: true
97 }
98 }
99 }
100
101 });

# _site/app.js
# 修改访问地址,默认是localhost
this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://192.168.28.100:9200";

- 修改elasticsearch配置
在elasticsearch.yml文件追加
# 是否支持跨域
http.cors.enabled: true
# *表示支持所有域名
http.cors.allow-origin: "*"
- 启动服务
node_modules/grunt/bin/grunt server &
elasticsearch 启动/重启