怎么安装使用elasticsearch-head插件

wylc123 1年前 ⋅ 2929 阅读

其实很简单,这个就是一个前端页面,使用nodejs编译运行。

1、安装node.js

2、下载ElasticSearch-head压缩包

下载地址:https://github.com/mobz/elasticsearch-head,下载后解压缩。

3、可以修改相关的访问ES端口和访问head端口

目录:head/Gruntfile.js:

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

增加hostname属性,设置为*

修改连接地址: 
目录:head/_site/app.js

修改head的连接地址:

this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://localhost:9200";

把localhost修改成你es的服务器地址

4、修改ElasticSearch的配置

目录config/elasticsearch.yml

在配置文件末尾追加一下内容:

# 增加新的参数,这样head插件可以访问es
http.cors.enabled: true
http.cors.allow-origin: "*"

5、编译运行

cmd在根目录执行:

npm install

如果nodejs配置了阿里的源,也可以执行

cnpm install

执行完后,使用命令,来运行

npm run start

6、访问head

这个时候,访问http://localhost:9100就可以访问head插件了

(记得要先启动ElasticSearch,再启动head插件)

如果es设置里用户名密码修改访问url:

http://localhost:9100/?auth_user=elastic&auth_password=root123456

更多内容请访问:IT源点

相关文章推荐

全部评论: 0

    我有话说: