搭建ElasticSearch集群

ElasticSearch简介

ElasticSearch是一个可高度扩展的开源数据存储、全文检索和数据分析的引擎,主要用于实现复杂搜索功能和数据分析需求的应用程序的底层引擎。
ElasticSearch是一个近实时(Near Real Time)的数据搜索和分析平台。从构建索引文档到可搜索文档会有一段微小的延迟,通常是1s以内。

典型应用场景

1.站内产品搜索
电商平台上,可以使用elasticsearch来存储整个产品目录和库存,并为他们提供搜索和搜索词自定补全功能,允许客户搜索平台上销售的产品。
2. 收集并分析日志数据
可以使用Logstash(Elastic Static的一个组件)来收集、聚合和分析日志或事务数据,发现数据中隐藏的趋势、统计特性等。
3.海量商业数据可视化
如果想对TB甚至PB级的商业数据进行快速研究、分析、可视化并提出特定问题,可以使用ElasticSearch集群来存储数据,然后使用Kibana(Elastic Stack的一个组件)来构建自定义仪表盘(dashboard),可视化重要的数据维度。

构建集群

构建集群用到的Linux系统及IP,其中节点node-1和node-2分别位于win10系统内的两台CentOS7虚拟机(VMware构建),node-3所在的Ubuntu系统是单独的一台电脑。

系统构建类型节点名称IP
CentOS7.9.2009tarnode-1192.168.2.130
CentOS7.9.2009dockernode-2192.169.2.133
Ubuntu20.04.2dockernode-3192.168.2.204

node-1

该节点使用ElasticSearch Linux系统安装包安装,
在这里插入图片描述
配置文件elasticsearch.yml如下:

---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: my-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-1
#
---------------------------------- Network -----------------------------------
#
# By default Elasticsearch is only accessible on localhost. Set a different
# address here to expose this node on the network:
#
network.host: 192.168.2.130
#
# By default Elasticsearch listens for HTTP traffic on the first free port it
# finds starting at 9200. Set a specific HTTP port here:
#
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: ["192.168.2.130", "192.168.2.133","192.168.2.204"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
cluster.initial_master_nodes: ["node-1","node-2","node-3"]
#
# For more information, consult the discovery and cluster formation module documentation.
#配置允许跨域访问,否则elasticsearch-head无法访问集群信息
http.cors.enabled: true
http.cors.allow-origin: "*"

node-2

cluster.name: my-application
node.name: node-2
network.host: 0.0.0.0
network.publish_host: 192.168.2.133
http.port: 9200
discovery.seed_hosts: ["192.168.2.130","192.168.2.133","192.168.2.204"]
cluster.initial_master_nodes: ["192.168.2.130","192.168.2.133","192.168.2.204"]

node-3

cluster.name: my-application
node.name: node-3
network.host: 0.0.0.0
network.publish_host: 192.168.2.204
http.port: 9200
discovery.seed_hosts: ["192.168.2.130","192.168.2.133","192.168.2.204"]
cluster.initial_master_nodes: ["192.168.2.130","192.168.2.133","192.168.2.204"]
#Ubuntu20.04.2 需要增加如下配置,xpack.ml.enabled设置为false禁用X-Pack机器学习功能,否则启动失败
xpack.ml.enabled: false

Elasticsearch-head查看集群信息

elasticsearch-head 安装在win10系统上,连接集群主节点node-1,只有该节点配置了允许ajax跨域访问,
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值