【centos8 ES】Elasticsearch linux 龙晰8操作系统安装

在龙晰8操作系统上安装 Elasticsearch 的步骤如下:

1. 安装 Java

Elasticsearch 需要 Java 环境,建议安装 OpenJDK 11 或更高版本。你可以使用以下命令来安装 OpenJDK:

bash 复制代码
sudo yum install java-11-openjdk-devel

2. 下载 Elasticsearch

你可以从 Elasticsearch 的官方网站下载最新版本的 Elasticsearch。使用 wget 命令下载:

bash 复制代码
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.x.x-linux-x86_64.tar.gz

3. 解压 Elasticsearch

下载完成后,解压 Elasticsearch 到指定目录:

bash 复制代码
tar -zxvf elasticsearch-8.x.x-linux-x86_64.tar.gz -C /usr/local

4. 创建 Elasticsearch 用户

出于安全考虑,Elasticsearch 不允许以 root 用户运行。因此,需要创建一个专用用户来运行 Elasticsearch:

bash 复制代码
sudo useradd esuser
sudo chown -R esuser:esuser /usr/local/elasticsearch-8.x.x

5. 修改配置文件

编辑 Elasticsearch 的配置文件 elasticsearch.yml,通常位于 /usr/local/elasticsearch-8.x.x/config 目录下。你需要设置集群名称、节点名称、网络主机等参数:

yaml 复制代码
cluster.name: my-cluster
node.name: node-1
network.host: 0.0.0.0
http.port: 9200

6. 启动 Elasticsearch

切换到 esuser 用户并启动 Elasticsearch:

bash 复制代码
sudo su - esuser
cd /usr/local/elasticsearch-8.x.x
./bin/elasticsearch

7. 验证安装

使用以下命令检查 Elasticsearch 是否成功启动:

bash 复制代码
curl -X GET "localhost:9200/"

如果 Elasticsearch 正在运行,你将看到类似于以下的输出:

json 复制代码
{
  "name" : "node-1",
  "cluster_name" : "my-cluster",
  "cluster_uuid" : "your-cluster-uuid",
  "version" : {
    "number" : "8.x.x",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "your-build-hash",
    "build_date" : "your-build-date",
    "build_snapshot" : false,
    "lucene_version" : "8.x.x",
    "minimum_wire_compatibility_version" : "7.x.x",
    "minimum_index_compatibility_version" : "7.x.x"
  },
  "tagline" : "You Know, for Search"
}

8. 设置开机自启动(可选)

如果你希望 Elasticsearch 在系统启动时自动启动,可以创建一个 systemd 服务文件:

bash 复制代码
sudo nano /etc/systemd/system/elasticsearch.service

添加以下内容:

ini 复制代码
[Unit]
Description=Elasticsearch
After=network.target

[Service]
Type=forking
User=esuser
ExecStart=/usr/local/elasticsearch-8.x.x/bin/elasticsearch -d
LimitNOFILE=65536
LimitNPROC=65536
LimitAS=infinity
LimitFSIZE=infinity
TimeoutStopSec=0
KillSignal=SIGTERM
KillMode=process
SendSIGKILL=no
SuccessExitStatus=143

[Install]
WantedBy=multi-user.target

然后启用并启动服务:

bash 复制代码
sudo systemctl daemon-reload
sudo systemctl enable elasticsearch
sudo systemctl start elasticsearch

通过以上步骤,你可以在龙晰8操作系统上成功安装并运行 Elasticsearch。

相关推荐
Nimsolax27 分钟前
Linux信号
linux
ajassi20004 小时前
开源 C++ QT Widget 开发(十五)多媒体--音频播放
linux·c++·qt·开源
JosieBook5 小时前
【远程运维】Linux 远程连接 Windows 好用的软件:MobaXterm 实战指南
linux·运维·windows
文档搬运工5 小时前
Linux MInt启动速度的优化
linux
Broken Arrows6 小时前
Linux学习——管理网络安全(二十一)
linux·学习·web安全
雁于飞6 小时前
vscode中使用git、githup的基操
笔记·git·vscode·学习·elasticsearch·gitee·github
Light607 小时前
领码方案|Linux 下 PLT → PDF 转换服务超级完整版:异步、权限、进度
linux·pdf·可观测性·异步队列·plt转pdf·权限治理·进度查询
羚羊角uou7 小时前
【Linux】命名管道
linux·运维·服务器
IT 小阿姨(数据库)7 小时前
PgSQL监控死元组和自动清理状态的SQL语句执行报错ERROR: division by zero原因分析和解决方法
linux·运维·数据库·sql·postgresql·centos
THMAIL7 小时前
量化股票从贫穷到财务自由之路 - 零基础搭建Python量化环境:Anaconda、Jupyter实战指南
linux·人工智能·python·深度学习·机器学习·金融