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

2021-03-13 03:31

阅读:295

标签:文件配置   trap   失败   csdn   config   for   discovery   ant   安装   

技术图片技术图片?

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/

技术图片技术图片?

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

技术图片技术图片?

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

标签:文件配置   trap   失败   csdn   config   for   discovery   ant   安装   

原文地址:https://www.cnblogs.com/zhaixingzhu/p/12562772.html


评论


亲,登录后才可以留言!