All Products
Search
Document Center

Application Real-Time Monitoring Service:How do I deploy multiple instances on a single host?

Last Updated:Aug 18, 2026

To deploy multiple instances of an application on a single host, set the -Darms.agentId parameter to a unique value for each JVM process, such as 001, 002, or 003. This parameter specifies the JVM process to connect to.

Example

# Instance 1
java -javaagent:/{user.workspace}/ArmsAgent/aliyun-java-agent.jar \
  -Darms.licenseKey=<LicenseKey> \
  -Darms.appName=<AppName> \
  -Darms.agentId=001 \
  -jar demoApp.jar

# Instance 2
java -javaagent:/{user.workspace}/ArmsAgent/aliyun-java-agent.jar \
  -Darms.licenseKey=<LicenseKey> \
  -Darms.appName=<AppName> \
  -Darms.agentId=002 \
  -jar demoApp.jar

Replace the placeholders with your actual values:

PlaceholderDescriptionExample
{user.workspace}Absolute path to the ARMS agent installation directory/home/admin
<LicenseKey>ARMS license key for your applicationLTAI5tXxx
<AppName>Application name registered in ARMSmy-order-service
Note

The -javaagent argument must appear before the -jar argument. It is a JVM option, not an application argument.

Note

For ARMS agent versions earlier than 2.7.3.5, replace aliyun-java-agent.jar with arms-bootstrap-1.7.0-SNAPSHOT.jar. Upgrade to the latest agent version to access current features and fixes.

Docker container cross-host deployment scenario

If you deploy the same application in Docker containers on multiple ECS instances, the default Docker bridge network on every host uses the 172.17.0.0/16 subnet. As a result, containers on different hosts can be assigned the same internal IP address, such as 172.17.0.2. ARMS identifies application instances by IP address, so containers that share the same IP address are merged into a single instance in the Application Monitoring instance list.

Solution 1: Use host network mode

Start the container with --network=host so that the container uses the IP address of the host directly. Because each ECS instance has a different IP address, this avoids the IP address conflict caused by the default Docker bridge network.

docker run --network=host \
  -e JAVA_TOOL_OPTIONS="-javaagent:/{user.workspace}/ArmsAgent/aliyun-java-agent.jar -Darms.licenseKey=<LicenseKey> -Darms.appName=<AppName>" \
  <image>

Solution 2: Inject the agent ID by using an environment variable

If you cannot use host network mode, keep the same deployment script on every host and use the container's HOSTNAME environment variable, which has a different value on each host, to dynamically set -Darms.agentId. This approach avoids duplicate agent IDs without requiring host-specific configuration in the deployment script.

java -javaagent:/{user.workspace}/ArmsAgent/aliyun-java-agent.jar \
  -Darms.licenseKey=<LicenseKey> \
  -Darms.appName=<AppName> \
  -Darms.agentId=$HOSTNAME \
  -jar demoApp.jar