elasticsearch7.5安装遇到的坑
没错,从零开始的elasticsearch搭建教程开始了!h"h **
原文:https://www.cnblogs.com/heermayou/p/12670662.html
那么首先假设 你已经装好了一个CentOS系统 ,我的是centos6.7的
1.到官网下载Elasticsearch
地址: https://www.elastic.co/cn/downloads/past-releases#elasticsearch
我下的是7.5.2
2.上传压缩包到Linux服务器(略)
3.安装
3.1 解压上传好的安装包
tar -zxvf elasticsearch-7.5.2-linux-x86_64.tar.gz
3.2 尝试启动
linux中 elasticsearch不能以root用户启动
所以先建一个普通用户
adduser username
更改文件夹所属权
chown -R username ./elasticsearch-7.5.2
进入已经解压好的elasticsearch 的目录中
cd elasticsearch-7.5.2/
切换用户:
su username
启动elasticsearch
./bin/elasticsearch
这里来说一般都会成功,如果本的配置了JAVA_HOME的环境路径,
而且java的版本比较低的话启动就会失败,elasticsearch中有jdk的版本最好使用该版本的jdk
vi bin/elasticsearch
在开始的位置加入:
export JAVA_HOME=/opt/program/elasticsarch/elasticsearch-7.5.2/jdk #(此处es的jdk所在目录)
export PATH=$JAVA_HOME/bin:$PATH
:wq 保存并退出
然后再次启动,完美成功!
ctrl + c 关闭运行
3.3 开放远程连接
修改 config下的 elasticsearch.yml
vi config/elasticsearch.yml
修改下面配置:
network.host: 0.0.0.0 #改为0.0.0.0对外开放,如对特定ip开放则改为指定ip
http.port: 9200 #可更改端口不为9200
启动可能会报错:
1virtual65530is262144vi /etc/sysctl.conf
加入:
vm.max_map_count=655360
然后加载参数
sysctl -p
继续启动可能报的错误:
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
[2]: max number of threads [1024] for user [elastic] is too low, increase to at least [4096]
[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[4]: system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
[5]: 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
.打开/etc/security/limits.conf,在里面添加如下内容
* soft nofile 65536
* hard nofile 65536
此处不行还要修改 /etc/security/limits.d/90-nproc.conf
* soft nproc 1024
将上面修改为:
* soft nproc 2048
其中*表示所有用户 nofile表示最大文件句柄数,表示能够打开的最大文件数目
再次启动出现下列错误时:
ERROR: [2] bootstrap checks failed
[1]: system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
[2]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] mu
修改elastic search.yml文件加入:
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
再次出现以下错误时:
ERROR: [1] bootstrap checks failed
[1]: 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
修改elasticsearch.yml文件加入:
cluster.initial_master_nodes: ["node-1"]
再次启动应该就ok了。。。
3.4 elasticsearch 后台启动
./bin/elasticsearch -d
以上是 elasticsearch7.5安装遇到的坑 的全部内容, 来源链接: utcz.com/z/533088.html