dubbo-spring-boot-starter配置注册中心集群

Zookeeper集群配置

方式一


spring.dubbo.registry.address=zookeeper://localhost:2182?backup=localhost:2181,localhost:2183

方式二


spring.dubbo.registry.protocol=zookeeper
spring.dubbo.registry.address=localhost:2182,localhost:2181,localhost:2183

或者


spring.dubbo.registry.protocol=zookeeper
spring.dubbo.registry.address=192.168.1.32:2182|192.168.1.32:2181|192.168.1.32:2183

源码

spring.dubbo是固定的,这个是在DubboProperties中定义的:

@ConfigurationProperties(prefix = "spring.dubbo")
public class DubboProperties {
    /**
   * Indicates dubbo server
   */
    private boolean server;

    /**
   * {@link ApplicationConfig} property
   */
    private ApplicationConfig application;

    /**
   * {@link ModuleConfig} property
   */
    private ModuleConfig module;

    /**
   * {@link RegistryConfig} property
   */
    private RegistryConfig registry;

    /**
   * {@link ProtocolConfig} property
   */
    private ProtocolConfig protocol;

    /**
   * {@link MonitorConfig} property
   */
    private MonitorConfig monitor;

    /**
   * {@link ProviderConfig} property
   */
    private ProviderConfig provider;

    /**
   * {@link ConsumerConfig} property
   */
    private ConsumerConfig consumer;

    //..
}
public class RegistryConfig extends AbstractConfig {

    public static final String NO_AVAILABLE = "N/A";
    private static final long serialVersionUID = 5508512956753757169L;
    // register center address
    private String address;
    
    // protocol for register center
    private String protocol;

    // username to login register center
    private String username;

    // password to login register center
    private String password;

    // default port for register center
    private Integer port;

    // client impl
    private String transporter;

    private String server;

    private String client;

    private String cluster;

    private String group;

    //...
}



你可能感兴趣的:(dubbo-spring-boot-starter配置注册中心集群)