首页 > 其他分享 >es8.15单机部署

es8.15单机部署

时间:2024-09-14 16:53:07浏览次数:1  
标签:elastic 单机 部署 ssl ## elasticsearch security root es8.15

1.下载需要的安装版本
我这里下载的是6.8.5,elasticsearch-8.15.1-linux-x86_64.tar.gz
下载地址:
https://www.elastic.co/cn/downloads/past-releases#elasticsearch

 

2.创建中间件安装目录和数据文件、日志文件目录
[root@hadoop-slave1 soft]# mkdir -p /usr/local/services
[root@hadoop-slave1 soft]# mkdir -p /home/middle/elasticsearch/data
[root@hadoop-slave1 soft]# mkdir -p /home/middle/elasticsearch/logs

 

3.创建用户和用户组
[root@pg1 elasticsearch]# groupadd -g 1500 elasticsearch
[root@pg1 elasticsearch]# useradd -u 1500 -g elasticsearch elasticsearch
[root@pg1 elasticsearch]# passwd elasticsearch

 

4.上传到服务器
解压缩并创建数据目录
[root@hadoop-slave1 soft]# tar -xvf elasticsearch-8.15.1-linux-x86_64.tar.gz
[root@localhost soft]# mv elasticsearch-8.15.1 /usr/local/services/elasticsearch

 

5.将elasticsearch目录权限修改为elasticsearch
[root@hadoop-slave1 config]# cd /usr/local/services
[root@hadoop-slave1 services]# chown -R elasticsearch:elasticsearch ./elasticsearch
同时修改数据文件和日志文件目录给到elasticsearch

[root@hadoop-slave1 services]# cd /home/middle
[root@hadoop-slave1 middle]# chown -R elasticsearch:elasticsearch ./elasticsearch

 

6.创建备份目录
su - elasticsearch
mkdir -p /home/middle/esbak

 

7.修改配置文件
[root@hadoop-slave1 middle]# su - elasticsearch
[elasticsearch@hadoop-slave1 ~]$ cd /usr/local/services/elasticsearch/config
[elasticsearch@hadoop-slave1 config]$ vi elasticsearch.yml

node.name: node01
path.data: /home/middle/elasticsearch/data
path.logs: /home/middle/elasticsearch/logs
network.host: 192.168.1.102
http.port: 19200
path.repo: /home/middle/esbak
##cluster.initial_master_nodes: ["node01"]
discovery.seed_hosts: ["192.168.1.102"]

##安全认证
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true

##第三方中间件配置参数,看情况需要

http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type

 

8.修改jvm参数( /usr/local/services/elasticsearch/config/jvm.options )

################################################################
## IMPORTANT: JVM heap size
################################################################
##
## The heap size is automatically configured by Elasticsearch
## based on the available memory in your system and the roles
## each node is configured to fulfill. If specifying heap is
## required, it should be done through a file in jvm.options.d,
## which should be named with .options suffix, and the min and
## max should be set to the same value. For example, to set the
## heap to 4 GB, create a new file in the jvm.options.d
## directory containing these lines:
##
## -Xms4g
## -Xmx4g
##
## See https://www.elastic.co/guide/en/elasticsearch/reference/8.15/heap-size.html
## for more information
##
################################################################

-Xms3g
-Xmx3g

 

 

9.系统参数设置
每个节点上都要执行,这里确保每台机器都能启动
[root@rac01 middle]# su - elasticsearch
[elasticsearch@rac01 ~]$ ulimit -Hn
65536

检查是否是65536,不是的话修改修改
/etc/security/limits.conf,该文件最后加入

* soft nofile 65536
* hard nofile 65536

报错的话:
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
在/etc/sysctl.conf 文件最后添加一行
[root@localhost ~]#vm.max_map_count=262144
[root@localhost ~]#sysctl -p

10.启动
su - elasticsearch
[elasticsearch@hadoop-slave1 ~]$ cd /usr/local/services/elasticsearch/bin
./elasticsearch -d

报错:
[2024-09-14T15:01:13,383][ERROR][o.e.b.Elasticsearch ] [master] fatal exception while booting Elasticsearchorg.elasticsearch.ElasticsearchSecurityException: invalid SSL configuration for xpack.security.transport.ssl - server ssl configuration requires a key and certificate, but these have not been configured; you must set either [xpack.security.transport.ssl.keystore.path], or both [xpack.security.transport.ssl.key] and [xpack.security.transport.ssl.certificate]

 

生成证书:
su - elasticsearch
[elasticsearch@rac01 bin]$ cd /usr/local/services/elasticsearch/bin
[elasticsearch@master bin]$ ./elasticsearch-certutil ca
一路回车

[elasticsearch@rac01 bin]$./elasticsearch-certutil cert --ca elastic-stack-ca.p12
一路回车

[elasticsearch@master elasticsearch]$ pwd
/usr/local/services/elasticsearch
[elasticsearch@master elasticsearch]$ ls
bin elastic-certificates.p12 jdk LICENSE.txt modules plugins
config elastic-stack-ca.p12 lib logs NOTICE.txt README.asciidoc

这个时候会生成 elastic-certificates.p12 和 elastic-stack-ca.p12 这2个文件
将这两个文件拷贝到config目录下面
[elasticsearch@master elasticsearch]$ cd /usr/local/services/elasticsearch
[elasticsearch@master elasticsearch]$ mv elastic-certificates.p12 ./config/
[elasticsearch@master elasticsearch]$ mv elastic-stack-ca.p12 ./config/

 

修改配置文件:
[root@rac01 middle]# su - elasticsearch
vi /usr/local/services/elasticsearch/config/elasticsearch.yml
添加如下配置项
xpack.security.transport.ssl.verification_mode: certificate
xpack.security.transport.ssl.keystore.path: elastic-certificates.p12
xpack.security.transport.ssl.truststore.path: elastic-certificates.p12

 

最后的配置文件如下:

node.name: node01
path.data: /home/middle/elasticsearch/data
path.logs: /home/middle/elasticsearch/logs
network.host: 192.168.1.102
http.port: 19200
path.repo: /home/middle/esbak
##cluster.initial_master_nodes: ["node01"]
discovery.seed_hosts: ["192.168.1.102"]

xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate
xpack.security.transport.ssl.keystore.path: elastic-certificates.p12
xpack.security.transport.ssl.truststore.path: elastic-certificates.p12

xpack.security.http.ssl.enabled: true
xpack.security.http.ssl.verification_mode: certificate
xpack.security.http.ssl.keystore.path: elastic-certificates.p12
xpack.security.http.ssl.truststore.path: elastic-certificates.p12


http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type

 

重新启动
su - elasticsearch
[elasticsearch@hadoop-slave1 ~]$ cd /usr/local/services/elasticsearch/bin
./elasticsearch -d

 

11.验证
这个时候登陆会报错误

[elasticsearch@master bin]$  curl http://192.168.1.102:19200/?pretty
{
  "error" : {
    "root_cause" : [
      {
        "type" : "security_exception",
        "reason" : "missing authentication credentials for REST request [/?pretty]",
        "header" : {
          "WWW-Authenticate" : [
            "Basic realm=\"security\", charset=\"UTF-8\"",
            "ApiKey"
          ]
        }
      }
    ],
    "type" : "security_exception",
    "reason" : "missing authentication credentials for REST request [/?pretty]",
    "header" : {
      "WWW-Authenticate" : [
        "Basic realm=\"security\", charset=\"UTF-8\"",
        "ApiKey"
      ]
    }
  },
  "status" : 401
}

 

12.安装安全认证(我这里密码全部设置为 elastic)
[elasticsearch@master bin]$ cd /usr/local/services/elasticsearch/bin
[elasticsearch@master bin]$ ./elasticsearch-setup-passwords interactive
Initiating the setup of passwords for reserved users elastic,apm_system,kibana,logstash_system,beats_system,remote_monitoring_user.
You will be prompted to enter passwords as the process progresses.
Please confirm that you would like to continue [y/N]y

 

13.再次验证

[elasticsearch@master bin]$ curl -u elastic:elastic http://192.168.1.102:19200/?pretty
{
  "name" : "node01",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "dIn0vF6SSQWvyUJ5wqqKwA",
  "version" : {
    "number" : "8.15.1",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "253e8544a65ad44581194068936f2a5d57c2c051",
    "build_date" : "2024-09-02T22:04:47.310170297Z",
    "build_snapshot" : false,
    "lucene_version" : "9.11.1",
    "minimum_wire_compatibility_version" : "7.17.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "You Know, for Search"
}

 

标签:elastic,单机,部署,ssl,##,elasticsearch,security,root,es8.15
From: https://www.cnblogs.com/hxlasky/p/18414328

相关文章

  • Halo 开发者指南——容器私有化部署
    华为云SWR私有化部署镜像构建dockerbuild-thalo-dev/halo:2.20.0.上传镜像镜像标签sudodockertag{镜像名称}:{版本名称}swr.cn-south-1.myhuaweicloud.com/{组织名称}/{镜像名称}:{版本名称}sudodockertaghalo-dev/halo:2.20.0swr.cn-south-1.myhuaweicloud.c......
  • docker安装运行kafka单机版
    这里我们安装一下kafka的单机版,由于kafka是基于zk进行管理的,如果我们没有安装过zk的话,需要进行安装好zk再安装kafka,当然如果已经安装过了,那就没必要安装了。我们可以执行dockerimages命令查看我们的zk镜像是否已经存在了。执行的主要的流程如下所示:1.docker拉取zookeeper镜像......
  • Ubuntu系统Docker部署数据库管理工具DbGate并实现远程查询数据
    文章目录前言1.安装Docker2.使用Docker拉取DbGate镜像3.创建并启动DbGate容器4.本地连接测试5.公网远程访问本地DbGate容器5.1内网穿透工具安装5.2创建远程连接公网地址5.3使用固定公网地址远程访问前言本文主要介绍如何在LinuxUbuntu系统中使用Docker部......
  • 基于vue框架的宠物领养系统l3a76(程序+源码+数据库+调试部署+开发环境)系统界面在最后面
    系统程序文件列表项目功能:用户,宠物信息,宠物领养,宠物品种,团队信息,入团申请,团队活动开题报告内容基于Vue框架的宠物领养系统开题报告一、引言随着宠物文化的普及和人们对宠物情感的日益加深,宠物领养已成为社会关注的热点之一。然而,传统的宠物领养方式存在信息不对称......
  • 基于vue框架的宠物领养管理系统88v55(程序+源码+数据库+调试部署+开发环境)系统界面在最
    系统程序文件列表项目功能:用户,宠物分类,宠物信息,领养信息,宠物动态,捐赠物资,领养进度,友情链接开题报告内容基于Vue框架的宠物领养管理系统开题报告一、项目背景与意义随着社会的进步和人们生活水平的提高,宠物已成为许多家庭不可或缺的一部分。然而,宠物数量的激增也......
  • 基于vue框架的宠物交流平台1n2n3(程序+源码+数据库+调试部署+开发环境)系统界面在最后面
    系统程序文件列表项目功能:会员,宠物信息,宠物类型,团队信息,申请领养,团队申请,领养宠物开题报告内容基于Vue框架的宠物交流平台开题报告一、项目背景随着现代生活节奏的加快与人们情感需求的日益增长,宠物已成为众多家庭不可或缺的重要成员。它们不仅带来了陪伴与欢乐,还......
  • 基于vue框架的宠物寄养系统3d388(程序+源码+数据库+调试部署+开发环境)系统界面在最后面
    系统程序文件列表项目功能:用户,宠物信息,宠物分类,寄养店,宠物寄养,宠物领养,家庭环境,用户宠物开题报告内容基于Vue框架的宠物寄养系统开题报告一、引言随着人们生活水平的提高和宠物文化的普及,宠物已成为许多家庭不可或缺的一员。因此,宠物寄养服务作为宠物经济的一个重......
  • Docker方式部署ProxySQL和Keepalived组合实现MGR的高可用访问
    ProxySQL代理访问MGR,可以做到故障自动切换主节点,可以自定义访问规则实现读写分离目录网络架构一、环境准备二、软件安装1.MGR集群配置2.创建必要用户2.ProxySQL部署测试3.Keepalived部署高可用4.测试高可用网络架构一、环境准备三台物理主机:22.04.3-UbuntuLinux16核32G......
  • Docker部署tenine实现后端应用的高可用与负载均衡
    采用Docker方式的Tengine和keepalived组合模式可以实现小应用场景的高可用负载均衡需求目录网络架构一、环境准备二、软件安装1.下载Tenine镜像2.下载Keepalived镜像3.制作SpringBoot镜像三、软件配置1.创建应用容器2.代理访问应用3.创建Keepalived4.测试高可用网络架......
  • es8.15集群部署(tsl认证)
    环境:192.168.1.102192.168.1.103192.168.1.105--------------------------------------------基础安装-----------------------------------系统配置每个机器上都要执行1.系统参数配置修改limits.conf配置文件vi/etc/security/limits.confroot用户下添加如下2两项,然后退出使......