Elasticsearch head plugin 安装

1.npm 安装html

mac 环境经过Homebrew(http://brew.sh/index_zh-cn.html)安装npm,java

输入命令安装npm :node

brew install npm

2.Node.js 安装(本机已经安装了node.js, 没有去查找node.js安装方法)git

3.修改npm install国内安装很慢,修改镜像github

设置镜像方法:npm config set key value 命令,设置指定的镜像地址,npm

npm config set registry https://registry.npm.taobao.org

npm info underscore (这个只是为了检验上面的设置命令是否成功,若成功会返回[指定包]的信息)

4.Elasticsearch head 安装segmentfault

下载elasticsearch-head:app

git clone https://github.com/mobz/elasticsearch-head.git

#进入目录cors

cd elasticsearch-head/
npm install

配置hostname,elasticsearch-head/Gruntfile.js elasticsearch

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

 

5.启动服务

A.启动elastisearch

B.启动elasticsearch-head(elasticsearch-head目录)

./node_modules/grunt/bin/grunt server

6.es 配置

Connecting to elasticsearch

By default elasticsearch exposes a http rest API on port 9200 which elasticsearch-head connects to.

Enable CORS in elasticsearch

When not running as a plugin of elasticsearch (which is not even possible from version 5) you must enable CORS in elasticsearch otherwise your browser will rejects requests which appear insecure.

In elasticsearch configuration;

add http.cors.enabled: true
you must also set http.cors.allow-origin because no origin allowed by default. http.cors.allow-origin: "*" is valid value, however it’s considered as a security risk as your cluster is open to cross origin from anywhere.

 

附:

http://www.jianshu.com/p/20ea93641bda

https://segmentfault.com/a/1190000007829080

https://github.com/mobz/elasticsearch-head

https://www.elastic.co/downloads/elasticsearch

相关文章
相关标签/搜索