官方下载地址:https://www.php.cn/link/88a9225cf17ea3bf8bef2b4658ef7bf2
下载链接:https://www.php.cn/link/fc64088b0f734c47f016d7a69cc53333

解压命令:tar -zxvf elasticsearch-8.2.0-linux-x86_64.tar.gz
切换到目录:cd /usr/local/elasticsearch-8.2.2/bin/
启动Elasticsearch:./elasticsearch
[root@VM-4-3-centos bin]# ./elasticsearch
[root@VM-4-3-centos ~]# useradd es
[root@VM-4-3-centos ~]# passwd es
[root@VM-4-3-centos ~]# id es
uid=1001(es) gid=1001(es) groups=1001(es)
如果使用root账号启动Elasticsearch会报错:java.lang.RuntimeException: can not run elasticsearch as root
使用root账号创建用户:sudo adduser es
设置密码:sudo passwd es
对es用户授权,目录elasticsearch-8.2.0(重要):sudo chown -R es:es elasticsearch-8.2.0
su es
./bin/elasticsearch
后台运行,避免客户端退出后服务停止:./bin/elasticsearch -d
当看到“started”时,服务已成功启动
关闭ES服务:kill pid
说明:Elasticsearch使用9300和9200端口,其中9300为tcp通讯端口,用于集群节点间通信,9200为http协议的RESTful接口
解决内存不足问题:启动时卡住,可能是由于Elasticsearch默认分配的JVM空间大小为2g。修改JVM空间大小,如果Linux服务器配置较高,可以不做修改。
修改JDK启动内存:vim /usr/local/elasticsearch-8.2.0/config/jvm.options
-Xms256m -Xmx256m
报错:Native controller process has stopped - no new native processes can be started
继续配置文件:sudo vim /etc/security/limits.conf
* soft nofile 262144 * hard nofile 131072 * soft nproc 4096 * hard nproc 4096
报错信息:
bootstrap check failure [1] of [3]: max number of threads [2048] for user [es] is too low, increase to at least [4096]
bootstrap check failure [2] of [3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
bootstrap check failure [3] of [3]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
soft nproc:单个用户可用的最大进程数量(超过会警告);hard nproc:单个用户可用的最大进程数量(超过会报错);soft nofile:可打开的文件描述符的最大数(超过会警告);hard nofile:可打开的文件描述符的最大数(超过会报错)
bootstrap check failure [1] of [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
在es bin目录执行:vim ../config/elasticsearch.yml
修改配置文件:
cluster.name: es.study node.name: node-1 network.host: 0.0.0.0 http.port: 9200 bootstrap.memory_lock: false #system_call_filter启动报错,去掉# bootstrap.system_call_filter: false # 为Elasticsearch设置登录密码 xpack.security.enabled: false cluster.initial_master_nodes: ["node-1"] # error downloading geoip database [GeoLite2-Country.mmdb] #关闭geoip数据库的更新 ingest.geoip.downloader.enabled: false



以上就是linux elasticsearch-8.2.0安装的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号