首页 > 系统服务 > 详细

Mac elasticsearch 5.2.2 单机双节点配置

时间:2017-03-06 13:35:25      阅读:554      评论:0      收藏:0      [点我收藏+]

昨天研究了一下午,看见英文就头疼。

官方文档https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html

下载https://www.elastic.co/downloads/elasticsearch 

解压后复制一份,我这里重命名elasticsearch-1 和 elasticsearch-2

然后修改两个配置文件

vim elasticsearch-1/config/elasticsearch.yml

加入如下配置

cluster.name: testes   #集群名
node.name: ${HOSTNAME} #节点名
node.data: true  #该节点是否存储数据
network.host: 0.0.0.0
http.port: 9200 #节点对外端口
transport.tcp.port: 9300 #节点通信端口
discovery.zen.ping.unicast.hosts: ["localhost:9300"]
node.max_local_storage_nodes: 2  #单机最大节点数

然后是第二个

vim elasticsearch-2/config/elasticsearch.yml

cluster.name: testes
node.name: ${HOSTNAME}-2
node.master: false #不做主节点
node.data: true
network.host: 0.0.0.0
http.port: 9201
transport.tcp.port: 9301
discovery.zen.ping.unicast.hosts: ["localhost:9300"]
node.max_local_storage_nodes: 2

最后启动 elasticsearch-1

cd elasticsearch-1

bin/elasticsearch -d   

-d意思为后台运行  也可以bin/elasticsearch -h 查看更多命令

启动 elasticsearch-2

cd elasticsearch-2

bin/elasticsearch -d  

可以到logs里面查看集群的日志,日志名为集群名.log。

 技术分享

当我看到第二个节点进入集群时,我想起了我的第一次,很兴奋。

查看集群内节点

curl -XGET ‘localhost:9200/_cat/nodes?v&pretty‘

技术分享

下一步开始摆弄API  CURD.....

Mac elasticsearch 5.2.2 单机双节点配置

原文:http://www.cnblogs.com/fastLearn/p/6509178.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!