【ES】windows下安装ElasticSearch的Head插件

ElasticSearch官方的模拟工具是控制台的curl,不是很直观,可以在chrome浏览器中安装head插件来作为请求的工具:head插件

上节已经阐述了curl的一些基本操作

详情可以点击查看:

1: windows环境中如何安装配置curl工具

2: CURL在windows中对ElasticSearch的一些简单的操作

ES5以上的版本安装head需要安装node和grunt

首先我们来安装node

下载地址:

https://nodejs.org/en/download/ 

下载相应系统的msi,双击安装

我选择的安装目录为:

D:\Program Files\ES

下面的所有的操作全部以这个目录为例。

下载完成后解压到文件夹

完成后用cmd进入安装目录 可以执行node -v 查看版本号以及是否安装成功

执行 npm install -g grunt-cli 安装grunt

 

安装成功后:

 

在cmd输入执行grunt -version 会显示版本号:

现在开始安装head

1:进入安装目录下的config目录,修改elasticsearch.yml文件.在文件的末尾加入以下代码

http.cors.enabled: true 
http.cors.allow-origin: "*"
node.master: true
node.data: true

 

elasticsearch.yml文件配置:

去掉network.host: 192.168.0.1的注释并改为network.host: 0.0.0.0,去掉cluster.name;node.name;http.port的注释(也就是去掉#)

# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: my-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-1
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
#path.data: /path/to/data
#
# Path to log files:
#
#path.logs: /path/to/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 0.0.0.0
#
# Set a custom port for HTTP:
#
http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when new node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.zen.ping.unicast.hosts: ["host1", "host2"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):
#
#discovery.zen.minimum_master_nodes: 
#
# For more information, consult the zen discovery module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true
http.cors.enabled: true 
http.cors.allow-origin: "*"
node.master: true
node.data: true

 

 

双击elasticsearch.bat重启es

2:下载head插件,选择下载zip

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

3:解压到指定文件夹下,D:\Program Files\ES\elasticsearch-head-master  进入该文件夹,修改D:\Program Files\ES\elasticsearch-head-master\Gruntfile.js 在对应的位置加上hostname:'*'

 

4:在D:\Program Files\ES\elasticsearch-head-master  下执行npm install 安装

 

如下失败请重新检查配置,重新安装:

成功如下图:

 

完成后执行grunt server 或者npm run start 运行head插件

浏览器下访问http://localhost:9100/

 欢迎关注摘星族,我们不仅仅是代码的搬运工,同时也是技术的分享者

posted @ 2020-03-24 22:46  路大师_XA  阅读(1398)  评论(0编辑  收藏  举报