当前位置: 首页 > news >正文

ElasticSearch集群环境搭建

1、准备三台服务器

这里准备三台服务器如下:

IP地址主机名节点名
192.168.225.65linux1node-1
192.168.225.66linux2node-2
192.168.225.67linux3node-3

2、准备elasticsearch安装环境

(1)编辑/etc/hosts(三台服务器都执行)

vim /etc/hosts
添加如下内容:
192.168.225.65    linux1
192.168.225.66    linux2
192.168.225.67    linux3

在这里插入图片描述
(2)编辑/etc/hostname (三台服务器都执行)

在192.168.225.65上修改
echo 'linux1' > /etc/hostname
在192.168.225.66上修改
echo 'linux2' > /etc/hostname
在192.168.225.67上修改
echo 'linux3' > /etc/hostname

(3)修改系统参数 (三台服务器都执行)

vim /etc/security/limits.conf
修改内容如下:
*  soft nofile  65536
*  hard nofile 131072
*  soft nproc  4096
*  hard nproc  4096 vim /etc/sysctl.conf
修改内容如下:
vm.max_map_count = 262145
保存退出,刷新配置文件
sysctl -p 

(4)上传elasticsearch安装包和创建安装用户(三台服务器都执行)
elasticsearch-7.8.1下载地址

这里是将elasticsearch安装包elasticsearch-7.8.1-linux-x86_64.tar.gz上传到/opt目录下
cd /opt
tar -zxvf elasticsearch-7.8.1-linux-x86_64.tar.gz
mv elasticsearch-7.8.1 elasticsearch7.8
useradd jamysong
chown -R jamysong:jamysong  /opt/elasticsearch7.8

注意:做完以上四步重启下三台服务器

3、安装elasticsearch

(1) 编辑elasticsearch配置文件

vim /opt/elasticsearch7.8/cong/elasticsearch.yaml

node1的配置文件

cluster.name: cluster-jamysong
node.name: node-1
network.host: linux1
node.master: true
node.data: true
http.port: 9200 
http.cors.allow-origin: "*"
http.cors.enabled: true
http.max_content_length: 200mb
cluster.initial_master_nodes: ["node-1"]
discovery.seed_hosts: ["linux1:9300", "linux2:9300","linux3:9300"]
gateway.recover_after_nodes: 2
network.tcp.keep_alive: true
network.tcp.no_delay: true
transport.tcp.compress: true
cluster.routing.allocation.cluster_concurrent_rebalance: 16
cluster.routing.allocation.node_concurrent_recoveries: 16
cluster.routing.allocation.node_initial_primaries_recoveries: 16

node2的配置文件

cluster.name: cluster-jamysong
node.name: node-2
network.host: linux2
node.master: true
node.data: true
http.port: 9200 
http.cors.allow-origin: "*"
http.cors.enabled: true
http.max_content_length: 200mb
cluster.initial_master_nodes: ["node-1"]
discovery.seed_hosts: ["linux1:9300", "linux2:9300","linux3:9300"]
gateway.recover_after_nodes: 2
network.tcp.keep_alive: true
network.tcp.no_delay: true
transport.tcp.compress: true
cluster.routing.allocation.cluster_concurrent_rebalance: 16
cluster.routing.allocation.node_concurrent_recoveries: 16
cluster.routing.allocation.node_initial_primaries_recoveries: 16

node3的配置文件

cluster.name: cluster-jamysong
node.name: node-3
network.host: linux3
node.master: true
node.data: true
http.port: 9200 
http.cors.allow-origin: "*"
http.cors.enabled: true
http.max_content_length: 200mb
cluster.initial_master_nodes: ["node-1"]
discovery.seed_hosts: ["linux1:9300", "linux2:9300","linux3:9300"]
gateway.recover_after_nodes: 2
network.tcp.keep_alive: true
network.tcp.no_delay: true
transport.tcp.compress: true
cluster.routing.allocation.cluster_concurrent_rebalance: 16
cluster.routing.allocation.node_concurrent_recoveries: 16
cluster.routing.allocation.node_initial_primaries_recoveries: 16
(2)启动elasticsearch

现在直接去启动每台服务器上面的elasticsearch

su jamysong
cd /opt/elasticsearch7.8/bin
./elasticsearch

注意:elasticsearch是不允许root用户启动的,这里使用上面创建的安装用户(jamysong)启动
!
在这里插入图片描述

查看启动日志如下,表示启动成功!
在这里插入图片描述

(3)检测elasticsearch集群

这里可以直接访问浏览器来检测一下集群是否搭建成功,这里可以看到node-1是主节点,node-2和node-3是从节点
在这里插入图片描述

相关文章:

  • 为什么要停止在 SpringBoot 中使用字段注,改用构造器注入
  • 蓝桥杯每日一题2023.11.2
  • 计算机服务器中了locked勒索病毒怎么办,勒索病毒解密,数据恢复
  • 187. 重复的DNA序列-滑动窗口
  • Java使用pdfbox进行pdf和图片之间的转换
  • pix2tex - LaTeX OCR 安装使用记录
  • Rocky9 上安装 redis-dump 和redis-load 命令
  • uinapp微信小程序隐私政策授权
  • httpclient工具类(支持泛型转换)
  • Vue3.0 provide与inject依赖注入:VCA
  • 线程同步——互斥量解锁、解锁
  • Python教程---Python交互界面
  • idea 配置checkstyle全过程
  • 在PyCharm中直接启动mitmproxy并自动打开关闭系统代理
  • 采用XML作为GUI描述语言
  • 【技术性】Search知识
  • docker容器内的网络抓包
  • Javascript设计模式学习之Observer(观察者)模式
  • javascript数组去重/查找/插入/删除
  • Linux下的乱码问题
  • Logstash 参考指南(目录)
  • Objective-C 中关联引用的概念
  • spring学习第二天
  • vue--为什么data属性必须是一个函数
  • Vue学习第二天
  • win10下安装mysql5.7
  • 短视频宝贝=慢?阿里巴巴工程师这样秒开短视频
  • 使用 5W1H 写出高可读的 Git Commit Message
  • 想写好前端,先练好内功
  • 鱼骨图 - 如何绘制?
  • 原生js练习题---第五课
  • 东超科技获得千万级Pre-A轮融资,投资方为中科创星 ...
  • ​ArcGIS Pro 如何批量删除字段
  • #define
  • #我与Java虚拟机的故事#连载03:面试过的百度,滴滴,快手都问了这些问题
  • $.ajax()方法详解
  • (C++17) std算法之执行策略 execution
  • (MIT博士)林达华老师-概率模型与计算机视觉”
  • (编程语言界的丐帮 C#).NET MD5 HASH 哈希 加密 与JAVA 互通
  • (附源码)springboot家庭装修管理系统 毕业设计 613205
  • (附源码)计算机毕业设计SSM基于健身房管理系统
  • (顺序)容器的好伴侣 --- 容器适配器
  • (四)鸿鹄云架构一服务注册中心
  • (学习日记)2024.04.04:UCOSIII第三十二节:计数信号量实验
  • (原創) 如何安裝Linux版本的Quartus II? (SOC) (Quartus II) (Linux) (RedHat) (VirtualBox)
  • (原創) 如何讓IE7按第二次Ctrl + Tab時,回到原來的索引標籤? (Web) (IE) (OS) (Windows)...
  • (转)es进行聚合操作时提示Fielddata is disabled on text fields by default
  • .NET LINQ 通常分 Syntax Query 和Syntax Method
  • .NET MVC之AOP
  • .NET WebClient 类下载部分文件会错误?可能是解压缩的锅
  • .net 打包工具_pyinstaller打包的exe太大?你需要站在巨人的肩膀上-VC++才是王道
  • .netcore 获取appsettings
  • .net经典笔试题
  • .net连接oracle数据库
  • .NET实现之(自动更新)