ElasticSearch 6.x集群安装

    xiaoxiao2022-07-13  158

    ES6.x安装过程:

    进入服务器,修改服务器配置:

    sudo vim /etc/sysctl.conf #增加以下内容: vm.max_map_count=262144 #保存退出vim后使sysctl.conf生效: sudo sysctl -p

    sudo vim /etc/security/limits.conf

    work soft nofile 65536 work hard nofile 65536 work soft nproc 65536 work hard nproc 65536  work soft memlock unlimited work hard memlock unlimited

    退出登录服务器,然后重新登录,否则在ES启动时会发现配置未生效。

    下载Elasticsearch安装包,解压,进入目录

    下载插件:

    bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.3.2/elasticsearch-analysis-ik-6.3.2.zip

     

    进入安装包的config目录 

     

    vim elasticsearch.yml

    # ======================== Elasticsearch Configuration Start=========================

    #

    # NOTE: Elasticsearch comes with reasonable defaults for most settings.

    #       Before you set out to tweak and tune the configuration, make sure you

    #       understand what are you trying to accomplish and the consequences.

    #

    # The primary way of configuring a node is via this file. This template lists

    # the most important settings you may want to configure for a production cluster.

    #

    # Please consult the documentation for further information on configuration options:

    # https://www.elastic.co/guide/en/elasticsearch/reference/index.html

    #

    # ---------------------------------- Cluster -----------------------------------

    #

    # Use a descriptive name for your cluster:

    #

    cluster.name: elasticsearch

    #

    # ------------------------------------ Node ------------------------------------

    #

    # Use a descriptive name for the node:

    #

    node.name: ics-prod01

    #

    # Add custom attributes to the node:

    #

    #node.attr.rack: r1

    #

    # ----------------------------------- Paths ------------------------------------

    #

    # Path to directory where to store the data (separate multiple locations by comma):

    #

    path.data: /data/es-6.3.2/data

    #

    # Path to log files:

    #

    path.logs: /data/es-6.3.2/logs

    #

    # ----------------------------------- Memory -----------------------------------

    #

    # Lock the memory on startup:

    #

    bootstrap.memory_lock: true  锁定服务器内存,防止swap

    #

    # Make sure that the heap size is set to about half the memory available

    # on the system and that the owner of the process is allowed to use this

    # limit.

    #

    # Elasticsearch performs poorly when the system is swapping the memory.

    #

    # ---------------------------------- Network -----------------------------------

    #

    # Set the bind address to a specific IP (IPv4 or IPv6):

    #

    network.host: 172.31.12.144

    #

    # Set a custom port for HTTP:

    #

    http.port: 9200

    #

    # For more information, consult the network module documentation.

    #

    # --------------------------------- Discovery ----------------------------------

    #

    # Pass an initial list of hosts to perform discovery when new node is started:

    # The default list of hosts is ["127.0.0.1", "[::1]"]

    #

    discovery.zen.ping.unicast.hosts: ["172.31.12.208", "172.31.12.226"]

    #

    # Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):

    #

    discovery.zen.minimum_master_nodes: 2

    #

    # For more information, consult the zen discovery module documentation.

    #

    # ---------------------------------- Gateway -----------------------------------

    #

    # Block initial recovery after a full cluster restart until N nodes are started:

    #

    gateway.recover_after_nodes: 2

    #

    # For more information, consult the gateway module documentation.

    #

    # ---------------------------------- Various -----------------------------------

    #

    # Require explicit names when deleting indices:

    #

    action.destructive_requires_name: true

    reindex.remote.whitelist: ["172.31.12.127:9200","172.31.12.42:9200"]  此处配置是为了从旧集群迁移数据至本集群,reindex白名单值得是旧es集群的ip

    # ======================== Elasticsearch Configuration  End=========================

     

    vim jvm.options 更改jvm启动项

    -Xms8g

    -Xmx8g

    这两个值由原来的2g变更为8g,值越大越好,但不能超过32g。

    最新回复(0)