ES集群配置

末蓝、 2022-10-13 01:52 282阅读 0赞

ES集群步骤:

1,需要几个ES节点,安装几个ES服务,同一台机器设置对外暴露的Http端口和ES交互的TCP端口需要不一致

2,每个ES服务如下增加ES配置,有中文说明,可自行更改

  1. # ======================== Elasticsearch Configuration =========================
  2. #
  3. # NOTE: Elasticsearch comes with reasonable defaults for most settings.
  4. # Before you set out to tweak and tune the configuration, make sure you
  5. # understand what are you trying to accomplish and the consequences.
  6. #
  7. # The primary way of configuring a node is via this file. This template lists
  8. # the most important settings you may want to configure for a production cluster.
  9. #
  10. # Please consult the documentation for further information on configuration options:
  11. # https://www.elastic.co/guide/en/elasticsearch/reference/index.html
  12. #
  13. # ---------------------------------- Cluster -----------------------------------
  14. #
  15. # Use a descriptive name for your cluster:
  16. # 配置es的集群名称,默认是elasticsearch
  17. cluster.name: test_es
  18. #
  19. # ------------------------------------ Node ------------------------------------
  20. #
  21. # Use a descriptive name for the node:
  22. # 节点名称
  23. node.name: node-2
  24. #
  25. # es是默认集群中的第一台机器为master,如果这台机挂了就会重新选举master。
  26. #
  27. node.master: true
  28. node.data: true
  29. #node.attr.rack: r1
  30. #
  31. # ----------------------------------- Paths ------------------------------------
  32. #
  33. # 设置索引数据的存储路径,默认是es根目录下的data文件夹
  34. #
  35. path.data: 自定义(最好是es目录下新建一个data
  36. #
  37. # 设置日志文件路劲
  38. #
  39. path.logs: 自定义(最好是es目录下新建一个log
  40. #
  41. # ----------------------------------- Memory -----------------------------------
  42. #
  43. # Lock the memory on startup:
  44. #
  45. bootstrap.memory_lock: false
  46. # 是否锁住内存
  47. bootstrap.system_call_filter: false
  48. #
  49. # Make sure that the heap size is set to about half the memory available
  50. # on the system and that the owner of the process is allowed to use this
  51. # limit.
  52. #
  53. # Elasticsearch performs poorly when the system is swapping the memory.
  54. #
  55. # ---------------------------------- Network -----------------------------------
  56. #
  57. # 绑定ip
  58. #
  59. network.host: 机器ip
  60. #
  61. # Set a custom port for HTTP:
  62. # 设置对外服务的http端口
  63. #
  64. http.port: 对外暴漏的端口
  65. # 设置节点间交互的tcp端口 和 http端口不能一致
  66. transport.tcp.port: 自定义
  67. # For more information, consult the network module documentation.
  68. #
  69. # --------------------------------- Discovery ----------------------------------
  70. #
  71. # Pass an initial list of hosts to perform discovery when new node is started:
  72. # The default list of hosts is ["127.0.0.1", "[::1]"]
  73. # 设置集群中master节点的初始列表,可以通过这些节点来自动发现新加入集群的节点
  74. #
  75. discovery.zen.ping.unicast.hosts: [根据实际情况添加格式 "ip:对外暴漏的端口","ip:对外暴漏的端口"]
  76. discovery.zen.ping_timeout: 3s
  77. #
  78. # 设置这个参数来保证集群中的节点可以知道其它N个有master资格的节点
  79. discovery.zen.minimum_master_nodes: 2
  80. #
  81. # For more information, consult the zen discovery module documentation.
  82. #
  83. # ---------------------------------- Gateway -----------------------------------
  84. #
  85. # Block initial recovery after a full cluster restart until N nodes are started:
  86. #
  87. #gateway.recover_after_nodes: 3
  88. #
  89. # For more information, consult the gateway module documentation.
  90. #
  91. # ---------------------------------- Various -----------------------------------
  92. #
  93. # Require explicit names when deleting indices:
  94. #
  95. #action.destructive_requires_name: true

3,启动每个ES的节点后,访问其中一台es服务,带 * 号的是es选举的主节点

http://ip:http端口/_cat/nodes?pretty

watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM2MjA0NzY0_size_16_color_FFFFFF_t_70

4,至此,ES集群搭建完成,如果需要将MYSQL的数据同步到ES中,可以通过小编之前写的通过Logstash以配置文件的形式将mysql数据同步到es中;注: es集群一旦搭建好,只要将mysql的数据同步到其中一个节点,es其他节点会根据副本容错机制,将mysql灌入的es节点数据自动同步到其他节点上。

发表评论

表情:
评论列表 (有 0 条评论,282人围观)

还没有评论,来说两句吧...

相关阅读

    相关 ES高可用配置

    ElasticSearch集群介绍 主节点(或候选主节点) 主节点负责创建索引、删除索引、分配分片、追踪集群中的节点状态等工作, 主节点负荷相对较轻, 客户端请求可以

    相关 ES管理

    转载自 [ES集群管理][ES] 8 集群管理 ES通常以集群方式工作,这样做不仅能够提高 ES的搜索能力还可以处理大数据搜索的能力,同时也增加了系统的容错能力及高可用

    相关 ES配置

    ES集群步骤: 1,需要几个ES节点,安装几个ES服务,同一台机器设置对外暴露的Http端口和ES交互的TCP端口需要不一致 2,每个ES服务如下增加ES配置,有中文说明,

    相关 ES管理

    ES通常以集群方式工作,这样做不仅能够提高 ES的搜索能力还可以处理大数据搜索的能力,同时也增加了系统的 容错能力及高可用,ES可以实现PB级数据的搜索 集群的结构图如下