Elasticsearch cluster deployment record under CentOS7

Elasticsearch is a distributed search service that provides Restful API. The bottom layer is based on Lucene. It uses multiple shards to ensure [Data Security] (https://cloud.tencent.com/solution/data_protection?from=10680) and provides automatic resharding. Large sites such as github also use Elasticsearch as their search service. . I won’t repeat the nonsense here. The following records the deployment process of the Elasticsearch cluster under CentOS7:

Before deploying an Elasticsearch cluster on three servers:
qd-vpc-op-es01    101.119.92.247
qd-vpc-op-es02    101.119.92.249
qd-vpc-op-es03    101.119.92.254

Next, add another es04 machine to the cluster, the operation is as follows:
qd-vpc-op-es04    101.119.92.161) Install jdk and elasticsearch
jdk-8u5-linux-x64.rpm download address:
https://pan.baidu.com/s/1bpxtX5X(Extract password: df6s)

elasticsearch-5.5.0.rpm download address:
https://pan.baidu.com/s/1mibwWeG (Extract password: vtm2)

[ root@qd-vpc-op-es04 ~]# cd tools/[root@qd-vpc-op-es04 tools]# ls
elasticsearch-5.5.0.rpm  jdk-8u5-linux-x64.rpm
[ root@qd-vpc-op-es04 tools]# rpm -ivh elasticsearch-5.5.0.rpm 
[ root@qd-vpc-op-es04 tools]# rpm -ivh jdk-8u5-linux-x64.rpm 
[ root@qd-vpc-op-es04 tools]# java -version
java version "1.8.0_05"Java(TM) SE Runtime Environment(build 1.8.0_05-b13)
Java HotSpot(TM)64-Bit Server VM(build 25.5-b02, mixed mode)2) Configure elasticsearch
[ root@qd-vpc-op-es04 ~]# cd /etc/elasticsearch/[root@qd-vpc-op-es04 elasticsearch]# ls
elasticsearch.yml  elasticsearch.yml.bak  jvm.options  log4j2.properties  nohup.out  scripts

[ root@qd-vpc-op-es04 elasticsearch]# cat elasticsearch.yml|grep -v "#"//The configuration content of each node in the cluster is basically the same

cluster.name: image_search                                                       //Cluster name
node.name: image_search_node_4                                                   //The node name of this node in the cluster, just define it here
path.data:/data/es/data                                                         //Service directory path
path.logs:/data/es/logs                                                         //Service log path
discovery.zen.ping.unicast.hosts:["101.119.92.247","101.119.92.249","101.119.92.254","10.111.233.16"]//Here is the ip address of each node
network.host:0.0.0.0//Network address bound to the service

The default elasticsearch service port is 9200[root@qd-vpc-op-es04 elasticsearch]# cat elasticsearch.yml|grep 9200
# http.port:9200[root@qd-vpc-op-es04 elasticsearch]# systemctl start elasticsearch.service
[ root@qd-vpc-op-es04 elasticsearch]# systemctl restart elasticsearch.service
[ root@qd-vpc-op-es04 elasticsearch]# systemctl status elasticsearch.service

[ root@qd-vpc-op-es04 elasticsearch]# ps -ef|grep elasticsearch
[ root@qd-vpc-op-es04 elasticsearch]# lsof -i:9200
COMMAND   PID          USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
java    10998 elasticsearch  320u  IPv4  39255      0t0  TCP *:wap-wsp(LISTEN)

Check the health status of elasticsearch
[ root@qd-vpc-op-es04 elasticsearch]# curl 'localhost:9200/_cat/indices?v'
health status index                   uuid                   pri rep docs.count docs.deleted store.size pri.store.size
green  open   video_filter            Bx7He6ZtTEWuRBqXYC6gRw   5145801304.1gb            2gb
green  open   recommend_history_image svYo_Do4SM6wUiv6taUWug   512865902024.9gb         12.4gb
green  open   recommend_history_gif   rhN3MDN2TbuYILqEDksQSg   5126573102.4gb          1.2gb
green  open   post_images             TMsMsMEoR5Sdb7UEQJsR5Q   51487249320407.3gb        203.9gb
green  open   review_images_v2        qzqnknpgTniU4rCsvXzs0w   5150375955061.6gb         30.9gb
green  open   review_images           rWC4WlfMS8aGe-GOkTauZg   51518108770439.3gb        219.7gb
green  open   sensitive_images        KxSrjvXdSz-y8YcqwBMsZA   51133930128.1mb           64mb
green  open   post_images_v2          FDphBV4-QuKVoD4_G3vRtA   5149340491055.8gb         27.8gb

As can be seen from the above command results, this node has been successfully added to the name image_Search is in the elasticsearch cluster. Green indicates that the node status is healthy and the data is already in synchronization.

3 ) Update the configuration of elasticsearch in the code
Notify the development colleagues to add the configuration of the new elasticsearch node to the code. After the online update, check the elasticsearch log on the new node to see if there is any information written:
[ root@qd-vpc-op-es04 ~]# cd /data/es/logs/[root@qd-vpc-op-es04 ~]# chown -R elasticsearch.elasticsearch /data/es
[ root@qd-vpc-op-es04 logs]# ls
image_search_deprecation.log  image_search_index_indexing_slowlog.log  image_search_index_search_slowlog.log  image_search.log

----------------------------------------------------------------------------------------------------------------
note:
If you add a node to the elasticsearch cluster, do as follows:
1 ) Install jdk and elasticsearch service on the new node, configure elasticsearch.yml file, start elasticsearch service
2 ) Configure elasticsearch on other nodes in the cluster.yml file, no need to start elasticsearch service
3 ) Execute curl on the new node'localhost:9200/_cat/indices?v'Command to view health status and data synchronization
4 ) Add the configuration of the new elasticsearch node to the code. After the online update, check whether the elasticsearch log of the new node has information written
----------------------------------------------------------------------------------------------------------------
Finally, by the way, post the elasticsearch of the other three nodes.yml file configuration:
[ root@qd-vpc-op-es01 ~]# cat /etc/elasticsearch/elasticsearch.yml |grep -v "#"

cluster.name: image_search
node.name: image_search_node_1
path.data:/data/es/data
path.logs:/data/es/logs
discovery.zen.ping.unicast.hosts:["10.111.233.16","101.119.92.247","101.119.92.249","101.119.92.254"]
network.host:0.0.0.0[root@qd-vpc-op-es02 ~]# cat /etc/elasticsearch/elasticsearch.yml |grep -v "#"
cluster.name: image_search
node.name: image_search_node_2
path.data:/data/es/data
path.logs:/data/es/logs
discovery.zen.ping.unicast.hosts:["10.111.233.16","101.119.92.247","101.119.92.249","101.119.92.254"]
network.host:0.0.0.0[root@qd-vpc-op-es03 ~]# cat /etc/elasticsearch/elasticsearch.yml|grep -v "#"

cluster.name: image_search
node.name: image_search_node_3
path.data:/data/es/data
path.logs:/data/es/logs
discovery.zen.ping.unicast.hosts:["101.119.92.247","101.119.92.249","101.119.92.254","10.111.233.16"]
network.host:0.0.0.0----------------------------------------------------------------------------------------------------------------

If you shut down a node or bring it out of the cluster, you need to notify the node in advance to stop synchronizing data (it will be used during migration):
# curl -XPUT 'localhost:9200/_cluster/settings'-d '{"transient":{"cluster.routing.allocation.enable": "none”}}’ 

Recommended Posts

Elasticsearch cluster deployment record under CentOS7
RabbitMQ cluster deployment record under Centos6.9
Centos7.4 deployment configuration Elasticsearch5.6 cluster
FFmpeg environment deployment record under centos7
PPTP environment deployment record under Centos
Complete deployment record for LDAP under Centos7.2
[CentOS environment deployment] Java7/Java8 deployment under CentOS
Redis cluster installation under CentOS
Redis cluster installation under CentOS
Centos7.2 deployment vnc service record
SFTP dual-machine high availability environment deployment record under Centos
Build a PXC cluster under CentOS8
Erlang 20.2 installation and deployment under CentOS 7
k8s practice (1): Centos 7.6 deployment k8s (v1.14.2) cluster
MySQL 8.0 installation, deployment and configuration under CentOS 6/7
Zabbix installation and deployment and localization under CentOS
Jenkins installation and deployment tutorial under CentOS 7
CentOS deployment Harbor
Build a ScaleIO distributed storage cluster under CentOS7
MySQL 8.0 installation and deployment under CentOS, super detailed!
Distributed deployment of Apollo configuration center under CentOS8
Deploy GitBook under CentOS7
Compile Hadoop-2.7.6 under CentOS7.4
Use Rancher to build a K8s cluster under CentOS7
CentOS7.3.1611 deploys k8s1.5.2 cluster
Centos6.9 build rabbitmq 3.6.8 cluster
Install mysql5.7 under CentOS7
Centos install elasticsearch tutorial
CentOS6 install couchdb2 cluster
Install ActiveMQ under Centos7
Install PostgreSQL12 under CentOS7
Install CentOS under VMware
CentOS 6.8 deploy zookeeper cluster
Centos7 build Kubernetes cluster
Centos7 mqtt cluster installation
Deploy JDK+Tomcat8 under CentOS
Install mysql under Centos 7
Configure lamp under centos6.8
Install Jenkins under Centos 7
Redis3 installation under Centos7
CentOS cluster related issues
Centos7 deploys Kubernetes cluster
Install MariaDB under MariaDB Centos7
Install mysql5.1 under CentOS6.5
CentOS7 deploys k8s cluster
Install Elasticsearch 6 on centos7
Rapid deployment of Kubernetes (k8s) cluster in CentOS7 environment
CentOS7.6 server deployment VNC
Deployment of vulnerability scanning and analysis software Nessus under CentOS
Django&MySQL environment deployment under Ubuntu 14.04
Build docker environment under Centos6.5
Centos 7 mini installation process record
Install ElasticSearch 7.x on CentOS 7
Build OpenLDAP server under CentOS7
CentOS7 install rabbitmq cluster (binary)
Glusterfs cluster installation on Centos7
CentOS 7 Galera Cluster installation guide
Centos7.2/7.3 cluster install Kubernetes 1.8.4 + Dashboard
Configure static IP under CentOS 7
Deployment of graphite on centos7
Install Oracle11gR2 database under CentOS6.9