linux离线安装elasticsearch8.19.3

下载:

官网多版本下载:
Past Releases of Elastic Stack Software | Elastic

github多版本下载:
https://github.com/elastic/elasticsearch/releases

上传后解压到当前目录

复制代码
tar -zxvf elasticsearch-8.19.3-linux-x86_64.tar.gz

或指定解压目录

复制代码
tar -xzf elasticsearch-8.19.3-linux-x86_64.tar.gz -C /opt/elasticsearch

创建data目录(存放数据)

复制代码
mkdir /opt/elasticsearch-8.19.3/data

logs目录:elasticsearch-8.19.3中自带了logs目录,直接使用

(es必须使用非root用户启动)创建启动es的用户

复制代码
useradd esuser

修改目录权限

复制代码
chown -R esuser /opt/elasticsearch-8.19.3

修改配置

修改jvm内存(设置大小自己根据机器估算)

/config/jvm.options

复制代码
## IMPORTANT: JVM heap size
-Xms265m
-Xmx4g

修改es设置

/config/elasticsearch.yml

复制代码
cluster.name: my-application
path.data: /opt/elasticsearch-8.19.3/data
path.logs: /opt/elasticsearch-8.19.3/logs
network.host: 0.0.0.0
http.port: 9200
# 关闭生产环境检查(仅用于本地测试!)
discovery.type: single-node

配置系统sevice服务

/etc/systemd/system/中创建文件elasticsearch.service

复制代码
[Unit]
Description=Elasticsearch
Documentation=https://www.elastic.co
Wants=network-online.target
After=network-online.target

[Service]
WorkingDirectory=/opt/elasticsearch-8.19.3
ExecStart=/opt/elasticsearch-8.19.3/bin/elasticsearch
#启动失败后自动重启
#Restart=always
User=esuser
Group=esuser

[Install]
WantedBy=multi-user.target

启动sevice服务

复制代码
systemctl start elasticsearch

查看日志

复制代码
tail -f /opt/elasticsearch-8.19.3/logs/my-application.log

设置密码

es8默认启用了安全策略,启动后就有密码了在日志中可以查找

启动后自定义密码

复制代码
./bin/elasticsearch-reset-password -u elastic -i

验证是否可用

浏览器访问https://yourip:9200(注意用https)输入密码

或

复制代码
curl -k -u 'elastic:yourpassword' https://localhost:9200/

安装kibana

官网多版本下载

Past Releases of Elastic Stack Software | Elastic

解压缩

复制代码
tar -zxvf kibana-8.19.3-linux-x86_64.tar.gz

修改目录权限

复制代码
chown -R esuser /opt/kibana-8.19.3

修改用户kibana_system密码

回到es8修改用户密码

es8禁止直接使用内置的 elastic 超级用户来运行 Kibana

复制代码
/opt/elasticsearch-8.19.3/bin/elasticsearch-reset-password -u kibana_system -i

修改配置

/opt/kibana-8.19.3/config/kibana.yml

复制代码
server.port: 5601
server.host: "0.0.0.0"
server.name: "kibana-server"
elasticsearch.hosts: ["https://localhost:9200"]
elasticsearch.username: "kibana_system"
elasticsearch.password: "elastic"
elasticsearch.ssl.certificateAuthorities: [ "/opt/elasticsearch-8.19.3/config/certs/http_ca.crt" ]

logging.appenders.default:
 type: rolling-file
 fileName: /opt/kibana-8.19.3/logs/kibana.log
 policy:
   type: size-limit
   size: 256mb
 strategy:
   type: numeric
   max: 10
 layout:
   type: json

设置service服务

/etc/systemd/system/中创建文件kibana.service

复制代码
[Unit]
Description=Kibana
Documentation=https://www.elastic.co
After=network.target

[Service]
WorkingDirectory=/opt/kibana-8.19.3
ExecStart=/opt/kibana-8.19.3/bin/kibana
#Restart=always
User=esuser
Group=esuser

[Install]
WantedBy=multi-user.target

启动

复制代码
systemctl start kibana

查看日志

复制代码
tail -f /opt/kibana-8.19.3/logs/kibana.log

访问

复制代码
http://yourip:5601

kibana登录可以用es中的用户例如用户:elastic 密码

相关推荐
爱吃香菜的初学者2 小时前
十四.Linux——消息队列
linux·运维·开发语言
Apipi*9 小时前
30天速通Linux 第六章信号及信号处理
linux·运维·信号处理
天启HTTP10 小时前
爬虫防封核心原理:IP轮换机制与风控规避逻辑
linux·服务器·网络·爬虫·tcp/ip
广州浮点FLOATLIC12 小时前
许可证服务器迁移后软件打不开:研发 IT 怎样定位连接问题
linux·服务器·数据库
BLUcoding13 小时前
接口服务公网超时排查记录:SecureRandom 阻塞问题分析与解决
java·linux·springboot·aes·securerandom
AIgorithmGEEK13 小时前
[Linux]从手写报头到内核套路:序列化、反序列化与自定义协议全链路
linux·运维·服务器·网络·序列化·反序列化
Nil20813 小时前
leetcode 139单词拆分
linux·运维·服务器
Starry-sky(jing)13 小时前
BUG: unable to handle kernel paging request 完整排查:dmesg 四要素与三路定罪
linux·运维·服务器·内核·排障
mounter62513 小时前
从硬件互连到操作系统变革:CXL 技术演进与 Linux 内核工程挑战
linux·运维·服务器
xh didida14 小时前
Linux -- 基础IO
linux·服务器·开发语言·c++