操作系统:Ubuntu or Mac
1. 下载
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.3.1.tar.gz
2. 安装:
tar xvzf elasticsearch-1.3.1.tar.gz
3. 为了方便监控状态,进入elasticsearch主目录,安装Head插件
./plugin -install mobz/elasticsearch-head
4. 启动ES:
后台启动:./bin/elasticsearch -d
前台启动:./bin/elasticsearch
查看ES状态:
http://localhost:9200/_plugin/head/
集群配置:
Node 1:
cluster.name: elasticsearch
name.name: "node1"
node.master: true
node.data: true
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["ec2-102-34-34-55.eu-west-1.compute.amazonaws.com"]
Node 2:
cluster.name: elasticsearch name.name: "node2" node.master: false node.data: true discovery.zen.ping.multicast.enabled: false discovery.zen.ping.unicast.hosts: ["
ec2-102-34-34-55.eu-west-1.compute.amazonaws.com
"]
注意, node之间的通信是9300端口,如果是在亚马逊服务器上配置,又有安全组的配置的话,需要注意开启9300端口,否则各个node会发现不了master。
如果集群配置成功的话,从head插件上看起来应该是这样的: