zoukankan      html  css  js  c++  java
  • Elasticsearch安装

    一:下载Elasticsearch安装包并解压

    二:进入解压后的elasticsearch目录:

    1:新建data目录:mkdir data

    2:修改config/elasticsearch.yml

    三:后台启动:./bin/elasticsearch -d

    Elasticsearch集群用配置文件关联:以三台为例;配置集群只需要更改配置文件中:节点名称,ip地址两个参数

    # 注:Elasticserch7.0开始,当一半以上的候选主节点永久丢失,集群将不会自动恢复。
    # 在添加或删除节点时,Elasticsearch会自动的通过更新集群的投票配置(voting configuration)来维持最佳的容错级别。
    #voting configuration是一组当前可以参与投票的的候选主节点。通常,voting configurations包含集群中所有符合条件的候选主节点。
    #所有集群状态的更新都需要有voting configurations中一半以上的节点同意。
    # 集群名称
    cluster.name: ******
    # 节点名称
    node.name: node-a-1
    # 网络连接地址
    network.host: -----ip-------
    # 端口
    http.port: 9500
    # 跨域访问,elasticsearch-head提供检测
    http.cors.enabled: true
    http.cors.allow-origin: "*"
    http.max_content_length: 200mb
    #集群通信端口
    transport.tcp.port: 9400
    #不运行Macos下的es(内部应该有运行xpack)
    xpack.ml.enabled: false
    #集群中主节点最少设置3个及以上
    # 是否设置主节点,默认为true
    node.master: true
    # 是否允许节点存储数据,默认为true
    node.data: true
    # 为了避免脑裂,集群节点数最少为 半数(N/2)+1
    discovery.zen.minimum_master_nodes: 2
    # 7.x版本后,需要注意(cluster.initial_master_nodes,discovery.seed_hosts)
    # 从7.0版本开始,如果要启动在多个物理主机上启动一个全新的集群,必须指定参与第一次投票选举的候选主节点。这个过程称为集群启动引导,仅在集群第一次启动时才需要。
    # cluster.initial_master_nodes 参数设置一系列符合主节点条件的节点的主机名或IP地址来引导启动集群。
    # 注:如果不是候选主节点,则不需要配置此项
    cluster.initial_master_nodes: ["node-a-1", "node-a-2", "node-a-3"]
    #发现子系统的相关配置以便节点可以互相发现
    #自动发现设置,配置之后集群的主机之间可以自动发现
    discovery.seed_hosts: ["172.16.70.195:9400", "172.16.70.196:9401", "172.16.70.200:9402"]
    #基于文件的自动发现设置,配置之后集群的主机之间可以自动发现。
    #discovery.seed_providers对应旧版中的discovery.zen.hosts_provider
    #discovery.seed_providers: 文件
    #一旦你点击3个节点,倒计时时钟开始,然后集群将在5分钟内恢复(默认值)或者如果你点击5个节点.基本上它允许您设置最小阈值(recovery_after_nodes),
    #并使用超时(recovery_after_time)等待所需的状态(expected_nodes).命中recovery_after_nodes后,或者当命中expected_nodes(无需额外等待)时,
    #您将恢复recovery_after_time – 以先到者为准.
    gateway.recover_after_nodes: 3
    gateway.expected_nodes: 5
    # 网络参数配置
    network.tcp.keep_alive: true
    network.tcp.no_delay: true
    #设置是否压缩tcp传输时的数据,默认为false,不压缩。
    transport.tcp.compress: true
    #集群内同时启动的数据任务个数,默认是2个
    cluster.routing.allocation.cluster_concurrent_rebalance: 16
    #添加或删除节点及负载均衡时并发恢复的线程个数,默认4个
    cluster.routing.allocation.node_concurrent_recoveries: 16
    #初始化数据恢复时,并发恢复线程的个数,默认4个
    cluster.routing.allocation.node_initial_primaries_recoveries: 16
    # 索引数据存放的位置
    path.data: /opt/cmh/elasticsearch/data
    # 日志文件存放的位置
    path.logs: /opt/cmh/elasticsearch/logs

     单机版

    # ======================== Elasticsearch Configuration =========================
    #
    # 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: my-application
    #
    # ------------------------------------ Node ------------------------------------
    #
    # Use a descriptive name for the node:
    #
    #node.name: node-1
    node.name: node-1
    #
    # 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: /newdisk/es7/dbdata
    #
    # Path to log files:
    #
    path.logs: /newdisk/es7/dblogs
    #
    # ----------------------------------- Memory -----------------------------------
    #
    # Lock the memory on startup:
    #
    #bootstrap.memory_lock: true
    #
    # 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: 192.168.0.1
    network.host: 0.0.0.0
    network.publish_host: 120.120.120.120//这里是你的服务器IP
    #
    # 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 this node is started:
    # The default list of hosts is ["127.0.0.1", "[::1]"]
    #
    #discovery.seed_hosts: ["host1", "host2"]
    #
    # Bootstrap the cluster using an initial set of master-eligible nodes:
    #
    node.master: true
    node.data: true
    #cluster.initial_master_nodes: ["node-1", "node-2"]
    cluster.initial_master_nodes: ["node-1"]
    #
    # For more information, consult the discovery and cluster formation module documentation.
    #
    # ---------------------------------- Gateway -----------------------------------
    #
    # Block initial recovery after a full cluster restart until N nodes are started:
    #
    #gateway.recover_after_nodes: 3
    #
    # For more information, consult the gateway module documentation.
    #
    # ---------------------------------- Various -----------------------------------
    #
    # Require explicit names when deleting indices:
    #
    #action.destructive_requires_name: true
    http.cors.enabled: true
    http.cors.allow-origin: "*"
  • 相关阅读:
    Android 懒加载简单介绍
    Android 使用RxJava实现一个发布/订阅事件总线
    Android 第三方库RxLifecycle使用
    Android 使用Retrofit2.0+OkHttp3.0实现缓存处理+Cookie持久化第三方库
    代码雨
    我的第一个博客(My first blog)
    merge法
    如何使用git将remote master上的内容merge 到自己的开发分支上  &  以及将自己分支的内容merge到remote master上...
    git 解决冲突
    Mac安装和破解激活Charles
  • 原文地址:https://www.cnblogs.com/zhangrongfei/p/14734319.html
Copyright © 2011-2022 走看看