Elasticsearch Cluster Building Example

Source: Internet
Author: User

Next month began to search again, a few months did not move this piece fortunately did not fall. Set up a simple search cluster at night on your own virtual machine to share.

Operating system environment: Red Hat 4.8.2-16

Elasticsearch: elasticsearch-1.4.1

Cluster Setup: 2 nodes on a single virtual machine.

cluster storage path:/export/search/elasticsearch-cluster

Required Environment: Java Runtime Environment

Examples of cluster construction show:

1. Unzip the tar package to create the cluster node

#go to cluster path[[email protected] elasticsearch-cluster]#pwd/export/search/elasticsearch-Cluster#Rename Unpack Package[[email protected] elasticsearch-cluster]#lselasticsearch-1.4.1[email protected] Elasticsearch-cluster]#MV elasticsearch-1.4.1 Elasticsearch-node1#Enter the node configuration path[[email protected] elasticsearch-cluster]#CD elasticsearch-node1/config/[[email protected] config]#lsElasticsearch.yml logging.yml

2. Create the cluster configuration information:

# elasticsearch-node1 Configuration # Configure the cluster name cluster.name:elasticsearch-cluster-centos#  Configuration node name "  Es-node1"#  set up a custom port for communication between nodes (default is 9300)     #  Set the custom side to listen for HTTP transmissions (default is 9200)http.port:9200              

Elasticsearch configuration file description See: http://blog.csdn.net/an74520/article/details/10175603

3. Install the head plugin

# Enter the node bin path [[email protected] bin] # pwd/export/search/elasticsearch-cluster/elasticsearch-node1/bin installation plugin [[email protected] bin]  #  ./plugin-install mobz/elasticsearch-head

After installing the plug-in, a plugins directory is created in the ES node bin path sibling, storing the installed plug-in

4. Copy a configured node to Elasticsearch-node2

[[email protected] elasticsearch-cluster] # lselasticsearch-node1  elasticsearch-node2

5. Modify the cluster configuration information in Node 2

  elasticsearch-no De2 configuration  #   Configure the cluster name  cluster.name: Elasticsearch-cluster-centos   Configure node name  node.name:  es-node2  Span style= "color: #800000;" > " #   set a custom port for communication between nodes (default = 9300)  transport.tcp.port:9301 #   Sets the custom side that listens for HTTP transmissions ( Default is 9200)  http.port:9201  

Description
The above configuration indicates that there are 2 nodes in the cluster, the nodes are named "Es-node1" and "Es-node2", and belong to the cluster "Elasticsearch-cluster-centos".
Node two in the port can not be configured, ES at boot will be detected, if the target port is occupied, the next port will be detected. Because two nodes are deployed on the same day virtual machines to better illustrate the problem, the corresponding ports are configured manually here.
We can view the corresponding boot information, as well as the port binding information, from the ES corresponding log ().

6. Start the node separately

[[email protected] bin] # pwd/export/search/elasticsearch-cluster/elasticsearch-node1/bin[[email protected] bin]#  ./elasticsearch-d-xms512m-xmx512m

As above, for the command to start Node 1, ES initiates configuration related logs to view elasticsearch-cluster-Centos.log.

[[email protected] logs] # pwd/export/search/elasticsearch-cluster/elasticsearch-node2/logs[[email protected] logs]#  lselasticsearch-cluster-centos_index_indexing_slowlog.log  elasticsearch-cluster-  Centos.log  elasticsearch-cluster-centos_index_search_slowlog.log

7. Our simple cluster configuration is complete. View the cluster
Because we have the head plugin installed, we can see through the plugin that the virtual machine IP is 192.168.1.108.

http://192.168.1.108:9200/_plugin/head/ (corresponding node 1) http://192.168.1.108:9201/_plugin/head/(corresponding node 2)

Cluster Status:


Appendix: Elasticsearch using JAVAAPI to develop relevant

Distributed search Elasticsearch build clusters and simple search instance applications:
Http://www.cnblogs.com/dennisit/p/3346228.html

Elasticsearch search instance with highlighting and searching for special character filtering
Http://www.cnblogs.com/dennisit/p/3363851.html

Luence-based distributed search engine Elasticsearch Search Example demo (Java API)
Http://www.cnblogs.com/dennisit/archive/2013/04/08/3008631.html


Reprint please specify source: [http://www.cnblogs.com/dennisit/p/4132269.html]

Elasticsearch Cluster Building Example

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.