ElasticSearch系列09:ElasticSearch2.4集群搭建

本文介绍如何在三个节点上部署Elasticsearch 2.4.4集群,并配置必要的参数实现集群间的通信。文章详细说明了创建用户、设置目录权限、配置`elasticsearch.yml`文件等步骤。
环境:
节点1 10.11.32.76 hadooptest76.bj
节点2 10.11.32.77 hadooptest77.bj
节点3 10.11.32.81 hadooptest81.bj

java版本要求:最低1.7

下载地址:
curl -L -O https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/zip/elasticsearch/2.4.4/elasticsearch-2.4.4.zip

所有节点,创建es用户,启动es服务
useradd es
chown es:es -R /usr/local/elasticsearch-2.4.4
su es

各节点配置elasticsearch.yml文件:
节点1:
$cat /usr/local/elasticsearch-2.4.4/config/elasticsearch.yml
cluster.name: es_test
node.name: node-1
path.data: /data1/esData
path.logs: /data1/es/logs
network.host: 10.11.32.76
http.port: 9200
discovery.zen.ping.unicast.hosts: ["hadooptest76.bj", "hadooptest77.bj", "hadooptest81.bj"]

节点2:
$cat /usr/local/elasticsearch-2.4.4/config/elasticsearch.yml
cluster.name: es_test
node.name: node-2
path.data: /data1/esData
path.logs: /data1/es/logs
network.host: 10.11.32.77
http.port: 9200
discovery.zen.ping.unicast.hosts: ["hadooptest76.bj", "hadooptest77.bj", "hadooptest81.bj"]

节点3:
$cat /usr/local/elasticsearch-2.4.4/config/elasticsearch.yml
cluster.name: es_test
node.name: node-3
path.data: /data1/esData
path.logs: /data1/es/logs
network.host: 10.11.32.78
http.port: 9200
discovery.zen.ping.unicast.hosts: ["hadooptest76.bj", "hadooptest77.bj", "hadooptest81.bj"]

所有节点创建目录
# mkdir /data1/esData
# mkdir -p /data1/es/logs
# chown es:es -R /data1/esData
# chown es:es -R /data1/es/logs/

启动所有节点:
/usr/local/elasticsearch-2.4.4/bin/elasticsearch -d

GET http://10.11.32.76:9200/_cluster/health?pretty
{
  "cluster_name" : "es_test",
  "status" : "green",
  "timed_out" : false,
  "number_of_nodes" : 3,
  "number_of_data_nodes" : 3,
  "active_primary_shards" : 0,
  "active_shards" : 0,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 0,
  "delayed_unassigned_shards" : 0,
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 0,
  "task_max_waiting_in_queue_millis" : 0,
  "active_shards_percent_as_number" : 100.0
}

所有节点安装ElasticSearch插件
head插件:
/usr/local/elasticsearch-2.4.4/bin/plugin install mobz/elasticsearch-head

访问集群节点是否正常,使用head插件

http://10.11.32.76:9200/_plugin/head/


注意:ES1.X版本和2.X版本配置已经不一样了,参考http://www.cnblogs.com/muzhiye/p/elasticsearch_set_cluster.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值