SpringBoot2.6.3集成ElasticSearch7.13.4详解,上下两篇,上篇集群配置,下篇集成配置(上)

news2024/11/27 5:34:24

一、集群配置准备

(1)方式一,从网盘下载ElasticSearch7.13.4

链接: https://pan.baidu.com/s/1vwUu1kbpCc5exkfOPgb29g 提取码: thn5 

(2)方式二,从官网下载

https://www.elastic.co/cn/downloads/past-releases/elasticsearch-7-13-4

(3)各个节点之间,设置免密登录

我当前有192.168.1.102192.168.1.103192.168.1.104三个节点,192.168.1.102为主节点

<1>首先各个节点下,执行该操作
                ssh-keygen -t rsa    (一路回车就行,然后可以通过 ll -a 可以看到.ssh 文件夹)

                cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

 <2> 把主节点的公钥追加到从节点上

把主节点的公钥添加到从节点上, 远程复制的过程需要密码,
当前我的主节点IP信息是192.168.1.102

scp ~/.ssh/authorized_keys 192.168.1.103:~/
scp ~/.ssh/authorized_keys 192.168.1.104:~/

拷贝完成后,分别在192.168.1.103,192.168.1.104添加192.168.1.102的公钥,执行如下操作:
cat ~/authorized_keys >> ~/.ssh/authorized_keys

<3> 通过ssh 测试一下,看能能链接上去, 下面是操作成功的测试

注:我这里的安装环境是 CentOS-7-x86_64

二、配置ElasticSearch的启动环境

(1)因为ElasticSearch不能用root用户启动,先创建一个用户

useradd -d /home/es -m es

(2)修改/etc/security/limits.conf文件,添加如下配置,否则会报错

代码如下:

* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096

# 退出保存后执行如下命令 :sysctl -p    也可先不执行,等稍后配置完/etc/sysctl.conf文件,执行

重启命令:reboot -h now

(3)修改/etc/sysctl.conf文件,添加如下配置 :

代码如下:

vm.max_map_count=262144

# 退出保存后执行如下命令 :sysctl -p    如果你上一步配置没有执行sysctl -p 的话,现在可执行 

重启命令:reboot -h now

三、修改ElasticSearch7.13.4配置文件

(1)上传elasticsearch-7.13.4-linux-x86_64.tar.gz文件到服务器

         我这里上传到了/opt/elk目录,elk是我自定义的的,创建命令:mkdir elk

(2)解压文件

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

(3)使用elasticsearch-7.13.4本身的jdk

        执行:  vim /etc/profile
        添加:export ES_JAVA_HOME=/opt/elk/elasticsearch-7.13.4/jdk

        保存成功后执行生效:source /etc/profile

    

(4)修改192.168.1.102服务器上

   /opt/elk/elasticsearch-7.13.4/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: bamboo-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: es-node-102
#
# 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 -----------------------------------
#
# By default Elasticsearch is only accessible on localhost. Set a different
# address here to expose this node on the network:
#
network.host: 192.168.1.102
#
# 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.1.102", "192.168.1.103", "192.168.1.104"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
cluster.initial_master_nodes: ["192.168.1.102"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
action.destructive_requires_name: true

修改192.168.1.103上的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: bamboo-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: es-node-103
#
# 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 -----------------------------------
#
# By default Elasticsearch is only accessible on localhost. Set a different
# address here to expose this node on the network:
#
network.host: 192.168.1.103
#
# 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.1.102", "192.168.1.103", "192.168.1.104"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
cluster.initial_master_nodes: ["192.168.1.102"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
action.destructive_requires_name: true

修改192.168.1.104上的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: bamboo-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: es-node-104
#
# 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 -----------------------------------
#
# By default Elasticsearch is only accessible on localhost. Set a different
# address here to expose this node on the network:
#
network.host: 192.168.1.104
#
# 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.1.102", "192.168.1.103", "192.168.1.104"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
cluster.initial_master_nodes: ["192.168.1.102"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true

四、配置完成后,修改各个节点的elasticsearch-7.13.4文件的权限

(1)192.168.1.102 节点上

     chmod 777 -R /opt/elk/elasticsearch-7.13.4

(2)192.168.1.103 节点上

     chmod 777 -R /opt/elk/elasticsearch-7.13.4

(3)192.168.1.104 节点上

     chmod 777 -R /opt/elk/elasticsearch-7.13.4

五、修改完成后,切换用户启动

(1)su es

(2)在elasticsearch-7.13.4文件下 bin/elasticsearch -d

六、查看是否配置成功

通过jps查看:

在浏览器总执行请求:http://192.168.1.102:9200/_nodes/_all?pretty  成功显示如下:

 也可以查看单个节点数据:

 七、集群监控

方式一、可以通过浏览器插件的方式

展示效果如下:

 方式二、cerebro监控

(1)下载cerebro安装包

链接: https://pan.baidu.com/s/1L2BHL9-bbTWzPwA6WNFcZg 提取码: n3md 

(2)解压并启动

 

 (3)访问 http://192.168.1.102:9000/  然后输入 http://192.168.1.102:9200 连接,成功如下:

安全校验的话,可引入xpark认证

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/551400.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【C++学习】C++11——lambda表达式 | 可变参数模板 | 包装器

&#x1f431;作者&#xff1a;一只大喵咪1201 &#x1f431;专栏&#xff1a;《C学习》 &#x1f525;格言&#xff1a;你只管努力&#xff0c;剩下的交给时间&#xff01; lambda表达式 | 可变参数模板 | 包装器 &#x1f3c0;lambda表达式&#x1f94e;lambda表达式语法&am…

汇编十一、汇编实现外部中断

1、实现目的 (1)实现8颗LED灯呈流水灯依次被点亮&#xff1b;静态数码管通过按键按下&#xff0c;显示数值发生改变&#xff0c;通过按键依次显示0-9。 (2)按键检测采用外部中断检测。 2、原理图及硬件连接 2.1、LED灯 (1)51单片机P1端口接八个共阴极LED灯&#xff0c;即I…

【python之django1.11框架二】django ORM 操作MySQL的基本操作

1. django 连接数据库(MySQL) # setting.py 文件 # 默认用的是sqkite3 DATABASES {default: {ENGINE: django.db.backends.sqlite3,NAME: os.path.join(BASE_DIR, db.sqlite3),} }# django链接MySQL 1.第一步配置文件中配置 DATABASES {default: {ENGINE: django.db.backend…

RocketMQ 消息发送、消息类别

一、消息发送 1.1 单生产者单消费者消息发送&#xff08;OneToOne&#xff09; 1、新建maven项目recketmqtest 2、导入RocketMQ客户端坐标 <dependency><groupId>org.apache.rocketmq</groupId><artifactId>rocketmq-client</artifactId><…

chatgpt赋能Python-pythonbug

Python Bug: 了解并避免Python编程中的错误 在编程中遇到错误是件非常常见的事情&#xff0c;Python编程也不例外。在Python中&#xff0c;被称为“bug”的错误主要分为两种&#xff0c;编译错误和运行时错误。本文将向您介绍如何识别、调试和避免Python编程中的错误&#xff…

Windi CSS 原子css 下一代工类 CSS 框架

最近由于项目原因接触到了windi Css 发现这个东西真是绝绝子啊,不用在代码里写一行style,完全以类的形式去写样式,它里面包含了几乎所有的css样式&#xff0c;可以让我们不需要再去繁琐的写css样式&#xff0c;原来几行的css现在只需要短短的几个字符。他的许多新特性给我们带来…

《算法竞赛进阶指南》(持续更新ing)

算法竞赛进阶指南 位运算 AcWing 89. a^b #include<iostream> using namespace std;int main(void) {long long a,b,p;cin>>a>>b>>p;long long ans1%p;while(b){if(b&1)//判断b当前二进制位是否为1{ansans*a%p;}aa*a%p;//每跨越一个二进制位&…

用WaveNet预测(Adapted Google WaveNet-Time Series Forecasting)

目录 剧情简介: 数据来源 加载数据 分割数据和可视化 时间序列的多元波网模型:实现(多步预测) 创建模型 创建数据集 数据准备 1- Training dataset preparation 2- Validation dataset preparation Train the Model with TPU: 使用经过训练的适应Google WaveNet预测…

【多线程】| 基本知识汇总

目录 &#x1f981; 掌握基本概念1. 什么是线程&#xff1f;2. 什么是主线程以及子线程&#xff1f;3. 什么是串行&#xff1f;什么是并行&#xff1f; 什么是并发? &#x1f981; 线程的创建1. 通过继承Thread类实现多线程2. 通过Runnable接口实现多线程 &#x1f981; 线程执…

AI故事:智慧学校的人脸识别奇幻之旅

人脸识别 在一个名为智慧学校的小镇上&#xff0c;生物老师Rita和她的丈夫朝哥&#xff0c;一个富有创造力的艺术家&#xff0c;过着幸福美满的生活。他们的家庭与学校紧密相连&#xff0c;成为了一座小小的教育乐园。 智慧学校里有一群充满朝气的学生&#xff0c;其中小枣是…

自定义属性,v-bind computed的使用

0.0 自定义组件的使用 【掌握】 先自定义自己的组件 引入组件 import 组件名 from 路径/文件名 注册组件 <script> export default {components:{ // 组件注册组件名:组件名&#xff0c;组件名1},data(){ // 数据return {}},methods:{ // 方法} ​ } ​ </script&…

buu [AFCTF2018]MyOwnCBC 1

题目描述&#xff1a; 三份文件 #!/usr/bin/python2.7 # -*- coding: utf-8 -*-from Crypto.Cipher import AES from Crypto.Random import random from Crypto.Util.number import long_to_bytesdef MyOwnCBC(key, plain):if len(key)!32:return "error!"cipher_t…

lwIP更新记03:IPv6

从 lwIP-2.0.0 开始&#xff0c;lwIP 终于有可用的 IPv6 协议栈了&#xff01;IPv6 支持 双栈&#xff08;IPv4 和 IPv6 同时使用&#xff09; 或 IPv4/IPv6 二选一 模式。 lwIP-1.4.1 版本也有 IPv6&#xff0c;但那是实验性质的&#xff08;见…\lwip-1.4.1\src\core\ipv6目…

linux专题:嵌入式linux系统启动流程基础分析

目录 第一&#xff1a;linux内核源码基本简介 第二&#xff1a;uboot启动分析 第三&#xff1a;内核源码分析 第一&#xff1a;linux内核源码基本简介 下载 Linux 内核网址&#xff1a; https://www.kernel.org/ 最新 Linux 内核是 5.15 版本。现在常用 Linux 内核源码为4…

八大排序-直接插入排序、希尔排序、直接选择排序、冒泡排序、堆排序、快速排序、归并排序、基数排序

目录 前言 直接插入排序&#xff08;Insertion Sort&#xff09; 一、概念及其介绍 二、过程图示 三、代码 四、复杂度 希尔排序&#xff08;Shell Sort&#xff09; 一、概念 二、实现思路 三、图示过程 四、代码 4.1代码 4.2运行结果 4.3解释 五、复杂度 堆排…

路径规划算法:基于蝙蝠算法的路径规划算法- 附代码

路径规划算法&#xff1a;基于蝙蝠的路径规划算法- 附代码 文章目录 路径规划算法&#xff1a;基于蝙蝠的路径规划算法- 附代码1.算法原理1.1 环境设定1.2 约束条件1.3 适应度函数 2.算法结果3.MATLAB代码4.参考文献 摘要&#xff1a;本文主要介绍利用智能优化算法蝙蝠算法来进…

Swift 如何闪电般异步读取大文件?

功能需求 Apple 系统中&#xff08;iOS、MacOS、WatchOS等等&#xff09;读取文件是一个平常的不能再平常的需求&#xff0c;不过当文件很大时&#xff0c;同步读取文件会导致 UI 的挂起&#xff0c;这是不能让用户接受的。 所以&#xff0c;要想读取文件内容的同时保持界面操…

KMP算法及其改进图文详解

文章目录 KMP算法详解什么是KMP算法KMP算法的应用场景KMP算法和暴力求解的比较字符串的前缀、后缀和最长相等前后缀KMP算法实现字符串匹配的具体过程&#xff08;图解&#xff09;从串与主串的下标变化j回退的位置(从串的下标变化)主串的下标变化 Next数组如何运用代码逻辑计算…

[CTF/网络安全] 攻防世界 xff_referer 解题详析

[CTF/网络安全] 攻防世界 xff_referer 解题详析 XFF及refererXFF格式referer格式姿势总结 题目描述&#xff1a;X老师告诉小宁其实xff和referer是可以伪造的。 XFF及referer X-Forwarded-For&#xff08;简称 XFF&#xff09;是一个 HTTP 请求头部字段&#xff0c;它用于表示 …

深入理解计算机系统第七章知识点总结

文章目录 详解ELF文件-> main.o前十六个字节的含义推测elf的大小查看节头部表推断每个section在elf中的具体位置查看.text的内容查看.data的内容关于.bss查看.rodata的内容关于其他的节表示的信息 详解符号表符号编译器如何解析多重定义的全局符号静态库与静态链接构造和使用…