ElasticSearch 集群安装

本文详细介绍了如何在Centos6.5环境中安装ElasticSearch5.5.2版本,包括环境准备、用户创建、JDK设置、系统参数调整、ES集群安装、配置文件详解以及网络和发现模块的配置。
摘要由CSDN通过智能技术生成

一、ElasticSearch


ElasticSearch 官网:Elasticsearch: The Official Distributed Search & Analytics Engine | Elastic
官网下载地址:https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.0.0.tar.gz


二、ElasticSearch安装


1、环境介绍:


Elasticsearch:5.5.2版本
操作系统:Centos 6.5
 JDK: 1.8
集群节点3台:es01;es02;es03


2、ES集群安装


1>用户创建

 
创建用户es,家目录设置/usr/local/elasticsearch


2>jdk安装


root上传jdk1.8.0_121.tar到/usr/java并解压
tar -xvf jdk1.8.0_121.tar
切换到es用户,修改.bash_profile文件,添加以下内容:
export JAVA_HOME=/usr/java/jdk1.8.0_121
PATH=$JAVA_HOME/bin:$PATH:$HOME/bin
执行命令 source .bash_profile生效


3>系统参数设置

  1. 设置内核参数
    vim /etc/sysctl.conf
    添加如下内容:
    fs.file-max=65536
    vm.max_map_count=262144
  2. 设置资源参数

vim /etc/security/limits.conf
添加如下内容:

*  soft   nofile    65535
*  hard   nofile    65535
* soft nproc 4096
* hard nproc 4096
* soft memlock unlimited
* hard memlock unlimited

执行命令sysctl –p 使配置生效

4>elasticsearch安装


上传elasticsearch-5.5.0.zip包到/usr/local/elasticsearch目录并解压
unzip elasticsearch-5.5.0.zip
删除解压目录的下的原始文件夹
/usr/local/elasticsearch/elasticsearch-5.5.0/data/nodes


5>elasticsearch配置


备份elasticsearch.yml文件

---------------------------------- Cluster -----------------------------------
cluster.name: lcs-elasticsearch
#集群名称,不能和别的集群同名

------------------------------------ Node ------------------------------------
node.name: es01.lcs.sfp.com
#节点名称,每个节点建议改成hostname
node.master: true
#该节点是否有资格被选为master
node.data: true
#指定该节点是否存储索引数据,默认为true。如果节点配置node.master:false并且node.data: false,则该节点将起到负载均衡的作用

----------------------------------- Paths ------------------------------------
path.data: /usr/local/elasticsearch/elasticsearch-5.5.0/data

#Path to log files:

path.logs: /usr/local/elasticsearch/elasticsearch-5.5.0/logs
#es存储数据的路径和日志路径



----------------------------------- Memory -----------------------------------


#Lock the memory on startup:

bootstrap.memory_lock: true

#这个配置的意义:锁定物理内存地址,防止es内存被交换出去,也就是避免es使用swap交换分区,频繁的交换,会导致IOPS变高

bootstrap.system_call_filter: false
#问题原因:因为Centos6不支持SecComp
#SecComp是Linux kernel (自从2.6.23版本之后)所支持的一种简洁的sandboxing机制。它能使一个进程进入到一种“安全”运行模式,该模式下的进程只能调用4种系统调用(system calls),即read(), write(), exit()和sigreturn(),否则进程便会被终止。
而ES5.2以后的版本默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。修改为false直接不检查

Make sure that the heap size is set to about half the memory available

on the system and that the owner of the process is allowed to use this

limit.

Elasticsearch performs poorly when the system is swapping the memory.

#---------------------------------- Network -----------------------------------


#Set the bind address to a specific IP (IPv4 or IPv6):

network.host: 0.0.0.0
#允许访问的IP,设置0.0.0.0允许所有IP访问

Set a custom port for HTTP:

http.port: 9200
#为es restapi的端口号
transport.tcp.port: 9300
#为集群间通信端口

#For more information, consult the network module documentation.

#--------------------------------- Discovery ----------------------------------
#Pass an initial list of hosts to perform discovery when new node is started:

#The default list of hosts is ["127.0.0.1", "[::1]"]

discovery.zen.ping.unicast.hosts: ["es01.lcs.sfp.com", "es02.lcs.sfp.com"]
#集群的所有主机地址

#Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):

discovery.zen.minimum_master_nodes: 2
#了防止集群发生“脑裂”, 需要配置集群最少主节点数目,通常为 (可成为主节点的主机数目 / 2) + 1

#For more information, consult the zen discovery module documentation.

---------------------------------- Gateway -----------------------------------
#Block initial recovery after a full cluster restart until N nodes are started:

#gateway.recover_after_nodes: 3

#For more information, consult the gateway module documentation.

---------------------------------- Various -----------------------------------
#Require explicit names when deleting indices:

#action.destructive_requires_name: true

  • 5
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
根据引用内容,安装Docker上的Elasticsearch集群的步骤如下: 1. 首先,准备好环境。在vmware15上搭建CentOS 7虚拟机,并安装Docker(版本为Docker version 19.03.13)。 2. 拉取Elasticsearch的镜像。使用命令`docker pull elasticsearch:7.9.3`来拉取最新版本的Elasticsearch镜像。 3. 修改配置。根据自己的需求和环境,修改Elasticsearch的配置文件。修改完成后,重启Elasticsearch容器。 4. 生成密码。进入Elasticsearch容器,并使用命令`bin/elasticsearch-setup-passwords interactive`来生成密码。 5. 启动Metricbeat。使用命令`docker run -d --privileged=true --name=metricbeat --user=root --volume="$(pwd)/metricbeat.yml:/usr/share/metricbeat/metricbeat.yml:ro" --volume="/var/run/docker.sock:/var/run/docker.sock:ro" --volume="/sys/fs/cgroup:/hostfs/sys/fs/cgroup:ro" --volume="/proc:/hostfs/proc:ro" --volume="/:/hostfs:ro" docker.elastic.co/beats/metricbeat:7.9.3`来启动Metricbeat。 以上是基于引用的内容给出的关于Docker Elasticsearch集群安装的步骤。希望对你有所帮助。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [使用docker安装es集群](https://blog.csdn.net/xiezuozhen/article/details/129740587)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] - *2* *3* [使用docker搭建es集群](https://blog.csdn.net/frrree/article/details/120453668)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值