如何在一个yaml文件中配置多个hazelcast tcp-ip群集? [英] How to configure multiple hazelcast tcp-ip clusters in one yaml file?

查看:142
本文介绍了如何在一个yaml文件中配置多个hazelcast tcp-ip群集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要在一个yml文件中配置一个群集,我可以这样做:

To configure one cluster in one yml file, I could do:

hazelcast:
  cluster-name: cluster1
  network: 
    join:
      multicast: 
        enabled: false
      tcp-ip:
        enabled: true
        member-list:
          - machineA
          - machineB

但是,由于yaml文件的结构方式,我发现很难制作一个包含2个群集的yaml文件.如果我通过以下方式进行操作,它将无法正常工作:

However, because of the way the yaml file is structured, I find it difficult to do a yaml file with 2 clusters. If I do it the following way, it would not work:

hazelcast:
  cluster-name: 
   - cluster1
       network: 
         join:
           multicast: 
             enabled: false
           tcp-ip:
             enabled: true
             member-list:
               - machineA
               - machineB
   - cluster2
       network: 
         join:
           multicast: 
             enabled: false
           tcp-ip:
             enabled: true
             member-list:
               - machineC
               - machineD

推荐答案

您应为每个集群定义单独的配置.您所做的是无效的配置.假设您有两种不同的配置: cluster1.yaml 配置和 cluster2.yaml 配置.然后,cluster1的所有成员都应以cluster1.yaml开头,而cluster2中的成员应使用cluster2.yaml.如果您需要多个群集来相互了解-例如正在同步,请考虑使用 WAN复制.

You should define separate configurations per cluster. What you did is an invalid configuration. Say you have two different configurations: cluster1.yaml config and cluster2.yaml config. Then all the members of cluster1 should start with cluster1.yaml and the ones in cluster2 should use cluster2.yaml. If you need multiple clusters to be aware of each other - e.g being synchronized, consider using WAN Replication.

在这种情况下,配置将如下所示:

In that case the configurations will look like:

cluster1.yaml:

cluster1.yaml:

hazelcast:
  cluster-name: cluster1
  network:
    join:
      tcp-ip:
        enabled: true
        member-list:
          - A  # uses this config
          - B  # uses this config

cluster2.yaml:

cluster2.yaml:

hazelcast:
  cluster-name: cluster2
  network:
    join:
      tcp-ip:
        enabled: true
        member-list:
          - C  # uses this config
          - D  # uses this config

这篇关于如何在一个yaml文件中配置多个hazelcast tcp-ip群集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆