Getting Started with ElasticSearch - Cluster Construction

1. Environment introduction and installation preparation

    1. Environmental description

        2 virtual machines, the OS is ubuntu13.04, and the IPs are xxx.xxx.xxx.140 and xxx.xxx.xxx.145 respectively.

    2. Installation preparation

        ElasticSearch (ES for short) is implemented by the java language, and the operating environment depends on java. ES 1.x version, the official recommendation to use at least jdk1.6 environment, it is recommended to use oracle java, you can go to the official website to download , this article uses jdk-7u51-linux-i586.gz . ES can be downloaded from the official website or here . This article uses elasticsearch-1.0.1.tar.gz. 

2. Installation

    1. Install JAVA

        For the installation of java, please refer to here .

    2. ES installation

        (1) Unzip elasticsearch-1.0.1.tar.gz, sudo tar -zvxf elasticsearch-1.0.1.tar.gz, generate a directory in the current path: elasticsearch-1.0.1; make a soft link ln -s for this directory  elasticsearch-1.0.1 elasticsearch. After completion, the directory structure is as follows:

        (2) Configure es. Only the simplest configuration is done here. Modify the ES_HOME/config/elasticsearch.yml file and set the value of node.name to "test-node1", indicating that the current es service node name is test-node1.            

        (3) Start ES. Enter the ES installation directory, execute the command: bin/elasticsearch -d -Xms512m -Xmx512m, and then enter http://ip:9200/ in the browser to check the page information to see if it starts normally. status=200 means that it started normally, and there is some version information of es, and name is the value of node.name in the configuration file.

        (4) On another machine, install the same steps to install ES, because at least 2 services are considered a cluster! Note that when configuring, set the value of node.name to test-node2, which must be different from the previous configuration value.

        The two es services start up at the same time, because the configuration file defaults to cluster.name=elasticsearch, so the two machines are automatically built into a cluster, and the cluster name is elasticsearch.

    3, elasticsearchservicewrapper installation

       This is a packaging service that executes commands on elasticsearch. After installation, it is convenient to start, stop, etc. of elasticsearch.

      (1) Download elasticsearchservicewrapper

                git clone https://github.com/elasticsearch/elasticsearch-servicewrapper , and then copy the service directory under the directory to the ES_HOME/bin directory.

      (2) Simple configuration of jvm memory

                Modify ES_HOME/bin/service/elasticsearch.conf, set.default.ES_HEAP_SIZE=1024, this value can be customized according to the configuration of the machine.

      (3) Install and start the service

                Execute the command: ES_HOME/bin/service/elasticsearch install

      (4) Start/stop/restart the service

               Execute the command: ES_HOME/bin/service/elasticsearch start/stop/restart

   4. Plug-in installation

         After the cluster is successfully installed, you need to check the index data, operation status and other information in the cluster. Some plug-ins need to be installed for the index, and follow-up work is required. If you want to do good work, you must first sharpen your tools. Here are a few useful plug-ins:

        (1)head

        Like the name of the plug-in, this plug-in is the first to be recommended. Through head, you can view almost all information about the cluster, perform simple search queries, observe automatic recovery, and more.

        Execute the following command to start the installation: sudo elasticsearch/bin/plugin -install mobz/elasticsearch-head

        Remember to install it on both machines. After the installation is complete, enter: http://ip:9200/_plugin/head/ in the browser to view the display effect. As shown below:

cluster health:green (2, 20) : Indicates that the cluster is currently in a healthy state, the cluster contains 2 machines, and the index has a total of 20 shards. The thick green box represents the primary shard, and the thin green box represents the backup shard.

         There are many functions, please experience the readers themselves.

        (2)bigdesk

        bigdesk is a cluster monitoring plug-in, through which you can view the resource consumption of the entire cluster, cpu, memory, http links, etc.

        Execute the command to install: sudo elasticsearch/bin/plugin -install lukas-vlcek/bigdesk       

        After the installation is complete, enter: http://ip:9200/_plugin/bigdesk/#nodes in the browser, the display interface is as follows:

        Click the test-node1 node to view the resource usage of a single node, including JVM, Thread Pools, OS, Process, HTTP&Transport, Indice, and File system.

        There are a lot of plug-ins for ES, please refer to ES Plug-in Encyclopedia .

 

References:

Distributed search elasticsearch cluster management tool head

Distributed search elasticsearch cluster monitoring tool bigdesk

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326262611&siteId=291194637