es8.8 集群安装笔记

news2024/9/20 22:13:58

es8.8 集群安装笔记

    • 配置集群
      • 第一步 修改配置文件

本次安装使用centos8
3节点安装:
192.168.182.142
192.168.182.143
192.168.182.144

官网 可以查看详细的安装,安装步骤比较简单
https://www.elastic.co/guide/en/elasticsearch/reference/8.8/rpm.html#rpm-repo

直接安装,需要配置仓库
 cd  /etc/yum.repos.d/
 vielasticsearch.repo

[elasticsearch]
name=Elasticsearch repository for 8.x packages
baseurl=https://artifacts.elastic.co/packages/8.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=0
autorefresh=1
type=rpm-md

sudo yum install --enablerepo=elasticsearch elasticsearch  -y

开机启动
sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable elasticsearch.service
启动/停止
sudo systemctl start elasticsearch.service
sudo systemctl stop elasticsearch.service
查看状态
sudo systemctl status elasticsearch.service

journalctl --unit elasticsearch

修改系统最大文件句柄数(修改后需要重启系统才能生效)
# vi /etc/security/limits.conf
*       soft    nproc   65535
*       hard    nproc   65535
*       soft    nofile  65535
*       hard    nofile  65535

reboot

修改最大虚拟内存
 vi /etc/sysctl.conf
vm.max_map_count=655360

访问需要用https https://127.0.0.1:9200/
默认用户 elastic
密码就是安装的时候打印到屏幕上的密码

配置集群

8.8 使用 创建token 这一招,没有奏效,于是乎在官网各种爬。

第一步 修改配置文件

node1

# ======================== 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: es
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node1
#
# 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: /var/lib/elasticsearch
#
# Path to log files:
#
path.logs: /var/log/elasticsearch
#
# ----------------------------------- 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.182.143
#
# 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.182.142", "192.168.182.143","192.168.182.144"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
cluster.initial_master_nodes: ["node1", "node2", "node3"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Allow wildcard deletion of indices:
#
#action.destructive_requires_name: false

#----------------------- BEGIN SECURITY AUTO CONFIGURATION -----------------------
#
# The following settings, TLS certificates, and keys have been automatically      
# generated to configure Elasticsearch security features on 01-07-2023 14:38:29
#
# --------------------------------------------------------------------------------

# Enable security features
xpack.security.autoconfiguration.enabled : true
xpack.security.enabled: true


xpack.security.enrollment.enabled: true
xpack.security.transport.ssl.verification_mode: none

# Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents
xpack.security.http.ssl:
  enabled: true
  keystore.path: certs/http.p12

# Enable encryption and mutual authentication between cluster nodes
xpack.security.transport.ssl:
  enabled: true
  verification_mode: certificate
  keystore.path: certs/elastic-certificates.p12
  truststore.path: certs/elastic-certificates.p12
# Create a new cluster with the current node only
# Additional nodes can still join the cluster later
#cluster.initial_master_nodes: ["localhost.localdomain"]

# Allow HTTP API connections from anywhere
# Connections are encrypted and require user authentication
http.host: 0.0.0.0

# Allow other nodes to join the cluster from anywhere
# Connections are encrypted and mutually authenticated
transport.host: 0.0.0.0
transport.port: 9300

#----------------------- END SECURITY AUTO CONFIGURATION -------------------------
node.roles: [master,data]

主要修改点:
····
cluster.name: es
node.name: node1
network.host: 192.168.182.143
添加如下两个节点启动之后不会自动创建集群
discovery.seed_hosts: [“192.168.182.142”, “192.168.182.143”,“192.168.182.144”]
cluster.initial_master_nodes: [“node1”, “node2”, “node3”]
transport.host: 0.0.0.0
transport.port: 9300
node.roles: [master,data]

····

配置文件修改完成之后,启动节点。报错如下:

[2023-07-08T00:24:27,553][WARN ][o.e.x.c.s.t.n.SecurityNetty4Transport] [node2] client did not trust this server's certificate, closing connection Netty4TcpChannel{localAddress=/192.168.182.143:9300, remoteAddress=/192.168.182.144:36500, profile=default}
[2023-07-08T00:24:28,420][WARN ][o.e.d.PeerFinder         ] [node2] address [192.168.182.142:9300], node [null], requesting [false] discovery result: [][192.168.182.142:9300] connect_exception: Failed execution: 

原因是因为没有配置通信证书。

找到一篇安全配置的文章
es安全配置

生成证书:
生成集群节点证书:

生成ca证书
./bin/elasticsearch-certutil ca
使用ca证书生成集群通信证书
./bin/elasticsearch-certutil cert --ca elastic-stack-ca.p12

把证书复制到其他节点/etc/elasticsearch/certs 目录中

把证书密钥添加至本地密钥库

./bin/elasticsearch-keystore add xpack.security.transport.ssl.keystore.secure_password


./bin/elasticsearch-keystore add xpack.security.transport.ssl.truststore.secure_password

节点更新完成之后重启各个节点,查看节点状态,集群创建成功。
在这里插入图片描述
状态查询
curl -XGET"http://localhost:9200/_cluster/health?pretty=true"
查询Elasticsearch运行状态
curl --cacert /etc/elasticsearch/certs/http_ca.crt -u elastic https://localhost:9200
查询集群节点信息
curl --cacert /etc/elasticsearch/certs/http_ca.crt -u elastic https://localhost:9200/_cluster/health?pretty=true

curl --cacert /etc/elasticsearch/certs/http_ca.crt -u elastic https://localhost:9200/_cat/nodes

142 qvKpUo1_T1yqgkpn_KMk

生成token
/usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s node

/usr/share/elasticsearch/bin/elasticsearch-certutil cert

/usr/share/elasticsearch/bin/elasticsearch --enrollment-token eyJ2ZXIiOiI4LjguMiIsImFkciI6WyIxOTIuMTY4LjE4Mi4xNDI6OTIwMCJdLCJmZ3IiOiIxNDdjOWE5NGMwZDUwNTk2NWMwYWE0MmEyNDg3YzVkMjUyMWYzNjc5Y2QxZmMxOTBmYTg5ZDUxOTJlOTM1NjE4Iiwia2V5IjoibTkzMUZJa0JtRy1SVjJfNjZfYzk6M0hZN0Mxam5Uak9LWEVJQTJpN3BjUSJ9

常见问题汇总:

1.ERROR: Skipping security auto configuration because it appears that the node is not starting up for the first time. The node might already be part of a cluster and this auto setup utility is designed to configure Security for new clusters only

这个是因为安装好之后启动过一次,之后注册节点没成功。

2.Skipping security auto configuration because this node is configured to bootstrap or to join a multi-node cluster, which is not supported

不能删除安全项配置,

xpack.security.enabled: true

xpack.security.enrollment.enabled: true

# Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents
xpack.security.http.ssl:
  enabled: true
  keystore.path: certs/http.p12

# Enable encryption and mutual authentication between cluster nodes
xpack.security.transport.ssl:
  enabled: true
  verification_mode: certificate
  keystore.path: certs/transport.p12
  truststore.path: certs/transport.p12
  1. ERROR: Skipping security auto configuration because it appears that security is already configured

    安装好之后配置了集群但是注册失败,具体原因还得继续排除

  2. java.security.cert.CertPathValidatorException: Path does not chain with any of the trust anchors

    这种问题是开启了安全模式,各个节点没有配置证书的原因导致

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

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

相关文章

使用gradio库的Plot模块创建交互式绘图界面

❤️觉得内容不错的话,欢迎点赞收藏加关注😊😊😊,后续会继续输入更多优质内容❤️ 👉有问题欢迎大家加关注私戳或者评论(包括但不限于NLP算法相关,linux学习相关,读研读博…

Mongodb-5.0.18-zip下载与安装

1.下载地址 Download MongoDB Community Server | MongoDB 2.创建一个文件夹和master.cfg的文件 说明:目的是让mongodb存放数据库的位置在mongodb文件里面。 2.1创建名为mongodb的文件夹 2.2master.cfg 说明:在mongodb5.0.18目录下创建master.cfg。 …

DeepSpeed使用体会

现在的模型越来越大,动辄几B甚至几百B。但是显卡显存大小根本无法支撑训练推理。例如,一块RTX2090的10G显存,光把模型加载上去,就会OOM,更别提后面的训练优化。 作为传统pytorch Dataparallel的一种替代,D…

Spring Cloud Alibaba 之 Nacos精讲

🍓 简介:java系列技术分享(👉持续更新中…🔥) 🍓 初衷:一起学习、一起进步、坚持不懈 🍓 如果文章内容有误与您的想法不一致,欢迎大家在评论区指正🙏 🍓 希望这篇文章对你有所帮助,欢…

ChatGPT炒股:批量自动提取股票公告中的表格并合并数据

首先,在ChatGPT中输入提示词: 写一段Python代码: F盘文件夹“新三板 2023年日常性关联交易20230704”中很多个PDF文件,用 Tabula提取这些PDF文件中第1页中的第2个表格,然后保存到表格文件中,文件标题名和…

选读SQL经典实例笔记03_DML和元数据

1. 复制数据到另一个表 1.1. sql insert into dept_east (deptno,dname,loc)select deptno,dname,locfrom deptwhere loc in ( NEW YORK,BOSTON ) 2. 复制表定义 2.1. 复制表结构,而不复制数据 2.2. MySQL 2.3. PostgreSQL 2.4. Oracle 2.5. sql create ta…

递归--Fibonacci数列 I

描述 众所周知,Fibonacci数列是一个著名数列。它的定义是: 本组题目共有 5 题,请分别用 5 种不同的方式来完成,并比较这些做法的时间。 本题要求采用第一种方法:递归,且不得使用数组记忆结果。 输入描述 …

备忘录方法--Fibonacci数列 IV

描述 众所周知,Fibonacci数列是一个著名数列。它的定义是: 本题要求采用第四种方法:备忘录方法,即记忆化搜索。 具体做法是:用数组把曾经求出来的 Fibonacci 数列保存下来,以后要的时候直接取出来。 输入…

【剑指offer】5.重建二叉树(java)

文章目录 重建二叉树描述示例1示例2示例3思路完整代码 重建二叉树 描述 给定节点数为 n 的二叉树的前序遍历和中序遍历结果,请重建出该二叉树并返回它的头结点。 例如输入前序遍历序列{1,2,4,7,3,5,6,8}和中序遍历序列{4,7,2,1,5,3,8,6},则重建出如下…

vue+electron项目实战总结(遇到了哪些问题,是如何解决的,哪个阶段需要做什么,附带一些常用方法)

electron作为一个将网页打包成桌面应用的工具 非常强大,在使用electron的时候 要相信 它可以实现所有现代软件能够支撑的功能,下面我总结一下我在 vueelectron经过4次 大版本更新才趋于稳定的开发经验。 一、开发套路: 消息通信数据驱动 使用…

LIN总线与RS485总线

LIN(Local Interconnect Network,局部互连网络)总线和RS485都是用于设备间通信的串行通信协议。下面我将分别列出它们的优势和劣势。 LIN总线的优势: 简单性:LIN总线的硬件和协议简单,易于实现和维护。成…

多元回归预测 | Matlab基于逻辑回归(Logistic Regression)的数据回归预测,多输入单输出模型

文章目录 效果一览文章概述部分源码参考资料效果一览 文章概述 多元回归预测 | Matlab基于逻辑回归(Logistic Regression)的数据回归预测,多输入单输出模型 评价指标包括:MAE、RMSE和R2等,代码质量极高,方便学习和替换数据。要求2018版本及以上。 部分源码 %% 清空环境变量…

炸裂了…京东一面索命40问,过了就50W+

说在前面 在40岁老架构师尼恩的(50)读者社区中,经常有小伙伴,需要面试京东、阿里、 百度、头条、美团等大厂。 下面是一个小伙伴成功拿到通过了京东一次技术面试,最终,小伙伴通过后几面技术拷问、灵魂拷问…

MySQL的存储引擎与基本使用

目录 一、前言 1.MySQL的介绍 二、存储引擎 1.什么是存储引擎 2.常见存储引擎 2.1.InnoDB(MySQL默认引擎) 2.1.1.四种隔离级别 2.2.MyISAM存储引擎 2.3.Memory存储引擎 3.ACID事务 三、CRUD操作 1.插入数据 2.查询数据 3.修改数据 4.删除数据 四、数据库 1.默认…

C#学习之路-基本语法

C# 是一种面向对象的编程语言。在面向对象的程序设计方法中,程序由各种相互交互的对象组成。相同种类的对象通常具有相同的类型,或者说,是在相同的 class 中。 using System; using System.Collections.Generic; using System.Linq; using S…

OpenCV库进行图像旋转、仿射变换和透视变换

#include <iostream> #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp>

解决Linux操作系统ping不同www.baidu.com问题

首先给自己管理员权限 输入代码 su然后输入密码密码不会显示打完直接回车 输入下面代码配置网络 cd /etc/sysconfig/network-scripts 输入以下代码进入ens33管理 vim ifcfg-ens33 输入 i i用方向键把光标移到 ONBOOT NO 把 no 改为 yes 按下 ESC 退出编辑模式 直接敲…

二叉树前中后序的非递归实现

前言 &#xff1a; 递归我们会有一些问题的 为什么有递归就一定有非递归呢&#xff1f;&#xff1f;首先递归是有一定缺陷的 递归真正的缺陷是&#xff0c;每一个程序运行起来呢都是一个线程的形式&#xff0c;但是每一个线程都会有独立的栈空间&#xff0c;但是栈空间是很…

Spring Boot 中的 Future 接口是什么,如何使用

Spring Boot 中的 Future 接口是什么&#xff0c;如何使用 在异步编程中&#xff0c;我们通常需要处理一些耗时的操作。一种常见的做法是使用 Future 接口来代表一个异步操作的结果。在 Spring Boot 中&#xff0c;Future 接口被广泛应用于异步编程中&#xff0c;本文将介绍 S…

【C++】VSCode 使用 C/C++ Compile Run 插件时,设置默认运行的编译参数的方法

为什么要设置参数 最近在学习C&#xff0c;在学习多线程的时候&#xff0c;发现使用C11中的thread类写的代码编译会报错&#xff1a; * 正在执行任务: g -Wall -Wextra -g3 /Users/anweiyang/studySrc/C/ThreadTest.cpp -o /Users/anweiyang/studySrc/C/output/ThreadTest /U…