es集群安装 向右看齐 2022-11-16 04:51 183阅读 0赞 **\]官网下载es** https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.12.0-linux-x86_64.tar.gz **集群环境机器准备** <table> <tbody> <tr> <td style="width:273px;">ip</td> <td style="width:339px;"><strong>监听端口</strong></td> <td>主机名</td> <td>系统</td> <td>es实例名</td> <td>es版本</td> </tr> <tr> <td style="width:273px;">10.10.164.1</td> <td style="width:339px;">9200/9300</td> <td>elsearch</td> <td>Centos6</td> <td>node-1</td> <td>7.12.0</td> </tr> <tr> <td style="width:273px;">10.10.164.2</td> <td style="width:339px;">9200/9300</td> <td>elsearch</td> <td>Centos6</td> <td>node-2</td> <td>7.12.0</td> </tr> <tr> <td style="width:273px;">10.10.164.3</td> <td style="width:339px;">9200/9300</td> <td>elsearch</td> <td>Centos6</td> <td>node-3</td> <td>7.12.0</td> </tr> </tbody> </table> 每一台服务器都需要操作。 在/opt下创建es 把下载好后把安装包放入 cd /opt #创建es目录 mkdir es cd es #下载安装包 wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.12.0-linux-x86_64.tar.gz #解压 tar -vxf elasticsearch-7.12.0-linux-x86_64.tar.gz #修改解压后的文件名为 elasticsearch-a,(为了方便区分根据节点名) mv elasticsearch-7.4.0 elasticsearch-1 # 创建数据存储目录 mkdir -p /opt/es/elasticsearch-a/data # 创建日志存储目录 mkdir -p /opt/es/elasticsearch-a/logs #注:这里为了区分是es的多个节点, #第1台的目录文件夹为 elasticsearch-1 #第2台的目录文件夹为 elasticsearch-2 #第3台的目录文件夹为 elasticsearch-3 ## 节点node-1配置 ## 进入到es安装目录下的config文件夹中,修改elasticsearch.yml 文件 # ======================== 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: # #配置es的集群名称,同一个集群中的多个节点使用相同的标识 #如果在同一网段下有多个集群,就可以用这个属性来区分不同的集群。 cluster.name: my-cluster # # ------------------------------------ Node ------------------------------------ # # Use a descriptive name for the node: # #节点名称 node.name: node-1 #是不是有资格竞选主节点 node.master: true # # 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: /opt/es/data # # Path to log files: # #日志存储路径 path.logs: /opt/es/logs # # ----------------------------------- Memory ----------------------------------- # # Lock the memory on startup: # #ES默认开启了内存地址锁定,为了避免内存交换提高性能。但是Centos6不支持SecComp功能,启动会报错,所以需要将其设置为false #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 ----------------------------------- # # By default Elasticsearch is only accessible on localhost. Set a different # address here to expose this node on the network: # #节点所绑定的IP地址,并且该节点会被通知到集群中的其他节点 #通过指定相同网段的其他节点会加入该集群中 0.0.0.0任意IP都可以访问elasticsearch network.host: 10.10.164.1 bootstrap.system_call_filter: false # # By default Elasticsearch listens for HTTP traffic on the first free port it # finds starting at 9200. Set a specific HTTP port here: # #作为数据节点 node.data: true #对外提供服务的http端口,默认为9200 http.port: 9200 # 是否支持跨域 http.cors.enabled: true # *表示支持所有域名 http.cors.allow-origin: "*" #内部节点之间沟通端口 transport.tcp.port: 9300 #设置是否压缩TCP传输时的数据,默认为false transport.tcp.compress: true #network.publish_host:10.10.164.1 cluster.routing.allocation.disk.threshold_enabled: false # # 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]"] # #es7.x 之后新增的配置,写入候选主节点的设备地址,在开启服务后可以被选为主节点 discovery.seed_hosts: ["10.10.164.1:9300", "10.10.164.2:9300","10.10.164.3:9300"] # # Bootstrap the cluster using an initial set of master-eligible nodes: # #es7.x 之后新增的配置,初始化一个新的集群时需要此配置来选举master cluster.initial_master_nodes: ["node-1", "node-2","node-3"] # # For more information, consult the discovery and cluster formation module documentation. # # ---------------------------------- Various ----------------------------------- # # Require explicit names when deleting indices: # #action.destructive_requires_name: true ## 节点node-2配置 ## # ======================== 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: # #配置es的集群名称,同一个集群中的多个节点使用相同的标识 #如果在同一网段下有多个集群,就可以用这个属性来区分不同的集群。 cluster.name: my-cluster # # ------------------------------------ Node ------------------------------------ # # Use a descriptive name for the node: # #节点名称 node.name: node-2 #是不是有资格竞选主节点 node.master: true # # 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: /opt/es/data # # Path to log files: # #日志存储路径 path.logs: /opt/es/logs # # ----------------------------------- Memory ----------------------------------- # # Lock the memory on startup: # #ES默认开启了内存地址锁定,为了避免内存交换提高性能。但是Centos6不支持SecComp功能,启动会报错,所以需要将其设置为false #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 ----------------------------------- # # By default Elasticsearch is only accessible on localhost. Set a different # address here to expose this node on the network: # #节点所绑定的IP地址,并且该节点会被通知到集群中的其他节点 #通过指定相同网段的其他节点会加入该集群中 0.0.0.0任意IP都可以访问elasticsearch network.host: 10.10.164.2 bootstrap.system_call_filter: false # # By default Elasticsearch listens for HTTP traffic on the first free port it # finds starting at 9200. Set a specific HTTP port here: # #作为数据节点 node.data: true #对外提供服务的http端口,默认为9200 http.port: 9200 # 是否支持跨域 http.cors.enabled: true # *表示支持所有域名 http.cors.allow-origin: "*" #内部节点之间沟通端口 transport.tcp.port: 9300 #设置是否压缩TCP传输时的数据,默认为false transport.tcp.compress: true #network.publish_host:10.10.164.2 cluster.routing.allocation.disk.threshold_enabled: false # # 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]"] # #es7.x 之后新增的配置,写入候选主节点的设备地址,在开启服务后可以被选为主节点 discovery.seed_hosts: ["10.10.164.1:9300", "10.10.164.2:9300","10.10.164.3:9300"] # # Bootstrap the cluster using an initial set of master-eligible nodes: # #es7.x 之后新增的配置,初始化一个新的集群时需要此配置来选举master cluster.initial_master_nodes: ["node-1", "node-2","node-3"] # # For more information, consult the discovery and cluster formation module documentation. # # ---------------------------------- Various ----------------------------------- # # Require explicit names when deleting indices: # #action.destructive_requires_name: true ## 节点node-3配置 ## # ======================== 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: # #配置es的集群名称,同一个集群中的多个节点使用相同的标识 #如果在同一网段下有多个集群,就可以用这个属性来区分不同的集群。 cluster.name: my-cluster # # ------------------------------------ Node ------------------------------------ # # Use a descriptive name for the node: # #节点名称 node.name: node-3 #是不是有资格竞选主节点 node.master: true # # 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: /opt/es/data # # Path to log files: # #日志存储路径 path.logs: /opt/es/logs # # ----------------------------------- Memory ----------------------------------- # # Lock the memory on startup: # #ES默认开启了内存地址锁定,为了避免内存交换提高性能。但是Centos6不支持SecComp功能,启动会报错,所以需要将其设置为false #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 ----------------------------------- # # By default Elasticsearch is only accessible on localhost. Set a different # address here to expose this node on the network: # #节点所绑定的IP地址,并且该节点会被通知到集群中的其他节点 #通过指定相同网段的其他节点会加入该集群中 0.0.0.0任意IP都可以访问elasticsearch network.host: 10.10.164.3 bootstrap.system_call_filter: false # # By default Elasticsearch listens for HTTP traffic on the first free port it # finds starting at 9200. Set a specific HTTP port here: # #作为数据节点 node.data: true #对外提供服务的http端口,默认为9200 http.port: 9200 # 是否支持跨域 http.cors.enabled: true # *表示支持所有域名 http.cors.allow-origin: "*" #内部节点之间沟通端口 transport.tcp.port: 9300 #设置是否压缩TCP传输时的数据,默认为false transport.tcp.compress: true #network.publish_host:10.10.164.3 cluster.routing.allocation.disk.threshold_enabled: false # # 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]"] # #es7.x 之后新增的配置,写入候选主节点的设备地址,在开启服务后可以被选为主节点 discovery.seed_hosts: ["10.10.164.1:9300", "10.10.164.2:9300","10.10.164.3:9300"] # # Bootstrap the cluster using an initial set of master-eligible nodes: # #es7.x 之后新增的配置,初始化一个新的集群时需要此配置来选举master cluster.initial_master_nodes: ["node-1", "node-2","node-3"] # # For more information, consult the discovery and cluster formation module documentation. # # ---------------------------------- Various ----------------------------------- # # Require explicit names when deleting indices: # #action.destructive_requires_name: true ## 启动用户与赋权 ## groupadd elsearch useradd elsearch -g elsearch -p elasticsearch #useradd [user name] -g [group name] -p [password] chown -R elsearch:elsearch elasticsearch #chown -R [user name:group name] 该用户所分配有权限的目录 su elsearch #切换账户 cd elasticsearch/bin #进入你的elasticsearch目录下的bin目录 ./elasticsearch ElasticSearch后台启动命令 ./elasticsearch -d 查看后台命令是否启动成功 ps aux|grep elasticsearch 同启动1节点一致,分别再次启动 2节点、3节点 ### 查看集群状态 ### 查看集群节点 [http://IP:9200/\_cat/nodes?v][http_IP_9200_cat_nodes_v] ![20210406131823306.png][] 查看集群状态 [http://IP:9201/\_cluster/stats?pretty][http_IP_9201_cluster_stats_pretty] ![2021040613140890.png][] ### **安装遇到的问题** ### [https://blog.csdn.net/qq\_39313596/article/details/107513482?ops\_request\_misc=%257B%2522request%255Fid%2522%253A%2522161768618216780255218764%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request\_id=161768618216780255218764&biz\_id=0&utm\_medium=distribute.pc\_search\_result.none-task-blog-2~all~baidu\_landing\_v2~default-1-107513482.first\_rank\_v2\_pc\_rank\_v29&utm\_term=es+hlvy][https_blog.csdn.net_qq_39313596_article_details_107513482_ops_request_misc_257B_2522request_255Fid_2522_253A_2522161768618216780255218764_2522_252C_2522scm_2522_253A_252220140713.130102334.._2522_257D_request_id_161768618216780255218764_biz_id_0_utm_medium_distribute.pc_search_result.none-task-blog-2_all_baidu_landing_v2_default-1-107513482.first_rank_v2_pc_rank_v29_utm_term_es_hlvy] ### JVM设置官网 ### [https://www.elastic.co/guide/en/elasticsearch/reference/current/jvm-options.html][https_www.elastic.co_guide_en_elasticsearch_reference_current_jvm-options.html] [http_IP_9200_cat_nodes_v]: http://10.15.153.116:9200/_cat/nodes?v [20210406131823306.png]: /images/20221022/042eb36484e743f3b1a2425e68780a61.png [http_IP_9201_cluster_stats_pretty]: http://IP:9201/_cluster/stats?pretty [2021040613140890.png]: /images/20221022/665e6383f85a4abb856d412503fe53f7.png [https_blog.csdn.net_qq_39313596_article_details_107513482_ops_request_misc_257B_2522request_255Fid_2522_253A_2522161768618216780255218764_2522_252C_2522scm_2522_253A_252220140713.130102334.._2522_257D_request_id_161768618216780255218764_biz_id_0_utm_medium_distribute.pc_search_result.none-task-blog-2_all_baidu_landing_v2_default-1-107513482.first_rank_v2_pc_rank_v29_utm_term_es_hlvy]: https://blog.csdn.net/qq_39313596/article/details/107513482?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522161768618216780255218764%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=161768618216780255218764&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~baidu_landing_v2~default-1-107513482.first_rank_v2_pc_rank_v29&utm_term=es+hlvy [https_www.elastic.co_guide_en_elasticsearch_reference_current_jvm-options.html]: https://www.elastic.co/guide/en/elasticsearch/reference/current/jvm-options.html
相关 es 7.6 集群三节点安装 os: centos 7.4.1708 es: 7.6.2 三节点的es 192.168.56.121 n1 192.168.56.122 n2 ╰半橙微兮°/ 2023年02月09日 13:24/ 0 赞/ 145 阅读
相关 ES集群(二)spring-data集成es集群 一、准备工作: 现有如下集群: <table> <tbody> <tr> <td> <p>服务器名称</p> </td> <td> <p>IP地址 小咪咪/ 2022年12月20日 06:00/ 0 赞/ 219 阅读
相关 ES集群管理 转载自 [ES集群管理][ES] 8 集群管理 ES通常以集群方式工作,这样做不仅能够提高 ES的搜索能力还可以处理大数据搜索的能力,同时也增加了系统的容错能力及高可用 Myth丶恋晨/ 2022年12月04日 02:26/ 0 赞/ 201 阅读
相关 es集群安装 \]官网下载es https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.12.0- 向右看齐/ 2022年11月16日 04:51/ 0 赞/ 184 阅读
相关 ES集群规划 目录 (1)ES内存设置 (2)单节点分片数量 (3)主节点设置 (1)ES内存设置 因为ES是非常消耗内存的,所以规划的 布满荆棘的人生/ 2022年11月04日 08:03/ 0 赞/ 230 阅读
相关 ES集群配置 ES集群步骤: 1,需要几个ES节点,安装几个ES服务,同一台机器设置对外暴露的Http端口和ES交互的TCP端口需要不一致 2,每个ES服务如下增加ES配置,有中文说明, 末蓝、/ 2022年10月13日 01:52/ 0 赞/ 193 阅读
相关 ES集群安装 暂时记录,后期有时间整理 1. 集群各节点安装java JAVA_HOME=/usr/local/jdk1.8.0_181 CLASSPATH=.:$JA 谁践踏了优雅/ 2022年08月28日 06:49/ 0 赞/ 176 阅读
相关 ES集群管理 ES通常以集群方式工作,这样做不仅能够提高 ES的搜索能力还可以处理大数据搜索的能力,同时也增加了系统的 容错能力及高可用,ES可以实现PB级数据的搜索 集群的结构图如下 悠悠/ 2022年04月10日 12:21/ 0 赞/ 285 阅读
相关 ES集群 官方网址: [https://www.elastic.co/guide/en/elasticsearch/reference/current/getting-started 迈不过友情╰/ 2022年04月02日 18:08/ 0 赞/ 269 阅读
相关 ES集群安装 环境配置 安装openjdk(依赖) yum -y install java-1.8.0-openjdk.x86_64 安装elasticsearch Bertha 。/ 2021年12月14日 09:25/ 0 赞/ 276 阅读
还没有评论,来说两句吧...