multi-zone/

directory
v1.5.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 4, 2022 License: Apache-2.0

README

Multi Zone Example

Background

Sometimes it is necessary to deploy Dubbo services into different zones for the sake of disaster tolerance or high availability. In order to consumer the services among the different registry centers, you may need to consider configuring your consumer like this:

# registry config
registries:
  "shanghaiZk":
    protocol: "zookeeper"
    timeout: "3s"
    address: "127.0.0.1:2182"
    username: ""
    password: ""
    zone: shanghai
    weight: 50

  "hangzhouZk":
    protocol: "zookeeper"
    timeout: "3s"
    address: "127.0.0.1:2183"
    zone: hangzhou
    weight: 200

# reference config
references:
  "UserProvider":
    registry: "shanghaiZk,hangzhouZk"
    protocol: "dubbo"
    interface: "org.apache.dubbo.UserProvider"
    cluster: "failover"
    methods:
      - name: "GetUser"
        retries: 3

Run Steps

  1. Start Zookeeper in docker environment.

    make -f ../build/Makefile docker-up
    
  2. Start Server

    Start Hangzhou zone server.

    cd go-server-hz
    make -f ../../build/Makefile clean start  
    

    Start Shanghai zone server.

    cd go-server-sh
    make -f ../../build/Makefile clean start  
    
    
  3. Run Consumer

    cd go-client
    make -f ../../build/Makefile run
    
  4. Cleanup

    cd go-server-hz && \
         make -f ../../build/Makefile clean && \
         cd ..
    cd go-server-sh && \
         make -f ../../build/Makefile clean && \
         cd ..
    cd go-client && \
         make -f ../../build/Makefile clean && \
         cd ..
    make -f ../build/Makefile docker-down
    

Directories

Path Synopsis
go-client
cmd command
pkg
go-server-hz
cmd command
pkg
go-server-sh
cmd command
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL