前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Elasticsearch 6.x集群搭建

Elasticsearch 6.x集群搭建

作者头像
程裕强
发布2019-05-27 09:03:54
5860
发布2019-05-27 09:03:54
举报

1、关闭防火墙和SELINUX

代码语言:javascript
复制
systemctl stop firewalld
systemctl disable firewalld
代码语言:javascript
复制
setenforce 0
sed -i "s#SELINUX=enforcing#SELINUX=disabled#g" /etc/selinux/config

2、JDK安装

代码语言:javascript
复制
rpm -qa|grep java|xargs rpm -e --nodeps
代码语言:javascript
复制
tar -zxvf jdk*.tar.gz -C /opt
vi /etc/profile.d/custom.sh
代码语言:javascript
复制
 source /etc/profile.d/custom.sh
 java -version

3、创建用户和组

代码语言:javascript
复制
 groupadd elastic
 useradd elastic -g elastic
 passwd elastic

4、Elasticsearch软件包安装

代码语言:javascript
复制
tar -zxvf elastic*.tar.gz -C /opt
代码语言:javascript
复制
chown -R elastic:elastic /opt/elasticsearch-6.4.3
代码语言:javascript
复制
mkdir -p /var/log/elasticsearch
mkdir -p  /data/elasticsearch
chown -R elastic:elastic /var/log/elasticsearch
chown -R elastic:elastic /data/elasticsearch
代码语言:javascript
复制
cd /opt/elasticsearch-6.4.3/config/
vi elasticsearch.yml
代码语言:javascript
复制
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
#cluster.name: my-application
#ES集群名
cluster.name: tpa

# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
#node.name: node-1
node.name: elastic1
#默认情况下,ElasticSearch将当前节点配置为同时作为候选主结点和数据结点
#候选主结点
node.master: true
#数据结点
node.data: true
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
#path.data: /path/to/data
#数据目录,多个数据文件使用逗号隔开
path.data: /data/elasticsearch
#
# Path to log files:
#
#path.logs: /path/to/logs
#日志目录
path.logs: /var/log/elasticsearch

# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
#network.host: 192.168.0.1
#配置当前结点绑定的IP地址,默认为0.0.0.0
network.host: 0.0.0.0
# Set a custom port for HTTP:
#
#http.port: 9200
#对外服务的HTTP端口
http.port: 9200
#结点间交互的TCP端口
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: ["host1", "host2"]
#指定接收单播请求的主机,推荐包含组成集群的所有主机,主机之间用逗号隔开
discovery.zen.ping.unicast.hosts: ["elastic1", "elastic2", "elastic3"]


# Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):
#discovery.zen.minimum_master_nodes:
#默认值是1,该属性定义的是为了组成一个集群,相互连接的候选主结点的最小数目
#强烈推荐该属性的设置使用多数原则:(master_eligible_nodes / 2) + 1,既能避免出现脑裂(split-brain)
discovery.zen.minimum_master_nodes: 3
#
# For more information, consult the zen discovery module documentation.
#
代码语言:javascript
复制
sed -i '$a\vm.max_map_count=262144' /etc/sysctl.conf
sysctl -p
代码语言:javascript
复制
vi /etc/security/limits.conf
代码语言:javascript
复制
* hard nofile 65536
* soft nofile 65536
* soft nproc 2048
* hard nproc 4096
# End of file
代码语言:javascript
复制
su elastic
bin/elasticsearch -d
jps
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2018年11月12日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1、关闭防火墙和SELINUX
  • 2、JDK安装
  • 3、创建用户和组
  • 4、Elasticsearch软件包安装
相关产品与服务
Elasticsearch Service
腾讯云 Elasticsearch Service(ES)是云端全托管海量数据检索分析服务,拥有高性能自研内核,集成X-Pack。ES 支持通过自治索引、存算分离、集群巡检等特性轻松管理集群,也支持免运维、自动弹性、按需使用的 Serverless 模式。使用 ES 您可以高效构建信息检索、日志分析、运维监控等服务,它独特的向量检索还可助您构建基于语义、图像的AI深度应用。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档