ubuntu系统安装elasticsearch

ubuntu安装es有两种方法

安装es

方法一:使用 DEB 包安装(推荐)
1.下载 Elasticsearch 7.10.0 DEB 包
bash 复制代码
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.10.0-amd64.deb
2.安装 DEB 包
bash 复制代码
sudo dpkg -i elasticsearch-7.10.0-amd64.deb
方法二:使用 APT 仓库安装
1.导入 Elasticsearch GPG 密钥
bash 复制代码
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
2. 添加 Elasticsearch 仓库
bash 复制代码
echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-7.x.list
3. 安装指定版本
bash 复制代码
sudo apt-get update
sudo apt-get install elasticsearch=7.10.0

配置 Elasticsearch 7.10.0

1. 编辑配置文件
bash 复制代码
sudo nano /etc/elasticsearch/elasticsearch.yml
bash 复制代码
# 集群名称
cluster.name: my-applicationc

# 节点名称
node.name: node-1

# 数据存储路径
path.data: /var/lib/elasticsearch

# 日志存储路径
path.logs: /var/log/elasticsearch

# 内存锁定的设置(可选)
bootstrap.memory_lock: false

# 网络绑定地址,可以所有ip连接
network.host: 0.0.0.0

# HTTP 端口
http.port: 9200

cluster.initial_master_nodes: ["node-1"]

# 发现设置,这个跟上面选择一个
#discovery.type: single-node
# 安全设置(7.x 版本重要)
xpack.security.enabled: false
2.配置 JVM 堆内存
bash 复制代码
sudo nano /etc/elasticsearch/jvm.options

修改内存设置(根据服务器配置调整):

bash 复制代码
-Xms1g
-Xmx1g

系统配置优化

1. 增加内存锁定限制
bash 复制代码
sudo nano /etc/security/limits.conf

添加以下内容:

bash 复制代码
elasticsearch soft memlock unlimited
elasticsearch hard memlock unlimited
elasticsearch - nofile 65536
elasticsearch - nproc 4096
2. 增加虚拟内存限制
bash 复制代码
sudo nano /etc/sysctl.conf

添加:

bash 复制代码
vm.max_map_count=262144

应用配置:

bash 复制代码
应用配置:

启动 Elasticsearch

1. 重新加载 systemd
bash 复制代码
sudo systemctl daemon-reload
2. 启用服务
bash 复制代码
sudo systemctl enable elasticsearch
3. 启动服务
bash 复制代码
sudo systemctl start elasticsearch
4. 检查状态
bash 复制代码
sudo systemctl status elasticsearch

验证安装

1. 测试 Elasticsearch 是否运行
bash 复制代码
curl -X GET "http://localhost:9200/"

正常响应应该类似:

bash 复制代码
{
  "name" : "node-1",
  "cluster_name" : "my-es-cluster",
  "cluster_uuid" : "xxxxxxxx",
  "version" : {
    "number" : "7.10.0",
    "build_flavor" : "default",
    "build_type" : "deb",
    "build_hash" : "xxxxxx",
    "build_date" : "2020-11-09T21:30:33.964949Z",
    "build_snapshot" : false,
    "lucene_version" : "8.7.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

在其他机器上测试

bash 复制代码
curl http://192.168.190.154:9200/
相关推荐
神筆&『馬良』13 小时前
Foundation_pose在自己的物体上复现指南:实现任意物体6D位姿检测(利用realsense_D435i和iphone_16pro手机)
目标检测·ubuntu·机器人·视觉检测
闲人编程13 小时前
Elasticsearch搜索引擎集成指南
python·elasticsearch·搜索引擎·jenkins·索引·副本·分片
先跑起来再说14 小时前
Git 入门到实战:一篇搞懂安装、命令、远程仓库与 IDEA 集成
ide·git·后端·elasticsearch·golang·intellij-idea
liuniu081814 小时前
VMware虚拟机安装ubuntu2022
ubuntu·ros
Dxy123931021615 小时前
深度解析 Elasticsearch:从倒排索引到 DSL 查询的实战突围
大数据·elasticsearch·搜索引擎
xfddlm15 小时前
边缘计算_ubuntu环境下使用瑞芯微RK3576NPU推理LLM
人工智能·ubuntu·边缘计算
EHagSJVNpTY16 小时前
MATLAB 中基于最大重叠离散小波变换的心电信号处理探索
ubuntu
.小墨迹16 小时前
apollo学习之借道超车的速度规划
linux·c++·学习·算法·ubuntu
技术路上的探险家17 小时前
Ubuntu下Docker与NVIDIA Container Toolkit完整安装教程(含国内源适配)
linux·ubuntu·docker
Dxy123931021617 小时前
别再让 ES 把你拖垮!5 个实战技巧让搜索性能提升 10 倍
大数据·elasticsearch·搜索引擎