ElasticSearch

ElasticSearch第3节 ElasticSearch-H

2019-06-13  本文已影响0人  小超_8b2f

小伦超正经_ElasticSearch 7.0.0博客

Head是elasticsearch的集群管理工具,可以了解集群的健康状况,可以知道哪个集群中哪个节点出了问题,也可以实现对ElasticSearch中的数据的浏览和查询。方便了解ElasticSearch的一个客户端工具。

  1. elasticsearch-head是一款开源软件,被托管在github上面,所以如果我们要使用它,必须先安装git,通过git获取elasticsearch-head

  2. 运行elasticsearch-head会用到grunt,而grunt需要npm包菅理器,所以nodejs是必须要安装的:https://nodejs.org/dist/v12.4.0/node-v12.4.0.pkg
         如何使用NPM?CNPM又是什么?

  3. elasticsearch5.0之后,elasticsearch-head不做为插件放在其plugins目录下 了 。使用git拷贝elasticsearch-head到本地:

cd /usr/local/
git clone git://github.com/mobz/elasticsearch-head.git
  1. 安装elasticsearch-head 依赖包
$ sudo npm install -g grunt-cli 
$ sudo npm install cnpm -g --registry=https://registry.npm.taobao.org
$ cd /usr/local/elasticsearch-head/
$ cnpm install
  1. 修改 Gruntfile.js
$ cd /usr/local/elasticsearch-head/
$ vi Gruntfile.js
connect: {
   server: {
          options: {
               hostname:'*',  # 新增此行,让所有IP都能访问
               port: 9100,
               base: '.',
               keepalive: true
          }
   }
}
  1. 修改elasticsearch-head默认连接地址
cd /usr/local/elasticsearch-head/_site/ 
$ vi app.js
this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://localhost:9200";
# 将http://localhost:9200改成:http://real_ip:9200
  1. Elasticsearch允许跨域访问
    elasticsearch.yml文件末尾追加
http.cors.enabled: true 
http.cors.allow-origin: "*"
  1. 防火墙打开9100搞口
$ firewall-cmd --zone=public --add-port=9100/tcp --permanent
# 重启防火墙
$  firewall-cmd --reload
  1. 启动 elasticsearch
  2. 启动 elasticsearch-head
$ cd /usr/local/elasticsearch-head/node_modules/grunt/bin
$ ./grunt server
Running "connect:server" (connect) task
Waiting forever...
Started connect web server on http://localhost:9100

http://localhost:9100

http://localhost:9100
上一篇 下一篇

猜你喜欢

热点阅读