Manually install the agent for Java applications

Updated at:

You can use the agent (SDK) to integrate your application with MSHA multi-active disaster recovery with minimal changes to your code. This integration enables disaster recovery for both the service and data layers. This topic describes how to install and uninstall the MSHA agent.

Install the agent

  1. Log in to the MSHA console.

  2. In the navigation pane on the left, choose Monitoring Center > Agent Management.

  3. On the Agent Management page, click View License, and then click Copy License.

  4. Add the MSHA SDK as a dependency to your application and modify your code to implement the required features.

  5. Configure the following JVM parameters.

    -Dmsha.app.name=${application_name} 
    -Dmsha.namespaces=${namespace_ID} 
    -Dmsha.license=${your_license}

    Parameter descriptions:

    • ${application_name}: The name of your application. The name cannot contain Chinese characters.

    • Separate multiple namespace IDs with a comma (,). You can find the namespace IDs on the Basic Configurations > Namespace page.

    • ${your_license}: The license you obtained in Step 3.

  6. Configure Nacos as the rule delivery channel and set the required JVM parameters for the agent to connect to Nacos. For more information, see Configure Nacos as a rule delivery channel.

  7. Restart your application.

    After your application starts, the agent automatically sends heartbeat information. The installation is successful if your application instance appears in the list on the Agent Management page with a status of online.

Uninstall the agent

  1. Remove the JVM parameters you configured during installation.

  2. Restart your application.

    After the application restarts, go to the Agent Management page. The uninstallation is successful if the status of your application instance is offline or if the instance is removed from the list.