10-minute local trial of the public cloud distributed transaction service

更新时间:
复制 MD 格式

This topic describes how to quickly try the public cloud distributed transaction service locally.

Procedure

  1. Activate the distributed transaction service.

    Note
    • If you have already activated the service, skip this step.

    • If you do not have an account, you can scan a QR code with Alipay to log on.

    1. Log on to the Distributed Transaction Service (DTX) console.

    2. On the Activate DTX Distributed Transaction Trial Edition page, click Confirm Activation.

      If the activation is successful, the message Congratulations, your order to activate the DTX Distributed Transaction Trial Edition was successful appears. On this page, click Enter Console to open the DTX console.

  2. Request and download the demo.

    1. Log on to the console to request the local trial demo.

    2. Click Request and Download Local Trial Demo.

      After you click the button, the system builds and downloads the demo in the background.

    3. Place the ZIP file in a folder, such as /home/XX/dtx-demo.

  3. Start the agent.

    1. Navigate to the unzipped folder. The folder contains the following items:

      image.png

      • agent: Contains the files required to start the agent.

      • account-demo-saga: A saga demo for distributed transactions.

    2. Navigate to the agent folder and run the following command to start the agent.

      cd agent
      sh start_agent.sh

      After the agent starts, a new Java process runs locally.

  4. Download settings.xml and recompile the demo.

    1. Open the account-demo-saga project in IntelliJ IDEA.

      Note

      The demo requires Java 1.8.

    2. Download the settings.xml file and place it in the ~/.m2/ folder.

      Alternatively, you can configure the Maven settings in IntelliJ IDEA to use the downloaded settings.xml file.

  5. Obtain an AccessKey.

    1. Log on to the Management Console.

    2. On the Service Accounts page, click Add Service Account.

    3. In the dialog box that appears, enter a Name and Description for the service account, and then click OK.

      The new service account appears in the service account list. The system automatically assigns a unique ID to the service account.

    4. In the service account list, find the service account that you want to view. In the Operation column for the account, click Details to view its details, which include the AccessKey information and role permissions:

      • ID: The AccessKey ID of the service account.

      • Secret: The AccessKey secret of the service account. Click the view icon (2.png) to view the AccessKey secret in plaintext.

    5. Replace the values of com.antcloud.mw.access and com.antcloud.mw.secret in the demo configuration.

      image.png

  6. Start the demo.

    The startup class is com.alipay.sofa.dtx.account.main.AccountMain. After compiling, run the class. The startup is successful if the demo starts without errors and displays the following output. You can then navigate to the public cloud DTX console to view the results.

    image.png

  7. Log on to the DTX console to view the transaction results after the demo has run.

FAQ

Symptom:

The demo fails to start and reports the following error: "Unable to make field private java.lang.String java.lang.StackTraceElement.classLoaderName accessible: module java.base does not "opens java.lang" to unnamed module".

image.png

Solution:

Change the Java version to 1.8.