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
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
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
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都可以访问
curl -XPUT '172.18.68.11:9100/book'
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.
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!