zoukankan      html  css  js  c++  java
  • Mac elasticsearch 5.2.2 单机双节点配置

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

    官方文档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.....

  • 相关阅读:
    23 数字时钟&长图滚动
    22 日期特效&长图滚动
    彻底澄清c/c++指针概念
    已管理员模式运行批处理路径丢失问题的解决方法
    使用mathjax在博客中完美显示数学公式,支持PC,手机浏览器
    GOOGLE高级搜索技巧
    我要搬家
    简单的3proxy配置
    AutoMapper小结
    专业IT培训机构-传智播客
  • 原文地址:https://www.cnblogs.com/fastLearn/p/6509178.html
Copyright © 2011-2022 走看看