https://www.elastic.co/cn/downloads/elasticsearch#ga-release
下载的是Linux x86_64
包名为elasticsearch-8.10.4-linux-x86_64.tar.gz
tar -xvf elasticsearch-8.10.4-linux-x86_64.tar.gz
编辑配置文件config/elasticsearch.yml
network.host: 0.0.0.0
# 注释打开
http.port: 9200
进入到bin目录下,./elasticsearch
,启动ES
# 添加es用户
useradd es
# 设置es用户的密码
passwd es
# 添加es组
groupadd es
#递归更改所属组所属用户
chown -R es:es elasticsearch-8.10.4
# 切换es用户
su es
./elasticsearch
bootstrap check failure [1] of [2]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
bootstrap check failure [2] of [2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
vi /etc/security/limits.conf
,在尾部添加
* soft nofile 65536
* hard nofile 65536
重新登录下再验证
[root@localhost ~]# ulimit -Hn
65536
[root@localhost ~]# ulimit -Sn
65536
sysctl -w vm.max_map_count=262144
[root@localhost ~]# cat /proc/sys/vm/max_map_count
65530
[root@localhost ~]# sysctl -w vm.max_map_count=262144
vm.max_map_count = 262144
[root@localhost ~]# cat /proc/sys/vm/max_map_count
262144
./elasticsearch
此时启动正常,但是在网页访问服务器ip:9200
时,无法访问
再次修改配置文件config/elasticsearch.yml
# 改为false
xpack.security.enabled: false
再次启动后,就可以访问到页面了,页面 显示Json数据
{
"name" : "localhost.localdomain",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "0tcsCadqSACzT71By2GDOg",
"version" : {
"number" : "8.10.4",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "b4a62ac808e886ff032700c391f45f1408b2538c",
"build_date" : "2023-10-11T22:04:35.506990650Z",
"build_snapshot" : false,
"lucene_version" : "9.7.0",
"minimum_wire_compatibility_version" : "7.17.0",
"minimum_index_compatibility_version" : "7.0.0"
},
"tagline" : "You Know, for Search"
}
参考文章
max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
Elasticsearch之Linux环境安装介绍
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]