首页 > 系统相关 >CentOS 7 安装 ElasticSearch 8.5

CentOS 7 安装 ElasticSearch 8.5

时间:2022-11-11 18:11:05浏览次数:80  
标签:8.5 CentOS ## cluster ElasticSearch ES elasticsearch es

参考:

  1. Install Elasticsearch from archive on Linux or MacOS | Elasticsearch Guide [8.5] | Elastic
  2. Install Kibana from archive on Linux or macOS | Kibana Guide [8.5] | Elastic

在 CentOS7 服务器上安装 ES 8.5 的流程如下:

安装

假定 ES 安装在 /usr/local/elasticsearch 目录下

# 进入目录
cd /usr/local/elasticsearch

# 下载安装包
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.5.0-linux-x86_64.tar.gz

# 解压,es 安装在 /usr/local/elasticsearch 目录下
tar -xvzf elasticsearch-8.5.0-linux-x86_64.tar.gz

配置

创建 es 用户

由于 ES 7.x 的版本中安装成功之后不能以root用户来直接启动,需要新建一个用户来启动ES,流程如下

# 创建用户
adduser es

# 创建用户密码,需要输入两次
passwd es

# 将ES文件夹权限赋给创建的用户
chown -R es elasticsearch-8.5.0

# 切换到用户es
su es
# 龙蜥操作系统下要使用如下命令切换
/usr/bin/su es 

修改JVM内存

由于安装服务器配置较低,因此需要调整 ES 的 JVM 参数,具体如下:

修改 conf/jvm.options文件,调整:-Xms 、-Xmx 参数,修改为如下

################################################################
## 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:
##
-Xms512m
-Xmx512m
##
## See https://www.elastic.co/guide/en/elasticsearch/reference/8.5/heap-size.html
## for more information
##
################################################################

安全配置

参考:security-settings 做安全配置修改,主要修改:xpack.security.http.ssl.enabled:false 支持http方式访问

# Enable security features
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: false
  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
# Create a new cluster with the current node only
# Additional nodes can still join the cluster later
cluster.initial_master_nodes: ["VM-0-5-centos"]

# 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

启动

启动ES流程如下:

# 切换用户
su es

# 进入 $ES_HOME/bin 启动es
./elasticsearch

输出如下为启动正常:

{
  "name" : "***-centos",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "WM5gOChKR6yL5HCQ-HCumA",
  "version" : {
    "number" : "8.5.0",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "c94b4700cda13820dad5aa74fae6db185ca5c304",
    "build_date" : "2022-10-24T16:54:16.433628434Z",
    "build_snapshot" : false,
    "lucene_version" : "9.4.1",
    "minimum_wire_compatibility_version" : "7.17.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "You Know, for Search"
}

启动日志中包含如下内容,注意这中间的密码在后续访问过程中会被使用:

✅ Elasticsearch security features have been automatically configured!
✅ Authentication is enabled and cluster connections are encrypted.

ℹ️  Password for the elastic user (reset with `bin/elasticsearch-reset-password -u elastic`):
  es-123456

ℹ️  HTTP CA certificate SHA-256 fingerprint:
  *************

ℹ️  Configure Kibana to use this cluster:
• Run Kibana and click the configuration link in the terminal when Kibana starts.
• Copy the following enrollment token and paste it into Kibana in your browser (valid for the next 30 minutes):
  *************

ℹ️  Configure other nodes to join this cluster:
• On this node:
  ⁃ Create an enrollment token with `bin/elasticsearch-create-enrollment-token -s node`.
  ⁃ Uncomment the transport.host setting at the end of config/elasticsearch.yml.
  ⁃ Restart Elasticsearch.
• On other nodes:
  ⁃ Start Elasticsearch with `bin/elasticsearch --enrollment-token <token>`, using the enrollment token that you generated.

测试

测试是否启动正常:

# 测试启动效果
# 用户名为:elastic,密码为:上述日志中的: es-123456 (修改为你日志中的输出)
curl --user elastic:<password> -XGET 'localhost:9200/_cat/health?v&pretty'

注意如果忘记密码,可以通过如下命令重置密码(重置后需要重启es):

# 进入 $ES_HOME/bin 执行 elasticsearch-reset-password ,注意需要先启动es后执行
./elasticsearch-reset-password -u elastic -i

标签:8.5,CentOS,##,cluster,ElasticSearch,ES,elasticsearch,es
From: https://www.cnblogs.com/h9527/p/16881349.html

相关文章

  • Linux下(CentOS)下Docker的安装
    Linux下(CentOS)下Docker的安装以及阿里云加速器的配置什么是Docker?Docker是一个开源的应用容器引擎。让开发者可以打包他们的应用以及依赖包到一个可移植的镜像中,然后发布到......
  • 电影推荐系统项目实战:环境配置与安装:-----Linux环境下 ElasticSearch(单节点)环境配置
    1通过WGET下载压缩包:wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.2.tar.gz  2.修改Linux配置参数:在文件末尾添加:sudo......
  • LINUX CENTOS7 部署步骤 Ftp
    0.linux中FTP服务叫做vsftpd1.查看ftp是否安装rpm-qa|grepftp2.查找vsftpyumlist|grepvsftp3.安装vsftpdyum-yinstallvsftpd4.验证是否安装......
  • Elasticsearch_API操作
     Elasticsearch的Java客户端非常强大;它可以建立一个嵌入式实例并在必要时运行管理任务。运行一个Java应用程序和Elasticsearch时,有两种操作模式可供使用。该应用程序可在El......
  • CentOS7 安装mysql8
    1、下载并解压mysql安装包https://downloads.mysql.com/archives/community/  放到服务器后解压-C放到指定文件夹tar-xvfmysql-8.0.30-linux-glibc2.12-x86......
  • K8s部署,基于VMware+centOS7.9
    镜像来源于阿里云的centos镜像,安装VMware过程省略搭建一个master节点,三个node节点。配置都是2c8g安装前准备所有的节点都需要进行此操作1:所有节点禁止防火墙systemctl......
  • Windows和Centos7安装uWSGI
    uWSGI是一个Web服务器,它实现了WSGI协议、uwsgi、http等协议。Nginx中HttpUwsgiModule的作用是与uWSGI服务器进行交换。WSGI是一种Web服务器网关接口。它是一个Web服务器(如n......
  • ElasticSearch7.0实例精讲之第一章入门
    目录1、技术要求2、下载并安装Elasticserch3、设置网络4、设置节点5、设置linux系统6、设置不同的节点系统7、设置协调器节点8、设置采集节点9、在elasticsearch安装插件10......
  • .net ElasticSearch-Sql 扩展类【原创】
    ElasticSearch-Sql.net类库(sdk)1)支持将查询结果转换成datatable形式,便于界面绑定和数据导出等。2)代码简单易懂,便于改进并提高稳定性和性能。(拷贝立即......
  • GVM安装部署(CentOS 8.5)
    CentOS-8-x86_64-1905-dvd1.isoyumupdate更新到8.5.2111版本   sed-i's/mirrorlist/#mirrorlist/g'/etc/yum.repos.d/CentOS-*sed-i's|#baseurl=htt......