Traditional deployment architecture based on Zookeeper and Nacos for deploying Dubbo applications in a virtual machine environment

Traditional deployment architecture based on Zookeeper and Nacos for deploying Dubbo applications in a virtual machine environment

The following diagram illustrates a typical Dubbo microservice deployment architecture using Nacos and Zookeeper as the registration center.

Install Nacos

Please refer to the following documentation for how to install Nacos locally.

Deploy Application

We will continue to use the project in Quick Start as an example to demonstrate the detailed steps for application packaging and deployment.

Clone the sample project locally:

$ git clone -b main --depth 1 https://github.com/apache/dubbo-samples

Switch to the sample directory:

$ cd dubbo-samples/11-quickstart

Here are two packaging and deployment modes:

Method 1: Local Process

Local packaging process:

$ mvn clean package

Start the Dubbo process:

$ java -jar ./quickstart-service/target/quickstart-service-0.0.1-SNAPSHOT.jar

Method 2: Docker Container

$ docker build -f ./Dockerfile -t quickstart
$ docker run quickstart -p port1:port2
# Some port or connection details to the registration center need to be clarified

Check Deployment Status

Install and run dubbo-control-plane to check the local service deployment status:

  1. Download the installation package

    $ curl -L https://raw.githubusercontent.com/apache/dubbo-kubernetes/master/release/downloadDubbo.sh | sh -
    $ cd dubbo-$version/bin
    
  2. Run the following command to start the dubbo-control-plane process

    $ ./dubbo-cp run
    

Visit http://xxx to view service deployment details.

Graceful Online and Offline

In the case of using a traditional registration center, we need to control the timing of when instances are published to the registration center and when instances are removed from the registration center to achieve a graceful online and offline:

  1. In the online phase, control the timing of instance registration to the registration center through the delayed release mechanism and ensure that traffic is gradually forwarded to the new nodes through enabling consumer preheating.
  2. In the offline phase, configure prestop to ensure that instance registration information is first removed from the registration center, and then enter the process of destruction.

Before going offline, it is recommended to call the following http port to remove the instance from the registration center first, then attempt to stop the process.

$ curl http://offline
$ sleep 10
$ kill dubbo-pid
Last modified September 30, 2024: Translate (22d3d83a3b)