Quick Start
This section demonstrates how to use Spring Cloud Alibaba Sidecar to access heterogeneous micro-services written in a non-Java language.
Use requirements
-
[Must] Your heterogeneous microservice needs to communicate using HTTP. This is not strictly a requirement because the Spring Cloud itself is based on HTTP;
-
[Optional] If sidecar.health-check-url is configured for the micro service, the health check is enabled. In this case, your heterogeneous micro service needs to implement the health check.
Preparation work
Download and start Nacos Server
Before adding Sidecar, start the Nacos Server.
-
Download and decompress the Nacos binary file;
-
Start the Nacos Server;
After downloading and decompressing, we need to enter the bin directory to start nacos service. Do not double-click to start NACos service. By default, double-click to start NACos service will be started in cluster mode.
-
Log in to Nacos.
If we go to the browser and type localhost:8848/nacos, we can see that Nacos provides the console interface username and password are both nacos/nacos.
Introduce dependencies
Introduce the following dependencies into the Spring Boot project that has been created:
Prepare heterogeneous services
Note:
This example provides a NodeJS service. Node.js needs to be installed in the local environment to start the Node service and experience the Sidecar function!
Write the relevant configuration
Start service and test
View heterogeneous services on the Nacos console:
Access heterogeneous services:
Browser to access http://127.0.0.1:8070/node-service/health.json to transfer general principles of the integration of success.
Spring Cloud Alibaba Sidecar Example reference: Spring Cloud Alibaba Sidecar Example
For more advanced Sidecar features and how to use them, see the Sidecar Advanced Guide section!