Elasticsearch-8.10.4安装

1.官网下载

https://www.elastic.co/cn/downloads/elasticsearch#ga-release

下载的是Linux x86_64

包名为elasticsearch-8.10.4-linux-x86_64.tar.gz

2.服务器解压

tar -xvf elasticsearch-8.10.4-linux-x86_64.tar.gz

3.修改配置

编辑配置文件config/elasticsearch.yml

network.host: 0.0.0.0

# 注释打开
http.port: 9200

4.启动

进入到bin目录下,./elasticsearch,启动ES

5.启动异常can not run elasticsearch as root

无法以root用户启动
Elasticsearch-8.10.4安装_第1张图片

5.1使用es用户启动

# 添加es用户
useradd es

# 设置es用户的密码
passwd es

# 添加es组
groupadd es

#递归更改所属组所属用户
chown -R es:es elasticsearch-8.10.4 

# 切换es用户
su es

5.2再次启动

./elasticsearch

6.启动出现2个异常

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]

6.1第一个问题

vi /etc/security/limits.conf,在尾部添加

*                soft    nofile          65536
*                hard    nofile          65536

重新登录下再验证

[root@localhost ~]# ulimit -Hn
65536
[root@localhost ~]# ulimit -Sn
65536

6.2 第二个异常

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

6.3 再次启动

./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]

你可能感兴趣的:(elasticsearch,大数据)