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

相關文章
相關標籤/搜索