此内容没有您所选择的语言版本。

27.3.2. Configure Cross-Data Replication (Library Mode)


When configuring Cross-Datacenter Replication, the relay.RELAY2 protocol creates an additional stack (running parallel to the existing TCP stack) to communicate with the remote site. If a TCP-based stack is used for the local cluster, two TCP based stack configurations are required: one for local communication and one to connect to the remote site.
In JBoss Data Grid's Library mode, cross-datacenter replication is set up as follows:

Procedure 27.2. Setting Up Cross-Datacenter Replication

  1. Configure the Local Site

    Add the site element to the global element to add the local site (in this example, the local site is named LON).
    <infinispan>
       <global>
          ...
          <site local="LON" />
          ...   
       </global>
    </infinispan>
    
  2. Configure JGroups for the Local Site

    Cross-site replication requires a non-default JGroups configuration. Add the transport element and set up the path to the configuration file as the configurationFile property. In this example, the JGroups configuration file is named jgroups-with-relay.xml.
    <infinispan>
       <global>
          ...
          <site local="LON" />
          <transport clusterName="default"> 
             <properties> 
                 <property name="configurationFile" value="jgroups-with-relay.xml" />     
              </properties> 
          </transport> 
          ...   
       </global>
    </infinispan>
    
  3. Configure the LON Cache

    Configure the cache in site LON to back up to the sites NYC and SFO:
    <infinispan>
       <global>      
          <site local="LON" />
          ...   
       </global>
       ...
       <namedCache name="lon">
          <sites>
             <backups>
                <backup site="NYC" 
    		    strategy="SYNC" 
    		    backupFailurePolicy="WARN" />
                <backup site="SFO" 
    		    strategy="ASYNC" 
    		    backupFailurePolicy="IGNORE"/>
             </backups>
          </sites>
       </namedCache>
    </infinispan>
    
  4. Configure the Back Up Caches

    1. Configure the cache in site NYC to receive back up data from LON:
      <infinispan>
         <global>      
            <site local="NYC" />
            ...   
         </global>
         ...
         <namedCache name="lonBackup">
            <sites>
               <backupFor remoteSite="LON" 
      		    remoteCache="lon" />
            </sites>
         </namedCache>
      </infinispan>
      
    2. Configure the cache in site SFO to receive back up data from LON:
      <infinispan>
         <global>      
            <site local="SFO" />
            ...   
         </global>
         ...
         <namedCache name="lonBackup">
            <sites>
               <backupFor remoteSite="LON" 
      		    remoteCache="lon" />
            </sites>
         </namedCache>
      </infinispan>
      
  5. Add the Contents of the Configuration File

    As a default, Red Hat JBoss Data Grid includes JGroups configuration files such as jgroups-tcp.xml and jgroups-udp.xml in the infinispan-core-{VERSION}.jar package.
    Copy the JGroups configuration to a new file (in this example, it is named jgroups-with-relay.xml) and add the provided configuration information to this file. Note that the relay.RELAY2 protocol configuration must be the last protocol in the configuration stack.
    <config> 
        ... 
        <relay.RELAY2 site="LON" 
                  config="relay.xml"
                  relay_multicasts="false" />
    </config>
    
  6. Configure the relay.xml File

    Set up the relay.RELAY2 configuration in the relay.xml file. This file describes the global cluster configuration.
    <RelayConfiguration> 
        <sites> 
            <site name="LON" 
                  id="0"> 
                <bridges> 
                    <bridge config="jgroups-global.xml" 
                            name="global"/> 
                    </bridges> 
            </site>  
            <site name="NYC" 
                  id="1"> 
                <bridges> 
                    <bridge config="jgroups-global.xml" 
                            name="global"/> 
                    </bridges> 
            </site>  
            <site name="SFO" 
                  id="2"> 
                <bridges> 
                    <bridge config="jgroups-global.xml" 
                            name="global"/> 
                </bridges> 
            </site> 
        </sites> 
    </RelayConfiguration>
    
  7. Configure the Global Cluster

    The file jgroups-global.xml referenced in relay.xml contains another JGroups configuration which is used for the global cluster: communication between sites.
    The global cluster configuration is usually TCP-based and uses the TCPPING protocol (instead of PING or MPING) to discover members. Copy the contents of jgroups-tcp.xml into jgroups-global.xml and add the following configuration in order to configure TCPPING:
    <config> 
        <TCP bind_port="7800" ... /> 
        <TCPPING initial_hosts="lon.hostname[7800],nyc.hostname[7800],sfo.hostname[7800]"     
                 num_initial_members="3" 
                 ergonomics="false" /> 
              <!-- Rest of the protocols --> 
    </config>
    
    Replace the hostnames (or IP addresses) in TCPPING.initial_hosts with those used for your site masters. The ports (7800 in this example) must match the TCP.bind_port.
    For more information about the TCPPING protocol, see Section 24.3.1.3, “Using the TCPPing Protocol”
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部