linux安装elasticsearch

首先创建个文件夹用于存放elasticsearch

bash 复制代码
 cd /opt/
 mkdir module
 cd module

根据官网提示下载 官网文档链接

bash 复制代码
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.15.0-x86_64.rpm
bash 复制代码
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.15.0-x86_64.rpm.sha512
bash 复制代码
shasum -a 512 -c elasticsearch-8.15.0-x86_64.rpm.sha512 

如果在执行 shasum -a 512 -c elasticsearch-8.15.0-x86_64.rpm.sha512 时提示未找到命令 shasum,可能是系统中没有安装 shasum 工具。

在 CentOS 或 Red Hat 系统上,可以尝试以下命令安装:我这里安装完还是不行

bash 复制代码
sudo yum install coreutils


不知道什么问题,懒得理了,换其他的命令校验

bash 复制代码
sha512sum -c elasticsearch-8.15.0-x86_64.rpm.sha512

安装

bash 复制代码
sudo rpm --install elasticsearch-8.15.0-x86_64.rpm

输出的信息中会有初始的elastic账号的密码

Elasticsearch 安装在 /usr/share/elasticsearch/

bash 复制代码
# 新增 es 用户
useradd es
# 为 es 用户设置密码
passwd es
# 创建数据文件目录
mkdir /usr/share/elasticsearch/data
# 创建证书目录
mkdir /usr/share/elasticsearch/config/certs
#切换目录
cd /usr/share/elasticsearch
# 修改文件拥有者
chown -R es:es /usr/share/elasticsearch
bash 复制代码
# 切换用户
su es
# 签发 ca 证书,过程中需按两次回车键
bin/elasticsearch-certutil ca
#提示:bin/elasticsearch-env:行78:/etc/sysconfig/elasticsearch: 权限不够

切换root目录给权限

bash 复制代码
# 用 ca 证书签发节点证书,过程中需按三次回车键
bin/elasticsearch-certutil cert --ca elastic-stack-ca.p12
# 将生成的证书文件移动到 config/certs 目录中
mv elastic-stack-ca.p12 elastic-certificates.p12 config/certs

elasticsearch.yml配置文件在/etc/elasticsearch/文件夹下,备份

bash 复制代码
 cd /etc/elasticsearch/
 cp elasticsearch.yml elasticsearch.yml.copy

要将 Elasticsearch 配置为在系统启动时自动启动,请运行以下命令:

root用户运行

bash 复制代码
sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable elasticsearch.service

Elasticsearch 可以按如下方式启动和停止:

bash 复制代码
sudo systemctl start elasticsearch.service
sudo systemctl stop elasticsearch.service

在环境变量里面设置密码:

bash 复制代码
export ELASTIC_PASSWORD="your_password"

检查 Elasticsearch 是否正在运行

9200您可以通过向端口发送 HTTPS 请求来测试 Elasticsearch 节点是否正在运行 localhost:

bash 复制代码
curl --cacert /etc/elasticsearch/certs/http_ca.crt -u elastic:$ELASTIC_PASSWORD https://localhost:9200 
相关推荐
HAPPY酷9 分钟前
【ROS2】16G 内存笔记本跑 ROS2 仿真?VMware 虚拟机“保姆级”配置指南 (R9 7940HX + RTX 4060)
java·linux·ide·windows·pycharm
donoot10 小时前
Linux系统下图书馆级电子书全自动标准化分类整理完整实施方案
大数据·linux·运维·电子书管理
Felix-lxd11 小时前
Ubuntu 22.04 配置 Nginx
linux·nginx·ubuntu
Elastic 中国社区官方博客11 小时前
如何比较两个 Elasticsearch 索引并找出缺失的文档
大数据·运维·数据库·elasticsearch·搜索引擎
Tim_Van12 小时前
在 CentOS 7 中安装 Chromium 的完整步骤
linux·运维·chrome·centos
2023自学中12 小时前
C++ 内存追踪器
linux·c++
啵啵鱼爱吃小猫咪13 小时前
Ubuntu 20.04 + ROS Noetic 源码安装 libfranka 0.8.0 和 franka_ros 0.8.0 完整教程
linux·运维·ubuntu
ljs64827395114 小时前
Linux运维实操:vi编辑器永久配置静态IP(CentOS系列)
linux·运维·编辑器
dddwjzx14 小时前
嵌入式Linux C应用编程入门——高级I/O
linux·嵌入式
阿里云大数据AI技术15 小时前
Elasticsearch 智能助手:Agent 让运维从经验驱动迈向智能协同
人工智能·elasticsearch·agent