美文网首页数客联盟
Install ES cluster

Install ES cluster

作者: 纯真的大饼饼 | 来源:发表于2017-05-19 17:35 被阅读6次

    Install ES cluster steps

    • Install the Java and make sure the java -version worked well
    rpm -ivh jdk-8u77-linux-x64.rpm
    
    • Create the user on the cluster nodes
    groupadd elasticsearch  
    useradd elasticsearch -g elasticsearch -p passw0rd 
    passwd elasticsearch
    
    • Create folder for es log and data folder
    mkdir -p /data/lib/elasticsearch/data
    mkdir -p /data/log/elasticsearch
    
    • Change the owner for es log and data folder
    chown -R elasticsearch:elasticsearch /data/lib
    chown -R elasticsearch:elasticsearch /data/log
    
    • Change the system limits
    vim /etc/security/limits.conf
    
    • Add following code in the limits.conf
    *  soft nofile 65535
    *  hard nofile 65535
    *  soft nproc  65535
    *  hard nproc  65535
    

    NOTE: If you want to set the specific user, you can change the * to the user

    • Install the elasticsearch
    rpm -ivh elasticsearch-2.3.5.rpm
    
    • Configure the elasticsearch.yml file
    vim /etc/elasticsearch/elasticsearch.yml
    
    • Add following configuration in to the elasticsearch.yml
    cluster.name: ockb-es-cluster
    node.name: es-node-1
    http.port: 9225
    
    network.host: [host1, _local_]
    discovery.zen.ping.unicast.hosts: ["host1", "host2", "host2"]
    
    path.data: /data/lib/elasticsearch/data
    path.logs: /data/log/elasticsearch
    

    NOTE: node.name should be unique for every cluster node

    • Configure the /etc/sysconfig/elasticsearch file
    vim /etc/sysconfig/elasticsearch
    
    • Add following configuration in to the /etc/sysconfig/elasticsearch
    ES_HOME=/usr/share/elasticsearch
    CONF_DIR=/etc/elasticsearch
    DATA_DIR=/data/lib/elasticsearch/data
    LOG_DIR=/data/log/elasticsearch
    PID_DIR=/var/run/elasticsearch
    ES_USER=elasticsearch
    ES_GROUP=elasticsearch
    
    • Start the elasticsearch cluster
    service elasticsearch start
    
    • Check the elasticsearch worked well
    curl -XGET 'http://localhost:9225/_cat/health?pretty'
    
    • The default replicas is 1, if you want to change the replicas number you can chagne it through REST API
    curl -XPUT 'http://localhost:9225/_settings?pretty' -d '{ "number_of_replicas" : node number - 1 }'
    

    Install elasticsearch plugins

    • Here use head plugin as an example

    I used elasticsearch 2.3.5 so use following command to install the plugin

    /usr/share/elasticsearch/bin install mobz/elasticsearch-head
    
    • After installed successfully

    • Restart the elasticsearch

    • The access the URL: http://<elasticsearch server>:9225/_plugin/head/

    相关文章

      网友评论

        本文标题:Install ES cluster

        本文链接:https://www.haomeiwen.com/subject/nenyxxtx.html