You can enable Microservices Governance of Microservices Engine (MSE) for microservice applications that are deployed in environments, such as Elastic Compute Service (ECS) instances and non-Alibaba Cloud virtual machines (VMs). After Microservices Governance is enabled for the applications, you can use a series of microservices governance capabilities that are provided by MSE to govern the applications. This greatly improves the stability of online microservice applications and the development efficiency of microservice applications. This topic describes how to enable Microservices Governance for microservice applications that are deployed on ECS instances.
Prerequisites
An ECS instance is created. For more information, see Create an ECS instance.
A Java Development Kit (JDK) is installed, and related Java environment variables are configured. For more information, see Java Downloads.
To install the MSE Java agent, you must make sure that at least 300 MB of memory space is reserved for the node on which you want to install the MSE Java agent.
The microservice applications on ECS instances must be deployed in the same region as Microservices Governance of the MSE console. The license keys vary based on regions.
MSE Microservices Governance provides the Basic Edition, Professional Edition, and Enterprise Edition.
Step 1: Download the installation package of the MSE Java agent
Log on to the ECS console.
In the left-side navigation pane, choose Instances & Images > Instances.
In the top navigation bar, select a region.
On the Instances page, find the instance for which you want to enable Microservices Governance and click Connect in the Actions column.
In the Remote connection dialog box, select a connection method. For more information, see Connection method overview.
Download the installation package of the MSE Java agent.
URL for downloading the installation package of the MSE Java agent from the Internet in each region:
http://arms-apm-${regionId}.oss-${regionId}.aliyuncs.com/AliyunJavaAgent.zip
URL for downloading the installation package of the MSE Java agent from a virtual private cloud (VPC) in each region:
http://arms-apm-${regionId}.oss-${regionId}-internal.aliyuncs.com/AliyunJavaAgent.zip
In this example, the MSE Java agent is downloaded by using a shell script in the China (Hangzhou) region.
NoteThe content of the MSE Java agent varies based on regions.
Command for downloading scripts from the Internet
wget http://arms-apm-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com/AliyunJavaAgent.zip \ -O AliyunJavaAgent.zip
Command for downloading scripts from a VPC: (used if the scripts cannot be downloaded from the Internet)
wget http://arms-apm-cn-hangzhou.oss-cn-hangzhou-internal.aliyuncs.com/AliyunJavaAgent.zip \ -O AliyunJavaAgent.zip
Step 2: Install the MSE Java agent
Decompress and install the installation package of the MSE Java agent after it is downloaded.
Decompress
AliyunJavaAgent.zip
into a directory.unzip AliyunJavaAgent.zip -d /{user.workspace}/
NoteReplace {user.workspace} with the directory that you use.
Add the mse.appName, mse.licenseKey, and profiler.micro.service.mse.version parameters to the application startup parameters.
-javaagent:/{user.workspace}/AliyunJavaAgent/aliyun-java-agent.jar -Dmse.licenseKey=<yourLicenseKey> # Replace <yourLicenseKey> with the license key that is automatically generated by the system. You can view the license key in the MSE Microservices Governance console. Do not disclose the license key. -Dmse.appName=<yourAppName> # Replace <yourAppName> with the custom name of your application. -Dprofiler.micro.service.mse.version=pro -Dmse.namespace=default -Dmse.enable=true
For example:
The following command is the original command for starting the application.
java -jar application.jar
To enable MSE Microservices Governance for the application, change the original command to the following command:
java -javaagent:/{user.workspace}/AliyunJavaAgent/aliyun-java-agent.jar -Dmse.licenseKey=xxx -Dmse.appName=xxx -Dprofiler.micro.service.mse.version=pro -Dmse.namespace=default -Dmse.enable=true -jar application.jar
MSE and Application Real-Time Monitoring Service (ARMS) share the same agent. If your application is connected to MSE and ARMS at the same time, you need to only add the mse.licenseKey, mse.appName, and mse.enable parameters. You do not need to add the javaagent parameter.
Parameter
Description
mse.licenseKey
The license key that is automatically generated by the system. Do not disclose the license key to a third party.
The value of mse.licenseKey varies based on regions.
mse.appName
The name of the application. Replace
<yourAppName>
with the name of your application.profiler.micro.service.mse.version
The Microservices Governance edition in use. Valid values:
base: Basic Edition
pro: Professional Edition
ent: Enterprise Edition
mse.namespace
The name of the Microservices Governance namespace to which the application belongs to.
Step 3: Verify the result
Log on to the MSE console, and select a region in the top navigation bar.
In the left-side navigation pane, choose to check whether your application is connected to MSE.
What to do next
After you complete the preceding steps, Microservices Governance is enabled for your applications, such as the applications that are deployed on ECS instances and non-Alibaba Cloud VMs. You can log on to the MSE console, and use Microservices Governance of MSE to perform service governance for your Spring Cloud applications or Dubbo applications.