Home  >  Article  >  System Tutorial  >  Teach you how to use the Head plug-in in Elasticsearch

Teach you how to use the Head plug-in in Elasticsearch

PHPz
PHPzOriginal
2024-06-19 13:31:50386browse

Teach you how to use the Head plug-in in Elasticsearch

Basic environment

Please refer to the previous article to build the Elasticsearch cluster

http://www.cnblogs.com/aubin/p/8012840.html

System Node Name IP Software Version
CentOS7.3 els1 172.18.68.11 Elasticsearch6.0
CentOS7.3 els2 172.18.68.12 Elasticsearch6.0
CentOS7.3 els3 172.18.68.13 Elasticsearch6.0

1. Installation
  • Plug-in official website address https://github.com/mobz/elasticsearch-head
  • Since the plug-in is hosted in github, you need to install git first
  • because it needs to be downloaded directly from github.
  • When installing the plug-in, npm is used again, so npm is installed at the same time (note: npm is in the epel source)
yum install git npm # npm在epel源中
git clone https://github.com/mobz/elasticsearch-head.git # 安装过程需要连接互联网
cd elasticsearch-head # git clone后会自动生成的一个目录
npm install
npm run start
2. Test

Use a browser to open http://172.18.68.11:9200. If it can be opened normally, it means that the head plug-in is installed correctly
Now the cluster health status shows not connected. This is because the head plug-in does not have permission to obtain cluster node information. Next, set permissions
Teach you how to use the Head plug-in in Elasticsearch

3. Permission settings

If you want to query cluster health information, you need to authorize it in the elasticsearch configuration file

vim /etc/elasticsearch/elasticsearch.yml
http.cors.enabled: true # elasticsearch中启用CORS
http.cors.allow-origin: "*" # 允许访问的IP地址段,* 为所有IP都可以访问
4. Test
Fill in the test index
curl -XPUT '172.18.68.11:9100/book'
Open browser

Open it through the browser again, fill in the IP address of the authorized section (the two lines of configuration above), click the link, and you can see the cluster health information and the sharding information of the test index.
Teach you how to use the Head plug-in in Elasticsearch

Click Data Browse to view all the information, but if there is no data inserted here, you cannot see it. The following articles will record how to input, output, and filter data

Teach you how to use the Head plug-in in Elasticsearch

The above is the detailed content of Teach you how to use the Head plug-in in Elasticsearch. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn