ElasticSearch cluster creation instance
I started to research and search, and set up a simple ElasticSearch search cluster on my own virtual machine. I hope it will be helpful.
Operating System Environment: Red Hat 4.8.2-16
Elasticsearch: elasticsearch-1.4.1
Cluster Construction Method: two nodes on one virtual machine.
Cluster Storage path:/export/search/elasticsearch-cluster
Required environment: 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 and decompress the package
[Root @ localhost elasticsearch-cluster] # ls
Elasticsearch-1.4.1
[Root @ localhost elasticsearch-cluster] # Music elasticsearch-1.4.1 elasticsearch-node1
# Go to the node configuration path
[Root @ localhost elasticsearch-cluster] # cd elasticsearch-node1/config/
[Root @ localhost config] # ls
Elasticsearch. yml logging. yml
2. Create cluster configuration information:
# Elasticsearch-node1 Configuration
# Configure the cluster name
Cluster. name: elasticsearch-cluster-CentOS
# Configure the node name
Node. name: "es-node1"
# Set a custom port for communications between nodes (9300 by default)
Transport. tcp. port: 9300
# Set the custom end for listening to HTTP transmission (9200 by default)
Http. port: 9200
For details about the elasticsearch configuration file, see:
3. Install the head plug-in
# Enter the bin path of the node
[Root @ localhost bin] # pwd
/Export/search/elasticsearch-cluster/elasticsearch-node1/bin.
Install plug-ins
[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] # ls
Elasticsearch-node1 elasticsearch-node2
5. Modify the cluster configuration information in node 2
# Elasticsearch-node2 Configuration
# Configure the cluster name
Cluster. name: elasticsearch-cluster-centos
# Configure the node name
Node. name: "es-node2"
# Set a custom port for communications between nodes (9300 by default)
Transport. tcp. port: 9301
# Set the custom end for listening to 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] # ls
Elasticsearch-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
Elasticsearch installation and usage tutorial
Build a standalone and server environment for distributed search ElasticSearch
Working Mechanism of ElasticSearch
ElasticSearch details: click here
ElasticSearch: click here
This article permanently updates the link address: