ElasticSearch学习:7.x 集群配置部署(Windows)

本文主要是在Windows上模拟部署。

准备相关软件

默认大家都安装了JDK了,我用的是7.3.1版本,在官网下载压缩包解压就行了。下载对应版本的kibana用来测试。

相关知识

Elasticsearch里面的重要概念,cluster(集群)和node(节点)。Elasticsearch集群是由一个或者多个节点组成。默认情况Elasticsearch启动完毕后,会生成一个默认名称为"elasticsearch"的集群。集群名字相同的所有节点自动组成一个集群(前提节点间能互相通信,可以设置transport.port绑定端口范围,默认为9300-9400。默认就好)

可以去详细了解https://blog.csdn.net/UbuntuTouch/article/details/99443042

开始配置

新解压两个Elasticsearch,模拟两台es服务器

然后分别进入两个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:
#
# 集群名称
cluster.name: my-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
# 节点名称
node.name: node-1
# 是否是主节点
node.master: true
# 是否存储数据
node.data: 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):
#
# 数据存储路径(默认在elasticsearch根目录下,每个节点的配置的路径不能一样)
#path.data: /path/to/data
#
# Path to log files:
#
# 日志存储路径(默认在elasticsearch根目录下,每个节点的配置的路径不能一样)
#path.logs: /path/to/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
bootstrap.memory_lock: false
#
# 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: 127.0.0.1
#
# 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]"]
# 集群主机列表,多个之间用,隔开(由于是本地模拟,只是端口不一样,所以只有一个ip)
discovery.seed_hosts: ["127.0.0.1"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
# 启动全新的集群时需要此参数,再次重新启动时此参数可免(主节点名称)
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

第二个节点配置

# ======================== 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-2
# 是否是主节点
node.master: false
# 是否存储数据
node.data: 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):
#
# 数据存储路径(默认在elasticsearch根目录下,每个节点的配置的路径不能一样)
#path.data: /path/to/data
#
# Path to log files:
#
# 日志存储路径(默认在elasticsearch根目录下,每个节点的配置的路径不能一样)
#path.logs: /path/to/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
bootstrap.memory_lock: false
#
# 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: 127.0.0.1
#
# Set a custom port for HTTP:
#
http.port: 9202
#
# 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]"]
# 集群主机列表,多个之间用,隔开(由于是本地模拟,只是端口不一样,所以只有一个ip)
discovery.seed_hosts: ["127.0.0.1"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
# 启动全新的集群时需要此参数,再次重新启动时此参数可免(主节点名称)
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

启动看效果

Kibana:GET _cat/nodes?v

Kibana:GET /_cat/health?v

通过JavaAPI添加一个document测试数据用来查询测试

会自动通过主节点node-1添加了一个document,然后回自动同步到node-2上

配置Kibana

参考资料

Elastic:创建Elasticsearch集群并为它们配置TLS安全通信

ElasticSearch 7.4集群部署

https://www.elastic.co/guide/en/elasticsearch/reference/7.x/modules-transport.html

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Elasticsearch是一个开源的分布式搜索和分析引擎,用于处理大规模数据的实时搜索和分析。Kubernetes(简称K8S)是一个用于自动化部署、扩展和管理容器化应用程序的开源平台。 要在Kubernetes部署Elasticsearch 8.x集群,可以按照以下步骤进行操作: 1. 创建Kubernetes集群:首先,需要在Kubernetes上创建一个可用的集群。可以使用云服务提供商(如AWS、Azure、GCP)或自己搭建的Kubernetes集群。 2. 安装Elasticsearch Operator:Elasticsearch Operator是一个Kubernetes控制器,用于管理Elasticsearch集群的生命周期。可以通过在Kubernetes上安装Elasticsearch Operator来简化集群的管理。 3. 创建Elasticsearch集群配置:使用Elasticsearch Operator创建一个Elasticsearch集群配置文件。配置文件中包含了集群的规模、存储需求、网络设置等信息。 4. 部署Elasticsearch集群:使用kubectl命令或Kubernetes Dashboard将Elasticsearch集群配置文件部署到Kubernetes集群中。Kubernetes会自动创建和管理Elasticsearch节点的Pod。 5. 配置Elasticsearch集群:根据需求,可以配置Elasticsearch集群的参数,如节点数量、副本数、内存和存储资源等。 6. 监控和日志收集:为了监控和管理Elasticsearch集群,可以使用Kubernetes提供的监控和日志收集工具,如Prometheus、Grafana和Elasticsearch自带的监控插件。 7. 高可用性和扩展性:为了实现高可用性和扩展性,可以使用Kubernetes的特性,如水平扩展、自动伸缩和故障转移等。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值