温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Elasticsearch7.2集群的详细安装过程

发布时间:2021-09-04 22:17:03 来源:亿速云 阅读:146 作者:chen 栏目:大数据

本篇内容介绍了“Elasticsearch7.2集群的详细安装过程”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

1、配置文件

[root@es1 ~]# grep '^[a-zA-Z]'  /etc/elasticsearch/elasticsearch.yml
cluster.name: xing-application
node.name: node-1
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
network.host: 0.0.0.0
cluster.initial_master_nodes: ["node-1"]
http.cors.enabled: true
http.cors.allow-origin: "*"
discovery.seed_hosts: ["192.168.56.14", "192.168.56.15", "192.168.56.16"]
[root@es1 ~]#
[root@es2 ~]#  grep '^[a-zA-Z]'  /etc/elasticsearch/elasticsearch.yml
cluster.name: xing-application
node.name: node-2
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
network.host: 0.0.0.0
cluster.initial_master_nodes: ["node-1"]
http.cors.enabled: true
http.cors.allow-origin: "*"
discovery.seed_hosts: ["192.168.56.14", "192.168.56.15", "192.168.56.16"]
[root@es2 ~]# 
[root@es3 ~]#  grep '^[a-zA-Z]'  /etc/elasticsearch/elasticsearch.yml
cluster.name: xing-application
node.name: node-3
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
network.host: 0.0.0.0
cluster.initial_master_nodes: ["node-1"]
http.cors.enabled: true
http.cors.allow-origin: "*"
discovery.seed_hosts: ["192.168.56.14", "192.168.56.15", "192.168.56.16"]
[root@es3 ~]#

2、安装命令

yum -y localinstall kibana-7.2.0-x86_64.rpm  elasticsearch-7.2.0-x86_64.rpm

参考下载地址

https://www.elastic.co/cn/downloads/past-releases

3、启动命令

/etc/init.d/elasticsearch start

4、参数说明

cluster.name: xing-application
配置es的集群名称,默认是elasticsearch,es会自动发现在同一网段下的es,如果在同一网段下有多个集群,就可以用这个属性来区分不同的集群。
node.name: node-1
节点名,默认随机指定一个name列表中名字,该列表在es的jar包中config文件夹里name.txt文件中,其中有很多作者添加的有趣名字。
path.data: /var/lib/elasticsearch
设置索引数据的存储路径,默认是es根目录下的data文件夹,可以设置多个存储路径,用逗号隔开。
path.logs: /var/log/elasticsearch
设置日志文件的存储路径,默认是es根目录下的logs文件夹
network.host: 0.0.0.0
设置绑定的ip地址,可以是ipv4或ipv6的
cluster.initial_master_nodes: ["node-1"]
参数设置一系列符合主节点条件的节点的主机名或 IP 地址来引导启动集群。手动指定可以成为 mater 的所有节点的 name 或者 ip,这些配置将会在第一次选举中进行计算
http.cors.enabled: true
如果启用了 HTTP 端口,那么此属性会指定是否允许跨域 REST 请求。
http.cors.allow-origin: "*"
如果 http.cors.enabled 的值为 true,那么该属性会指定允许 REST 请求来自何处。
discovery.seed_hosts: ["192.168.56.14", "192.168.56.15", "192.168.56.16"]
配置集群的主机地址,配置之后集群的主机之间可以自动发现

防止脑裂:

discovery.zen.minimum_master_nodes=集群节点/2+1

5、集群最终效果

Elasticsearch7.2集群的详细安装过程

6、tar.gz 安装错误处理
6.1、启动报错

启动用户需要非root,如果用root用户启动了,需要删除logs和config目录下root生成文件

6.2、环境配置报错

错误:

ERROR: [3] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
[2]: max number of threads [3869] for user [elasticsearch] 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]

对应处理:

[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]

[root@es1 ~]# cat /etc/sysctl.conf 
* soft nofile 65536
* hard nofile 65536

[2]: max number of threads [3869] for user [elasticsearch] is too low, increase to at least [4096]

[root@es1 ~]# cat /etc/security/limits.d/20-nproc.conf 
*          soft    nproc     40960
*          hard    nproc     40960

[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

[root@es1 ~]# cat /etc/sysctl.conf 
vm.max_map_count=655360

[root@es1 ~]# sysctl -p
vm.max_map_count = 655360
[root@es1 ~]#

“Elasticsearch7.2集群的详细安装过程”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注亿速云网站,小编将为大家输出更多高质量的实用文章!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI