elasticsearch-head安装
git地址:
https://github.com/mobz/elasticsearch-head
Linux下安装命令
git clone git://github.com/mobz/elasticsearch-head.git cd elasticsearch-head npm install npm run start
如果没用按装npm,可以使用命令apt命令进行安装
apt install npm
1.4 安装Head插件
1.4.1 什么是Head
Ealsticsearch只是后端提供各种API,那么怎么直观的使用它呢?Elasticsearch-head将是一款专门针对于Elasticsearch的客户端工具
Elasticsearch-head配置包,下载地址:https://github.com/mobz/elasticsearch-head
1.4.2 安装
注意:es5以上版本安装head需要安装node和grunt
第一步:从地址:https://nodejs.org/en/download/ 下载相应系统的msi,双击安装。
第二步:安装完成用cmd进入安装目录执行 node -v可查看版本号
能看到版本号说明node安装成功
第三步:执行 npm install -g grunt-cli 安装grunt ,安装完成后执行grunt -version查看是否安装成功,会显示安装的版本号
1.4.3 配置运行
第一步:进入Elasticsearch安装目录下的config目录,修改elasticsearch.yml文件.在文件的末尾加入以下代码
http.cors.enabled: true
http.cors.allow-origin: "*"
node.master: true
node.data: true
然后去掉network.host: 192.168.0.1的注释并改为network.host: 0.0.0.0,去掉cluster.name;node.name;http.port的注释(也就是去掉#)去掉注释cluster.initial_master_nodes: ["node-1", "node-2"]
# ======================== 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: 192.168.0.1 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 this node is started: # The default list of hosts is ["127.0.0.1", "[::1]"] # #discovery.seed_hosts: ["host1", "host2"] # # Bootstrap the cluster using an initial set of master-eligible nodes: # cluster.initial_master_nodes: ["node-1", "node-2"] # # For more information, consult the discovery and cluster formation 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重启Elasticsearch
第三步:在https://github.com/mobz/elasticsearch-head中下载head插件,选择下载zip
第四步:解压到指定文件夹下,D:\environment\elasticsearch-head-master 进入该文件夹,修改D:\environment\elasticsearch-head-master\Gruntfile.js 在对应的位置加上hostname:’*’、
第五步:打开cmd命令行窗口 ,在D:\environment\elasticsearch-head-master 下执行npm install 安装
,完成后执行grunt server 或者npm run start 运行head插件,如果运行不成功建议重新安装grunt。成功如下
1.4.4 成功
打开浏览器访问:http://127.0.0.1:9100