环境:
节点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插件
节点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
本文介绍如何在三个节点上部署Elasticsearch 2.4.4集群,并配置必要的参数实现集群间的通信。文章详细说明了创建用户、设置目录权限、配置`elasticsearch.yml`文件等步骤。
1万+

被折叠的 条评论
为什么被折叠?



