elasticsearch6.3.2的head插件安装与使用

版权声明:本文为博主原创文章,转载时请注明出处链接。 https://blog.csdn.net/lk7688535/article/details/81477051

1、环境

  • ubuntu14.04
  • elasticsearch6.3.2
  • nodejs8.11.3
  • elasticsearch-head-master.zip

2、下载elasticsearch-head-master.zip

https://github.com/mobz/elasticsearch-head下载zip文件,解压,并放入ubuntu的/usr/server/文件夹中。

3、 下载安装并配置nodejs

3_1.从https://nodejs.org/en/download/current/下载linux64位版本的nodejs,然后放入ubuntu的/usr/server,并使用tar -zxvf解压。

3_2.配置环境变量

vim /etc/profile

export NODE_HOME=/usr/server/node-v8.11.3-linux-x64
export JAVA_HOME=/usr/jdk8
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}b:${JRE_HOME}b
export PATH=${JAVA_HOME}/bin:$PATH:${NODE_HOME}/bin:$PATH

source /etc/profile

通过node -v查看安装与配置是否成功

4、下载grunt

npm install -g grunt-cli

5、 配置head和elasticsearch

5_1.elasticsearch.yml

vim elasticsearch-5.6.1/config/elasticsearch.yml

http.cors.enabled: true
http.cors.allow-origin: "*"

配置后需要重启elasticsearch才能生效。

5_2.Gruntfile.js

cd elasticsearch-head-master/ vim Gruntfile.js

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

5_3. app.js

cd elasticsearch-head-master/_site 
vim app.js

this.base_uri = this.config.base_uri || this.prefs.get("app-b

5_4. 启动

cd elasticsearch-head-master

grunt server

会报错,很多grunt相关的包未安装

npm install grunt-contrib-clean --registry=https://registry.npm.taobao.org

npm install grunt-contrib-concat --registry=https://registry.npm.taobao.org

npm install grunt-contrib-watch --registry=https://registry.npm.taobao.org npm install grunt-contrib-connect --registry=https://registry.npm.taobao.org npm install grunt-contrib-copy --registry=https://registry.npm.taobao.org npm install 

sudo npm install phantomjs-prebuilt@2.1.15 --ignore-scripts

grunt-contrib-jasmine --registry=https://registry.npm.taobao.org

再执行grunt server,看到
Running "connect:server" (connect) task
Waiting forever...
Started connect web server on http://localhost:9100
说明启动成功

6、 使用

访问http://120.133.17.169:9100/

猜你喜欢

转载自blog.csdn.net/lk7688535/article/details/81477051
今日推荐