elasticsearch7.5安装遇到的坑

没错,从零开始的elasticsearch搭建教程开始了!h'h **html

原文:http://www.javashuo.com/article/p-mkliqcgu-e.htmljava

那么首先假设 你已经装好了一个CentOS系统 ,个人是centos6.7的node

 

1.到官网下载Elasticsearch

地址: https://www.elastic.co/cn/downloads/past-releases#elasticsearchlinux

我下的是7.5.2bootstrap

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
 

而后加载参数centos

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 65536bash

* 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
相关文章
相关标签/搜索