How to use docker to deploy dubbo project

How to use docker to deploy dubbo project

1. First, use springboot to build a simple dubbo test program and introduce related dependencies

Writing a public interface API

insert image description here

insert image description here

Write a provider to implement UserSvice and expose the service

insert image description here

Write the provider configuration file

insert image description here

Writing a Consumer
Get user information by calling the provider's service and return

insert image description here

Consumer configuration file

insert image description here

Testing procedures completed

insert image description here

Start locally to see if the program can call the service to start Zookeeper normally

insert image description here

Start the provider first and then the consumer

insert image description here

Through the dubbo console, we can see that our service has been successfully registered.

insert image description here

By accessing the local, we can see that our service can be called normally and return information

insert image description here

2.Package the project and upload it to the server

Modify the configuration file and change the address of the registration center to the address of the server

insert image description here

insert image description here

Use Maven to package and write Dockerfile files

insert image description here

Upload the provider and consumer jar packages and the corresponding Dockerfile files to the server

insert image description here

insert image description here

3. Build the image

Pull the zookeeper image

docker pull zookeeper

Build the service provider image

insert image description here

insert image description here

Build a consumer image

insert image description here

View All Mirrors

insert image description here

Add Alibaba Cloud security group

insert image description here

Start the zookeeper image, provider, and consumer in sequence
Here we start by sharing the network with the host, –net = host
Because our test service is very simple, we can start it directly using --net = host mode without configuring the network. Containers can communicate with each other or we can start it using port mapping:

docker run -d -p 2181:2181 --name zk01 zookeeper

insert image description here

View all started containers

insert image description here

test:

Open the browser and enter the server's IP address to access the service through our server's address:

insert image description here

Successfully return information, then our service deployment is complete

This is the end of this article about the steps to deploy the dubbo project using docker. For more relevant content about deploying dubbo with docker, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Detailed explanation of the tutorial for beginners integrating dubbo with springboot
  • Detailed explanation of how to build services using dubbo+zookeeper+spring boot
  • Dubbo service configuration method based on annotations (example explanation)
  • Detailed explanation of the service reference process of Dubbo, a distributed service framework developed in Java
  • Java development distributed service framework Dubbo calling process
  • Detailed explanation of the example of Dubbo load balancing and cluster fault tolerance developed in Java
  • Detailed explanation of the service exposure process of Dubbo, a distributed service framework developed in Java

<<:  Use Vue3 for data binding and display list data

>>:  Things to note when writing self-closing XHTML tags

Recommend

Let's talk briefly about the changes in setup in vue3.0 sfc

Table of contents Preface Standard sfc writing me...

How does MySQL achieve multi-version concurrency?

Table of contents MySQL multi-version concurrency...

HTML table markup tutorial (4): border color attribute BORDERCOLOR

To beautify the table, you can set different bord...

Vue implements two-way data binding

This article example shares the specific code of ...

How to configure nginx to return text or json

Sometimes when requesting certain interfaces, you...

Simple usage example of MySQL 8.0 recursive query

Preface This article uses the new features of MyS...

TypeScript enumeration basics and examples

Table of contents Preface What are enums in TypeS...

Windows DNS server exposed "worm-level" vulnerability, has existed for 17 years

Vulnerability Introduction The SigRed vulnerabili...

Vue project realizes paging effect

The paging effect is implemented in the vue proje...

HTML exceeds the text line interception implementation principle and code

The HTML code for intercepting text beyond multipl...

How to quickly deploy Gitlab using Docker

1. Download the gitlab image docker pull gitlab/g...

The principle and basic use of Vue.use() in Vue

Table of contents Preface 1. Understanding with e...

Linux file systems explained: ext4 and beyond

Today I will take you through the history of ext4...

A complete guide to some uncommon but useful CSS attribute operations

1. Custom text selection ::selection { background...