ES集群部署

  • 一、windows部署
  • 二、Linux单节点部署
  • 三、Linux集群部署

一、windows部署

如果已经使用过,删除其中的data和logs文件夹中的内容

新建一个es-cluster文件夹,用于存放集群中的三个ES结点

1.结点1(master)配置

首先打开node-1文件夹->config目录下-》bin目录下的elasticsearch.yml文件

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: my-application    //集群名
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-1       //结点名
node.master: true           //既做为master
node.data: true             //也做为data
#
# 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: /path/to/data
#
# Path to log files:
#
#path.logs: /path/to/logs
#
# ----------------------------------- 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: localhost    //ip地址,我在本地搭建
#
# Set a custom port for HTTP:
#
http.port: 9200             //ES启动端口
transport.tcp.port: 9201    //通信端口,因为各个结点之间要进行通信
#
# 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: ["host1", "host2"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
#cluster.initial_master_nodes: ["node-1", "node-2"]
#
# 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
http.cors.enabled: true         //跨域设置
http.cors.allow-origin: "*"

2.结点2配置

打开node-2文件夹-》conf-》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-2       //结点名不一致
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):
#
#path.data: /path/to/data
#
# Path to log files:
#
#path.logs: /path/to/logs
#
# ----------------------------------- 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: localhost
#
# Set a custom port for HTTP:
#
http.port: 9300
transport.tcp.port: 9301
discovery.seed_hosts: ["localhost:9201"]  //这是为了发现其他结点
discovery.zen.fd.ping_timeout: 1m   //9201代表了master(node-1)的通信端口
discovery.zen.fd.ping_retries: 5
#
# 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: ["host1", "host2"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
#cluster.initial_master_nodes: ["node-1", "node-2"]
#
# 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
http.cors.enabled: true
http.cors.allow-origin: "*"

3.结点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:
#
cluster.name: my-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-3
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):
#
#path.data: /path/to/data
#
# Path to log files:
#
#path.logs: /path/to/logs
#
# ----------------------------------- 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: localhost
#
# Set a custom port for HTTP:
#
http.port: 9400
transport.tcp.port: 9401
discovery.seed_hosts: ["localhost:9201","localhost:9301"]  //发现结点1和结点2(9201是node-1的通信端口,9301是node-2的通信端口
discovery.zen.fd.ping_timeout: 1m
discovery.zen.fd.ping_retries: 5
#
# 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: ["host1", "host2"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
#cluster.initial_master_nodes: ["node-1", "node-2"]
#
# 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
http.cors.enabled: true
http.cors.allow-origin: "*"

4.使用postman进行测试

依次启动node-1,node-2,node-3




二、Linux单节点部署

(1)cd到/usr/local目录下,新建es文件夹,cd到es文件夹下

cd /usr/local/
mkdir es
cd es

(2)下载ElasticSearch

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.10.1-linux-x86_64.tar.gz
ES下载教程:https://blog.csdn.net/Kevinnsm/article/details/120604537?spm=1001.2014.3001.5501


(3)解压缩

tar -zxvf elasticsearch-7.10.1-linux-x86_64.tar.gz

(4)改变文件名为es

mv elasticsearch-7.10.1 es

(5)

ElasticSearch集群部署【windows+Linux双系统搭建】相关推荐

  1. Elasticsearch集群部署1.0

    此文档基于1.0版本. Elasticsearch集群部署 配置文件 Elasticsearch有三个配置文件: elasticsearch.yml 用于配置Elasticsearch jvm.opt ...

  2. CentOS7下Elasticsearch集群部署记录

    Elasticsearch是一个分布式搜索服务,提供Restful API,底层基于Lucene,采用多shard的方式保证数据安全,并且提供自动resharding的功能,github等大型的站点也 ...

  3. ubuntu 安装GPU黑屏 修改GRUB_手把手教你Windows+Linux双系统的安装与卸载

    公众号关注 "菜鸟要飞" 设为 "星标",和12万程序员一起成长! Windows+Linux双系统的安装 1. 准备工作 1.1 U盘启动盘的制作 准备一个 ...

  4. 安装windows+linux双系统

    ## 安装windows+linux双系统 (我安装用的是Windows 10 + CentOS 7) 一.安装Windows系统 一般人的电脑一开始是有一个windows系统的,所以安装window ...

  5. easyuefi安装不了_手把手教你Windows Linux双系统的安装与卸载

    作者:-叶丶知秋 链接:https://blog.csdn.net/fanxueya1322/article/details/90205143 转载请保留出处 良许前言: 后台突然有很多小伙伴留言想看 ...

  6. linux和win双系统删除,双系统删除教程详解:Windows(linux)双系统,教你如何删除其中一个!...

    原标题:双系统删除教程详解:Windows(linux)双系统,教你如何删除其中一个! 现在的电脑配置都十分不错,有很多电脑都可以支持双系统.你可以将双系统可以分别安装在不同的分区内,在使用的时候,根 ...

  7. Windows+Linux双系统修改启动顺序

    Windows+Linux双系统修改启动顺序 分析启动顺序 windows与linux双系统下,如果先安装的是windows再安装redhat,则开机默认启动redhat. 启动顺序修改方法一 在BI ...

  8. 手把手教你Windows+Linux双系统的安装与卸载

    文章来源:良许Linux 作者:-叶丶知秋 链接:https://blog.csdn.net/fanxueya1322/article/details/90205143 转载请保留出处 参考自 htt ...

  9. linux故障转移集群,部署AlwaysOn第一步:搭建Windows服务器故障转移集群

    在Windows Server 2012 R2 DataCenter 环境中搭建集群之前,首先要对Windows服务器故障转移集群(Windows Server Failover Cluster,简称 ...

最新文章

  1. 西电与中科大计算机专业哪个好,中国最好的5所“科技大学”,中科大第二,你的母校排第几?...
  2. java bidi_Java Bidi createLineBidi()用法及代码示例
  3. c# List 按类的指定字段排序
  4. 【2016.11.17】HTML学习笔记第二天
  5. 日立数据系统进一步加强与IBM zHPF大型机合作
  6. ssh系统环境搭建步骤
  7. C#结合VS开发WinForm学习笔记
  8. 10.1综合强化刷题 Day2 morning
  9. Hbase总结(三)--使用spring-data-hadoop进行hbase的读写操作
  10. c语言程序设计立体化教程,C语言程序设计立体化教程
  11. Java之JDBC安装、使用详解(2021最新!)
  12. 推荐一本 python自动化框架pytest -上海悠悠
  13. 正向最大匹配、逆向最大匹配与双向匹配算法实现
  14. 如何建立企业级数据分析能力?
  15. #586 – 冒泡事件和隧道事件通常是成对出现(Bubbling and Tunneling Events Are Typically Paired)
  16. 最新鲁班H5页面生成工具系统源码+功能强大/仿易企秀
  17. 深入理解Linux内核-第3版 译者序、前言、目录 内核2.6.11
  18. 自适应直方图均衡(CLAHE) 代码及详细注释【OpenCV】
  19. 安卓支持App内文字翻译
  20. 阮一峰 React Router 教程

热门文章

  1. 操作系统中的内存分配
  2. Android 禁止更换桌面,Android中如何禁用其他应用,并且不在桌面显示
  3. jemalloc java_从源构建tensorflow遇到错误:规则'@jemalloc//:jemalloc'的C编译失败
  4. get_attribute中的value是什么类型的?_建设工程项目中都有什么类型的监理?
  5. java订单编号生产代码,java 订单编号 生成器,可用于生产环境
  6. python机械手标定_机械手姿态的获取,ros,臂,当前,位姿
  7. 计算机科学个人陈述,计算机专业个人陈述样本
  8. java 二进制 base64编码_java 按字节读写二进制文件(Base64编码解码)
  9. unity hub是什么东西_Unity可编程渲染管线(SRP)教程:一、自定义管线
  10. mysql分隔字符串转变为多行_【mysql】将以固定分隔符分隔的字符串转成多行的形式...