曂沅仴駦 发表于 2025-3-24 21:33:47

YDOOK-云计算-ubuntu24.04-安装-ElasticSearch-直接服务器安装

YDOOK-Jinwei Lin
平台:腾讯云-轻量应用服务器-ubuntu24.04 LTS
首先更新软件列表:
sudo apt update 安装Java运行时环境(JRE)或开发工具包(JDK)- V17
sudo apt install openjdk-17-jdk -y 添加Elastic官方的GPG密钥到体系以验证下载的软件包
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elastic-keyring.gpg 添加Elastic的APT源
echo "deb https://artifacts.elastic.co/packages/8.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-8.x.list  再次更新软件列表:
sudo apt update 开始安装 Elasticsearch
sudo apt install elasticsearch -y 修改/etc/elasticsearch/elasticsearch.yml文件:
https://i-blog.csdnimg.cn/direct/3f561c97bb574d6982e88a27ce9ef302.png
https://i-blog.csdnimg.cn/direct/7f22d8ab171546039d7087d5202d872a.png
https://i-blog.csdnimg.cn/direct/9f6d450444784138ad3d28a8dc5d6e38.png
 启动 Elasticsearch 服务,并设置该服务开机自动启动:
sudo systemctl start elasticsearch
sudo systemctl enable elasticsearch 检察 Elasticsearch 当前的状态:
sudo systemctl status elasticsearch 修改 Elasticsearch 运行时间JVM的内存大小:
/etc/elasticsearch# /etc/elasticsearch/jvm.options https://i-blog.csdnimg.cn/direct/1ded6415e519483780edf7b5b1999502.png
修改配置后重新启动 Elasticsearch:
sudo systemctl restart elasticsearch 假如使用下面命令仍旧无法测试:
 
curl -X GET "localhost:9200/" 应该为服务器中需要通过Elasticsearch的默认用户名与暗码进行访问,
因为安装时没有给出,以是通过下面命令,修改Elasticsearch默认暗码:
sudo /usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic -i 上述命令需要在 Elasticsearch 运行的时间进行:
https://i-blog.csdnimg.cn/direct/cecc3df890e04bd99ec11ebfefb85a02.png
修改暗码乐成后,使用下面命令测试:
curl -u elastic:<password> -X GET "https://10.1.12.16:9200/_cluster/health?pretty" https://i-blog.csdnimg.cn/direct/a5931c7a87ab4619815eb762d907d3fb.png
输出测试结果:
ubuntu@VM-12-16-ubuntu:/etc/elasticsearch$ curl -k -u elastic:<password> -X GET "https://10.1.12.16:9200/_cluster/health?pretty"
{
"cluster_name" : "elasticsearch",
"status" : "green",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 3,
"active_shards" : 3,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 0,
"unassigned_primary_shards" : 0,
"delayed_unassigned_shards" : 0,
"number_of_pending_tasks" : 0,
"number_of_in_flight_fetch" : 0,
"task_max_waiting_in_queue_millis" : 0,
"active_shards_percent_as_number" : 100.0
}





免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页: [1]
查看完整版本: YDOOK-云计算-ubuntu24.04-安装-ElasticSearch-直接服务器安装