关闭

elasticsearch-2.0.0 搭建集群的最简易配置

标签: elasticsearch集群
750人阅读 评论(0) 收藏 举报
分类:

2.0.0版本跟以前版本在搭建集群时,配置上跟以前的版本有所不同,但是使用方法还是很简单,只需要对elasticsearch-2.0.0/conf/elasticsearch.yml文件进行三处修改即可,以下是最简单配置的elasticsearch.yml文件,需要修改三处位置,即红色部分:


# ======================== Elasticsearch Configuration =========================

#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please see the documentation for further information on configuration options:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/setup-configuration.html>
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: WEC
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node1
# Add custom attributes to the node:
#
# node.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
# path.data: /path/to/data
#
# Path to log files:
#
# path.logs: /path/to/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
# bootstrap.mlockall: true
#
# Make sure that the `ES_HEAP_SIZE` environment variable 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 adress to a specific IP (IPv4 or IPv6):
#
network.host: 10.119.199.32
#
# Set a custom port for HTTP:
#
http.port: 9200
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html>
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
# gateway.recover_after_nodes: 3
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-gateway.html>
#
# --------------------------------- Discovery ----------------------------------
#
# Elasticsearch nodes will find each other via unicast, by default.
#
# 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: ["10.119.199.33", "10.119.199.32"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of nodes / 2 + 1):
#
# discovery.zen.minimum_master_nodes: 3
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery.html>
#
# ---------------------------------- Various -----------------------------------
#
# Disable starting multiple nodes on a single system:
#
# node.max_local_storage_nodes: 1
#
# Require explicit names when deleting indices:
#

# action.destructive_requires_name: true



在一个集群中,每个机子都应该有自己唯一无二的机器名,所以,node.name: node1这一处配置的node1值 应该各不相同,network.host: 10.119.199.32中的10.119.199.32是本机IPdiscovery.zen.ping.unicast.hosts: ["10.119.199.33", "10.119.199.32","10.119.199.34"]中的IP是集群中的IP。


当一个新的节点需要加入已经在运行的elasticsearch集群时,只需要配置上面三处,特别是discovery.zen.ping.unicast.hosts中起码有一个IP是那个正在运行的elasticsearch集群中的一个节点的IP即可实现把新的节点加入集群的目的。





1
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:13083次
    • 积分:222
    • 等级:
    • 排名:千里之外
    • 原创:6篇
    • 转载:18篇
    • 译文:0篇
    • 评论:2条
    文章分类
    最新评论