redhat 9.2 安装 elasticsearch-7.17.3 过程记录

server/2025/7/9 5:39:06/

1. 确认 redhat 版本号:

 > cat /etc/redhat-release:> Red Hat Enterprise Linux release 9.2 (Plow)

2. 新建 elasticsearch 目录:

 > cd /data/software && mkdir  elasticsearch && cd elasticsearch

3. 下载 elasticsearch-7.17.3-linux-x86_64.tar.gz:

> wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.17.3-linux-x86_64.tar.gz

 下载失败也可以去其他地方下载( 比如迅雷 ),然后上传到该目录。

4. 解压 elasticsearch-7.17.3-linux-x86_64.tar.gz:

> tar -xzf elasticsearch-7.17.3-linux-x86_64.tar.gz

5. 

> cd elasticsearch-7.17.3 && mkdir data && mkdir tmpdir

6.  cd config &&  vim elasticsearch.yml,添加如下内容:

 cluster.initial_master_nodes: ["es-node-1"]  	// 不加启动 es 会报错 the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configuredpath.data: /data/software/elasticsearch/elasticsearch-7.17.3/datapath.logs: /data/software/elasticsearch/elasticsearch-7.17.3/logsnetwork.host: 0.0.0.0 							// 不加只能使用 http://127.0.0.1:9200 访问,不能用 具体 ip 访问ingest.geoip.downloader.enabled: false   		// 不加可能如果网络不好,java 调用 es api 会超时,然后 es 日志会发现类似 "error downloading geoip database [GeoLite2-Country.mmdb]" 的错误

7. 修改 es 的默认 /tmp 目录:

有时候启动 es 会报类似 "Exception in thread “main” java.nio.file.AccessDeniedException: /tmp/elasticsearch-8523317643108022907..." 的错误,因为 No space left 或者 no permission 等,可以手动修改 es 默认使用的 /tmp 目录:

    1. vim  /data/software/elasticsearch/elasticsearch-7.17.3/bin/elasticsearch,在 "if [ -z "$ES_TMPDIR" ]; then" 上一行新增 ES_TMPDIR="/data/software/elasticsearch/elasticsearch-7.17.3/tmpdir"2. vim /data/software/elasticsearch/elasticsearch-7.17.3/bin/elasticsearch-env,在 "if [ ! -z "$ES_JAVA_HOME" ]; then" 上一行新增 ES_JAVA_HOME="/data/software/elasticsearch/elasticsearch-7.17.3/jdk"

8. 启动 es:

    1. cd /data/software/elasticsearch/elasticsearch-7.17.3/bin && ./elasticsearch        // 前台启动 2. cd /data/software/elasticsearch/elasticsearch-7.17.3/bin && ./elasticsearch -d     // 后台启动 

9. 安装 ik分词器:
            1. 下载 elasticsearch-analysis-ik-7.17.3.zip( 下载地址:https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.17.3/elasticsearch-analysis-ik-7.17.3.zip )
            2. cd /data/software/elasticsearch/elasticsearch-7.17.3/plugins && mkdir analysis-ik
            3. 将下载好的 elasticsearch-analysis-ik-7.17.3.zip 上传到 analysis-ik 目录
            4. unzip elasticsearch-analysis-ik-7.17.3.zip
            5. 重启 elasticSearch

10. elasticSearch 常见 API:
            1. http://127.0.0.1:9200/_cat/nodes?v       # 查看所有节点
            2. http://127.0.0.1:9200/_cat/health?v      # 查看 elasticSearch 健康状况
            3. http://127.0.0.1:9200/_cat/indices?v     #  查看所有索引信息
            4. http://127.0.0.1:9200/index_article       #  查看索引 index_article 的信息
            5. http://127.0.0.1:9200/index_article  DELETE        #  删除索引 index_article
            6. http://127.0.0.1:9200/index_article/_mapping  DELETE        #  删除索引 index_article
            7. http://127.0.0.1:9200/index_article/_search          #  查询索引 index_article 中的全部数据
            8. http://127.0.0.1:9200/_analyze               # 测试分词器分词效果
                POST
                {
                    "text":"I prefer having your accompanying for life-long time to the short-time tenderness",
                    "analyzer":"standard"
                }

11. 设置用户名、密码:
            1. 修改 /data/software/elasticsearch/elasticsearch-7.17.3/config/elasticsearch.yml,添加 "xpack.security.enabled: true"
            2. cd  /data/software/elasticsearch/elasticsearch-7.17.3/bin  执行 ./elasticsearch-certutil cert -out config/elastic-certificates.p12 -pass "",发现证书 elastic-certificates.p12 生成到了 /data/software/elasticsearch/elasticsearch-7.17.3/config 中
            3. 修改 /data/software/elasticsearch/elasticsearch-7.17.3/config/elasticsearch.yml,添加以下4行:
                

    xpack.security.transport.ssl.enabled: truexpack.security.transport.ssl.verification_mode: certificatexpack.security.transport.ssl.keystore.path: elastic-certificates.p12xpack.security.transport.ssl.truststore.path: elastic-certificates.p12


            4. 重启 es,浏览器请求 http://127.0.0.1:9200/ 提示让输入用户名和密码了
            5. 设置密码:
                cd  /data/software/elasticsearch/elasticsearch-7.17.3/bin 执行 ./elasticsearch-setup-passwords interactive,选择 y,根据提示为分别为用户 elastic、apm_system、kibana_system、logstash_system、beats_system、remote_monitoring_user 设置密码


http://www.ppmy.cn/server/98180.html

相关文章

Promethues Metrics

Metrics Metrics可分为三部分: HELP 描述metric作用TYPE metric类别 TYEP Counter 某个事件发生的次数数字只能增长 Total reuqests Total ExceptionsGauge 描述当前值可以上升或下降 CurrentCPU Utilization Available System Memory Number of concurren…

用户看广告获取密码访问网页内容流量主模式源码

全开源付费进群流量主模式,用户看广告获取密码访问网页内容,网站生成内容,用户需要浏览内容跳转至小程序,观看广告后获取密码,输入密码查看网页内容。 与之前得9.9付费进群区别就是内容体现在了网页里,用户…

Openlayers6之地图覆盖物Overlay详解及使用,地图标注及弹窗查看详情(结合React)

demo案例:用户实现地图加载人员位置定位,并设置人员图片文字等标注,点击定位点查看人员详情。 主要通过ol/geom Point设置Style和ol/Overlay实现。主要实现步骤: 实现图文标注的实质是添加点时设置Ponit的样式,图片标…

给python初学者的一些建议

写在开篇 关于Python,可以这么说,这几年借着数据科学、机器学习与人工智能的东风,Python 老树开新花,在风口浪尖上居高不下。 Python 之所以这么受大家的青睐,是因为它语言简洁,上手容易,让非…

千里江山图,自动化成诗:Expect脚本详解——从入门到进阶的自动化利器

目录 引言 Expect脚本基础 什么是Expect 基本语法 进阶应用 错误处理 正则表达式 并发处理 使用Shell脚本管理多个Expect脚本 在Expect脚本内部模拟并发 脚本复用与模块化 总结 引言 在自动化运维和测试领域,Expect脚本无疑是一把强大的利器。它以其灵…

python爬虫学习记录-请求模块urllib3

(文章内容仅作学习交流使用) urllib3是一个功能强大、条理清晰,用于HTTP客户端的第三方模块 urllib3-发送网络请求 使用urllib3发送网络请求时,需要先创建PoolManager对象,并使用该对象的request方法发送请求&#…

关于手机中的红外遥控

在手机电路中,有这么不起眼的一部分,虽看似简单,但是却给我们的生活在一定程度上带来了极大的便捷-红外遥控部分。 其置于手机顶部,并在壳体处挖开一个小孔,用于红外信号对外界的传递。如果你感兴趣的话,不…

简单安装Android Studio并使用

在Windows上安装Android Studio的步骤如下: ### 1. 检查系统要求 确保你的计算机符合Android Studio的系统要求,通常包括: - Windows 8/10/11 - 64位处理器 - 最少4 GB RAM(推荐8 GB) - 最少2 GB可用硬盘空间&#xff…