Elasticsearch cluster creation instance, elasticsearch Cluster
I started searching again next month. I haven't moved it for a few months but it hasn't fallen. In the evening, I set up a simple search cluster on my virtual machine and shared it with me.
Operating system environment:Red Hat 4.8.2-16
Elasticsearch:Elasticsearch-1.4.1
Cluster construction method:Two nodes on one VM.
Cluster Storage path:/Export/search/elasticsearch-cluster
Prerequisites:Java Runtime Environment
Cluster creation instance display:
1. decompress the tar package and create a cluster node.
# Enter the cluster path [root @ localhost elasticsearch-cluster] # pwd/export/search/elasticsearch-cluster # rename the unzipping package [root @ localhost elasticsearch-cluster] # lselasticsearch-1.4.1 [root @ localhost elasticsearch-cluster] # mv elasticsearch-1.4.1 elasticsearch-node1 # Go to the node configuration path [root @ localhost elasticsearch-cluster] # cd elasticsearch-node1/config/[root @ localhost config] # lselasticsearch. yml logging. yml
2. Create cluster configuration information:
# Elasticsearch-node1 configuration # configure cluster name cluster. name: elasticsearch-cluster-centos # configure the node name node. name: "es-node1" # Set a custom port (9300 by default) transport for communications between nodes. tcp. port: 9300 # Set the custom end for listening for HTTP transmission (9200 by default) http. port: 9200
Elasticsearch configuration file description see: http://blog.csdn.net/an74520/article/details/10175603
3. Install the head plug-in
# Enter the node bin path [root @ localhost bin] # pwd/export/search/elasticsearch-cluster/elasticsearch-node1/bin install plug-in [root @ localhost bin] #. /plugin-install mobz/elasticsearch-head
After the plug-in is installed, a directory named plugins will be created at the same level in the bin path of the es node to store the installed plug-ins.
4. Copy a configured node as a elasticsearch-node2
[root@localhost elasticsearch-cluster]# lselasticsearch-node1 elasticsearch-node2
5. Modify the cluster configuration information in node 2
# Elasticsearch-node2 configuration # configure cluster name cluster. name: elasticsearch-cluster-centos # configure the node name node. name: "es-node2" # Set a custom port (9300 by default) transport for communications between nodes. tcp. port: 9301 # Set the custom end for listening for HTTP transmission (9200 by default) http. port: 9201
Note:
The preceding configuration indicates that the cluster has 2 nodes named "es-node1" and "es-node2", which belong to the cluster "elasticsearch-cluster-centos"
You do not need to configure the port in node 2. elasticsearch checks the port when it is started. If the target port is occupied, elasticsearch checks the next port. because the two nodes are deployed on the VM on the same day to better illustrate the problem, the corresponding port is manually configured here.
You can view the startup information and port binding information from the es log.
6. Start nodes separately
[root@localhost bin]# pwd/export/search/elasticsearch-cluster/elasticsearch-node1/bin[root@localhost bin]# ./elasticsearch -d -Xms512m -Xmx512m
As above, for the command to Start Node 1, es STARTUP configuration related log view elasticsearch-cluster-centos.log.
[root@localhost logs]# pwd/export/search/elasticsearch-cluster/elasticsearch-node2/logs[root@localhost logs]# lselasticsearch-cluster-centos_index_indexing_slowlog.log elasticsearch-cluster-centos.log elasticsearch-cluster-centos_index_search_slowlog.log
7. Now our simple cluster configuration is complete. view the Cluster
Because we have installed the head plug-in, you can use this plug-in to check that the virtual machine ip address is 192.168.1.108.
Http: // 192.168.1.108: 9200/_ plugin/head/(corresponding to node 1) http: // 192.168.1.108: 9201/_ plugin/head/(corresponding to node 2)
Cluster status:
8. Install the Marvel plug-in
Marvel is a management and monitoring tool for Elasticsearch. It is free for development. It is equipped with an interactive console called Sense to facilitate direct interaction with Elasticsearch through a browser.
Marvel is a plug-in. Run the following code in the Elasticsearch directory to download and install it:
./bin/plugin -i elasticsearch/marvel/latest
To disable Marvel, use the following method:
echo 'marvel.agent.enabled: false' >> ./config/elasticsearch.yml
Appendix:Elasticsearch is developed using Java APIs.
Distributed search ElasticSearch cluster creation and simple search instance applications:
Http://www.cnblogs.com/dennisit/p/3346228.html
ElasticSearch search instances contain special characters for highlighting and searching
Http://www.cnblogs.com/dennisit/p/3363851.html
Demonstration of Luence-based distributed search engine ElasticSearch search instance (Java API)
Http://www.cnblogs.com/dennisit/archive/2013/04/08/3008631.html
For more information, see [http://www.cnblogs.com/dennisit/p/4132269.html].