Using Nacos as a service registry

更新时间:
复制 MD 格式

SOFARPC supports using Nacos as a service registry. This topic describes the required configuration.

Prerequisites

You must have Nacos Server deployed locally. The default service discovery port is 8848. For more information about the deployment, see Nacos Quick Start.

Procedure

To use Nacos as a service registry in SOFARPC, follow these steps:

  1. Add the following configuration to application.properties:

    com.alipay.sofa.rpc.registry.address=nacos://127.0.0.1:8848
    com.alipay.sofa.rpc.use.custom.registry=true
  2. Add the Nacos dependency:

    <dependency>
        <groupId>com.alibaba.nacos</groupId>
        <artifactId>nacos-client</artifactId>
        <version>${version}</version>
    </dependency>

    Replace ${version} with the Nacos version that you want to use. The supported Nacos versions are:

    • SOFARPC 5.5.0 supports Nacos client version 0.6.0 and SOFABoot version 2.5.3.

    • SOFARPC 5.6.0 supports Nacos client version 1.0.0 and Nacos server versions 1.x.x and 2.x.x.

    • SOFARPC 5.8.0 supports Nacos client version 2.0.3 and Nacos server version 2.x.x.