ES集群安装教程

简介: ES集群安装教程

引言


最近项目需要部署ES教程,所以至此记录安装过程,本教程使用的es版本为6.0.1,并且在同一台机器上搭建三个节点的伪集群。


ES 集群至少部署 3 个节点,确保至少存在两个主节点保证数据可靠性。部署完一个节点后,把部署目录拷贝到其他节点,修改配置后就可以完成部署。


教程开始==================


1、下载需要的安装包

[root@jack soft]#  wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.0.1.tar.gz


2、解压


tar -zxvf elasticsearch-6.0.1.tar.gz


3、在安装目录下面建立文件夹elasticsearch-6.0.1,然后创建第一个节点。


mv elasticsearch-6.0.1.tar.gz /data/app/elasticsearch-6.0.1/es1


4、修改配置文件


vim /data/app/elasticsearch-6.0.1/es1/config/elasticsearch.yml


需要修改的配置如下:


   1、cluster.name: call-search  //集群名称,建议 修改为有意义的名称, 不同的节点该名称需要保持一致。


   2、node.name: node-1  //节点名称 每个节点名称不一致


   3、path.data: /data/app/elasticsearch-6.0.1/es1  //数据存放路径


   4、path.logs: /data/logs/elasticsearch/es1  //日志存放路径


   5、network.host: 172.21.64.17  // 服务器的内网地址


   6、http.port: 9201  //对外通讯端口


   7、transport.tcp.port: 9301 //集群内部通讯端口


   8、discovery.zen.ping.unicast.hosts: ["172.21.64.17:9301", "172.21.64.17:9302","172.21.64.17:9303"]  //集群配置


   9、discovery.zen.minimum_master_nodes: 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:
#
cluster.name: call-search
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
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: /data/app/elasticsearch-6.0.1/es1
#
# Path to log files:
#
path.logs: /data/logs/elasticsearch/es1
#
# ----------------------------------- 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: 123.321.45.6
#
# Set a custom port for HTTP:
#
http.port: 9201
transport.tcp.port: 9301
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when new node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
discovery.zen.ping.unicast.hosts: ["123.321.45.6:9301", "123.321.45.6:9302","123.321.45.6:9303"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):
#
discovery.zen.minimum_master_nodes: 2
#
# For more information, consult the zen discovery 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


5、配置内存


vim /data/app/elasticsearch-6.0.1/es1/config/jvm.options  

根据服务配置和 业务需求进行内存的分配即可,我我这里每个节点分配了8g内存。

image.png



6、启动服务


 权限设置  chown daemon:daemon -R /data/app/elasticsearch-6.0.1/es1


我们使用daemon用户启动es服务,所以需要设置权限


启动命令:/sbin/runuser -s /bin/bash daemon -c " /data/app/elasticsearch-6.0.1/es1/bin/elasticsearch -d"


7、配置剩余两个节点


直接复制es1文件夹为es2,es3,然后修改对应的 配置文件中的节点名称和端口名称即可。注意集群名称要保持一致


8、配置完成以后,按照节点1的启动方式启动即可。


至此,整个安装过程完成。


附录:es配置文件中重要节点说明

#集群名
cluster.name: elasticsearch
#节点名
node.name: es_1
#数据文件路径
path.data:  /opt/elasticsearch/es1/data
#日志文件路径
path.logs: /opt/logs/elasticsearch/es1
#监听地址
#network.host: 10.141.141.29  
network.host: es1.jack.com
#监听端口
http.port: 9201   
#数据通讯端口
transport.tcp.port: 9301    
#集群中的节点地址   
#discovery.zen.ping.unicast.hosts : ["123.321.45.6:9301", "123.321.45.6:9302", "123.321.45.6:9303"]
discovery.zen.ping.unicast.hosts : ["es1.jack.com:9301", " es2.jack.com:9302", " es3.jack.com:9303"]
#集群中的至少主节点数(指定集群中的节点中有几个有master资格的节点)
discovery.zen.minimum_master_nodes: 2
#是否为master
node.master: true
#是否为数据节点
node.data: true
#设置集群中自动发现其它节点时ping连接超时时间
discovery.zen.fd.ping_timeout: 180s
#集群中节点之间ping的次数
discovery.zen.fd.ping_retries: 10
#集群中节点之间ping的时间间隔
discovery.zen.fd.ping_interval: 30s
bootstrap.memory_lock: false
bootstrap.system_call_filter: false


相关实践学习
以电商场景为例搭建AI语义搜索应用
本实验旨在通过阿里云Elasticsearch结合阿里云搜索开发工作台AI模型服务,构建一个高效、精准的语义搜索系统,模拟电商场景,深入理解AI搜索技术原理并掌握其实现过程。
ElasticSearch 最新快速入门教程
本课程由千锋教育提供。全文搜索的需求非常大。而开源的解决办法Elasricsearch(Elastic)就是一个非常好的工具。目前是全文搜索引擎的首选。本系列教程由浅入深讲解了在CentOS7系统下如何搭建ElasticSearch,如何使用Kibana实现各种方式的搜索并详细分析了搜索的原理,最后讲解了在Java应用中如何集成ElasticSearch并实现搜索。  
目录
相关文章
|
存储 人工智能 自然语言处理
Elasticsearch Relevance Engine---为AI变革提供高级搜索能力[ES向量搜索、常用配置参数、聚合功能等详解]
Elasticsearch Relevance Engine---为AI变革提供高级搜索能力[ES向量搜索、常用配置参数、聚合功能等详解]
Elasticsearch Relevance Engine---为AI变革提供高级搜索能力[ES向量搜索、常用配置参数、聚合功能等详解]
|
存储 JavaScript 前端开发
【前端系列】- 富文本组件(mavon-editor)
mavon-editor是一款基于vue的markdown编辑器,可以用来做文本的编辑,比如是某种业务需要发送公告、个人博客等,都可以用到,操作也十分简单。
4901 0
【前端系列】- 富文本组件(mavon-editor)
|
Java 应用服务中间件 nginx
【异常解决】java程序连接MinIO报错The request signature we calculated does not match the signature you provided.
【异常解决】java程序连接MinIO报错The request signature we calculated does not match the signature you provided.
4467 0
|
搜索推荐 Java 数据处理
Elasticsearch搜索分析引擎本地部署与远程访问
Elasticsearch搜索分析引擎本地部署与远程访问
|
网络安全
一个简单的网站建设需要多少费用?
网站建设费用因类型、功能和需求的不同而差异较大,包括基础型网站、设计和定制网站、功能型与电商网站、域名费用、服务器费用、HTTPS认证费用、网站维护费用等,其中独立站建设费用相对较高。
1618 2
|
存储 安全 数据管理
如何在 Rocky Linux 8 上安装和配置 Elasticsearch
本文详细介绍了在 Rocky Linux 8 上安装和配置 Elasticsearch 的步骤,包括添加仓库、安装 Elasticsearch、配置文件修改、设置内存和文件描述符、启动和验证 Elasticsearch,以及常见问题的解决方法。通过这些步骤,你可以快速搭建起这个强大的分布式搜索和分析引擎。
653 5
|
设计模式 JavaScript 前端开发
前端(十一)——Vue vs. React:两大前端框架的深度对比与分析
前端(十一)——Vue vs. React:两大前端框架的深度对比与分析
1933 0
|
Cloud Native 关系型数据库 分布式数据库
开发者如何使用云原生数据库PolarDB
【10月更文挑战第5天】开发者如何使用云原生数据库PolarDB
530 2
|
自然语言处理 负载均衡 安全
保姆级Elasticsearch集群部署指导
保姆级Elasticsearch集群部署指导
1362 0
|
安全 数据挖掘 测试技术
深入探究软件测试中的风险分析与管理
【5月更文挑战第7天】 在软件开发生命周期中,风险分析与管理是确保产品质量和项目成功的关键步骤。本文将探讨软件测试过程中如何有效进行风险评估、分类及采取相应的缓解措施。文章首先介绍了风险管理的重要性,然后详细阐述了风险识别的技术和工具,接着分析了如何制定和实施风险应对策略。最后,通过案例研究展示了一个结构化风险分析流程的实施效果。
477 2