zoukankan      html  css  js  c++  java
  • ElasticSearch集群的安装(windows)

    首先尽量保持你的磁盘空间足够大,比如你下载的软件的放在D盘,D盘尽量保持10G以上,还有C盘也差不多10G以上比较保险

    一、下载

    1)目前我下载的版本是elasticsearch-7.12.0-windows-x86_64,通过搜索引擎找到ElasticSearch的官网下载软件,目前的地址如下:

    https://www.elastic.co/cn/downloads/elasticsearch

    二、配置

    1)解压

    2)复制3份解压后的文件,重命名为node-1001,node-1002,node-1003

    3)分别配置各自文件下config目录下的配置文件elasticsearch.yml

    # 集群名称(所有节点同一个名字)

    cluster.name: my-elasticsearch

    # 集群节点名称(各自节点各自名字)

    node.name: node-3

    # 是不是为主节点

    node.master: true

    # 是否存储数据

    node.data: true

    # 最大集群节点数,因为3个集群,所以配置3

    node.max_local_storage_nodes: 3

    # 数据存储路径(配置各自节点目录)

    path.data: D:/software/elastic/node-1003/data

    # 日志存储路径:(配置各自节点目录)

    #

    path.logs: D:/software/elastic/node-1003/logs

    # 网关地址

    network.host: 0.0.0.0

    # 端口(配置各自节点端口)

    http.port: 9202

    # 内部节点之间沟通端口(配置各自节点端口)

    transport.tcp.port: 9800

    # es7.x之后新增的配置,写入候选主节点的设备地址,在开启服务后可以被选为主节点,配置的是3个节点的内部节点之间的沟通端口

    discovery.seed_hosts: ["127.0.0.1:9600", "127.0.0.1:9700", "127.0.0.1:9800"]

    #

    # es7.x之后新增的配置,初始化一个新的集群时需要此配置来选举master,配置的是3个节点各自的节点名字

    cluster.initial_master_nodes: ["node-1", "node-2", "node-3"]

    bootstrap.system_call_filter: false

    http.cors.allow-origin: "*"

    http.cors.enabled: true

    http.cors.allow-headers : X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization

    http.cors.allow-credentials: true


    节点1配置具体如下:

    # 集群名称(所有节点同一个名字)

    cluster.name: my-elasticsearch

    # 集群节点名称(各自节点各自名字)

    node.name: node-1

    # 是不是为主节点

    node.master: true

    # 是否存储数据

    node.data: true

    # 最大集群节点数,因为3个集群,所以配置3

    node.max_local_storage_nodes: 3

    # 数据存储路径

    path.data: D:/software/elastic/node-1001/data

    # 日志存储路径:

    #

    path.logs: D:/software/elastic/node-1001/logs

    # 网关地址

    network.host: 0.0.0.0

    # 端口

    http.port: 9200

    # 内部节点之间沟通端口

    transport.tcp.port: 9600

    # es7.x之后新增的配置,写入候选主节点的设备地址,在开启服务后可以被选为主节点,配置的是3个节点的内部节点之间的沟通端口

    discovery.seed_hosts: ["127.0.0.1:9600", "127.0.0.1:9700", "127.0.0.1:9800"]

    #

    # es7.x之后新增的配置,初始化一个新的集群时需要此配置来选举master,配置的是3个节点各自的节点名字

    cluster.initial_master_nodes: ["node-1", "node-2", "node-3"]

    bootstrap.system_call_filter: false

    http.cors.allow-origin: "*"

    http.cors.enabled: true

    http.cors.allow-headers : X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization

    http.cors.allow-credentials: true

    节点2配置具体如下:

    # 集群名称(所有节点同一个名字)

    cluster.name: my-elasticsearch

    # 集群节点名称(各自节点各自名字)

    node.name: node-2

    # 是不是为主节点

    node.master: true

    # 是否存储数据

    node.data: true

    # 最大集群节点数,因为3个集群,所以配置3

    node.max_local_storage_nodes: 3

    # 数据存储路径

    path.data: D:/software/elastic/node-1002/data

    # 日志存储路径:

    #

    path.logs: D:/software/elastic/node-1002/logs

    # 网关地址

    network.host: 0.0.0.0

    # 端口

    http.port: 9201

    # 内部节点之间沟通端口

    transport.tcp.port: 9700

    # es7.x之后新增的配置,写入候选主节点的设备地址,在开启服务后可以被选为主节点,配置的是3个节点的内部节点之间的沟通端口

    discovery.seed_hosts: ["127.0.0.1:9600", "127.0.0.1:9700", "127.0.0.1:9800"]

    #

    # es7.x之后新增的配置,初始化一个新的集群时需要此配置来选举master,配置的是3个节点各自的节点名字

    cluster.initial_master_nodes: ["node-1", "node-2", "node-3"]

    bootstrap.system_call_filter: false

    http.cors.allow-origin: "*"

    http.cors.enabled: true

    http.cors.allow-headers : X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization

    http.cors.allow-credentials: true

    节点3配置如下:

    # 集群名称(所有节点同一个名字)

    cluster.name: my-elasticsearch

    # 集群节点名称(各自节点各自名字)

    node.name: node-3

    # 是不是为主节点

    node.master: true

    # 是否存储数据

    node.data: true

    # 最大集群节点数,因为3个集群,所以配置3

    node.max_local_storage_nodes: 3

    # 数据存储路径

    path.data: D:/software/elastic/node-1003/data

    # 日志存储路径:

    #

    path.logs: D:/software/elastic/node-1003/logs

    # 网关地址

    network.host: 0.0.0.0

    # 端口

    http.port: 9202

    # 内部节点之间沟通端口

    transport.tcp.port: 9800

    # es7.x之后新增的配置,写入候选主节点的设备地址,在开启服务后可以被选为主节点,配置的是3个节点的内部节点之间的沟通端口

    discovery.seed_hosts: ["127.0.0.1:9600", "127.0.0.1:9700", "127.0.0.1:9800"]

    #

    # es7.x之后新增的配置,初始化一个新的集群时需要此配置来选举master,配置的是3个节点各自的节点名字

    cluster.initial_master_nodes: ["node-1", "node-2", "node-3"]

    bootstrap.system_call_filter: false

    http.cors.allow-origin: "*"

    http.cors.enabled: true

    http.cors.allow-headers : X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization

    http.cors.allow-credentials: true

    4)清空各自文件夹下的data和logs文件夹内容(后面重启时有必要时也要进行此操作)

    5)启动(双击如:node-1001inelasticsearch.bat文件,但这种方式一旦有错误时,命令行会直接关掉,所以还是以命令行的形式打开,如打开cmd文件,进入该文件夹,或在node-1001in目录下的文件路径地址栏输入cmd回车即可打开命令行且切换到该路径下,再输入elasticsearch.bat)

    6)全部启动后,访问http://localhost:9200/、http://localhost:9201/、http://localhost:9202/地址,结果如下

    三、可视化客户端工具的安装(cerebro)

    下载地址https://github.com/lmenezes/cerebro/releases

    解压打开文件夹里面的bin目录,和ElasticSearch启动一样,可以直接双击,也可以命令行形式启动,默认地址端口是9000,

    如果端口被占用我们可以指定一个端口,先cmd命令行进入该文件夹的bin目录下,输入命令,如cerebro -Dhttp.port=9999,就可以指定9999端口启动cerebro了,访问地址是http://localhost:9999/,输入ElasticSearch地址,如上面的http://localhost:9200/,就可以连接到ElasticSearch,可视化界面如下:

    谢谢关注公众号:

  • 相关阅读:
    PHP调用WCF提供的方法
    关于git报 warning: LF will be replaced by CRLF in README.md.的警告的解决办法
    vue中引入mui报Uncaught TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them的错误
    微信小程序报Cannot read property 'setData' of undefined的错误
    Vue那些事儿之用visual stuido code编写vue报的错误Elements in iteration expect to have 'v-bind:key' directives.
    关于xampp中无法启动mysql,Attempting to start MySQL service...的解决办法!!
    PHP的环境搭建
    新手PHP连接MySQL数据库出问题(Warning: mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES))
    手机号码、获得当前时间,下拉框,填写限制
    团队作业(五):冲刺总结
  • 原文地址:https://www.cnblogs.com/wangoublog/p/15218794.html
Copyright © 2011-2022 走看看