Linux安装ElasticSearch
目录
1. 下载
比如下载:https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.2.2-linux-x86_64.tar.gz
2. 解压到/opt
tar -zxvf /opt/elasticsearch-8.2.2-linux-x86_64.tar.gz -C /opt/
3. 创建es用户,并授权目录给es用户
useradd es
chown -R es:es /opt/elasticsearch-8.2.2
chown -R es /opt/elasticsearch-8.2.2
sudo passwd es
输入密码:E@s2022
4. 开启远程登陆
vim /opt/elasticsearch-8.2.2/config/elasticsearch.yml
添加
# 能ping通端口不能http访问问题
xpack.security.enabled: false
xpack.security.enrollment.enabled: true
xpack.security.http.ssl:
enabled: true
keystore.path: certs/http.p12
xpack.security.transport.ssl:
enabled: true
verification_mode: certificate
keystore.path: certs/transport.p12
truststore.path: certs/transport.p12
# 开放所有IP可以访问
http.host: 0.0.0.0
5. 修改文件/etc/security/limits.conf
vim /etc/security/limits.conf
添加
* soft nofile 65536
* hard nofile 65536
* soft nproc 4096
* hard nproc 4096
6. 登出Linux然后重新登陆,验证是否成功
ulimit -Hn
ulimit -Sn
ulimit -Hu
ulimit -Su
7. 修改文件/etc/sysctl.conf
vim /etc/sysctl.conf
添加
vm.max_map_count=655360
重新载入
sysctl -p
8. 启动es
su - es -c "/opt/elasticsearch-8.2.2/bin/elasticsearch -d"
9. http是否正常访问
10. 参考文章
ES安装教程详解
Elasticsearch 用户启动问题
ElasticSearch启动报错:java.nio.file.AccessDeniedException
安装elasticsearch8.0.1之后无法访问9200:Empty reply from server