Updated on 2023-11-03 GMT+08:00

Step 1: Prepare the Environment

VPC

A VPC provides an isolated virtual network for your RocketMQ instances. You can configure and manage the network as required.

  1. Before creating a RocketMQ instance, ensure that a VPC and a subnet are available.

    For details, see Creating a VPC. If you already have an available VPC and subnet, you do not need to create new ones.

    Note the following when creating a VPC and subnet:

    • The VPC and the RocketMQ instance must be in the same region.
    • Use the default settings when creating a VPC and subnet.

  2. Before creating a RocketMQ instance, ensure that a security group is available.

    For details, see Creating a Security Group. If you already have an available security group, you do not need to create a new one.

    Note the following when creating a security group:

    • Set Template to Custom.
    • To use DMS for RocketMQ, add the security group rules described in Table 1. You can also add other rules based on site requirements.
      Table 1 Security group rules

      Direction

      Protocol

      Port

      Source

      Description

      Inbound

      TCP

      8100

      0.0.0.0/0

      The port is used for intra-VPC access to metadata nodes.

      Inbound

      TCP

      10100-10199

      0.0.0.0/0

      The port is used for accessing service nodes.

      After a security group is created, retain the default inbound rule that allows communication among ECSs within the security group and the default outbound rule that allows all outbound traffic. If you access your RocketMQ instance within a VPC, you do not need to add the rules described in Table 1.

ECS

Before connecting to a RocketMQ instance, ensure that you have purchased an ECS, installed the JDK, and configured environment variables. The following takes a Linux ECS as an example. For more information about how to install JDK and configure the environment variables for a Windows ECS, please search the Internet.

  1. Log in to the management console, click in the upper left corner, click Elastic Cloud Server under Computing, and then create an ECS.

    For details, see Purchasing an ECS. If you already have an available ECS, skip this step.

  2. Log in to the ECS.
  3. Install JDK or JRE, and add the following contents to .bash_profile in the home directory to configure the environment variables JAVA_HOME and PATH: In this command, /opt/java/jdk1.8.0_151 is the JDK installation path. Change it to the path where you install JDK or JRE.

    export JAVA_HOME=/opt/java/jdk1.8.0_151 
    export PATH=$JAVA_HOME/bin:$PATH

    Run the source .bash_profile command for the modification to take effect.

    Use Oracle JDK instead of ECS's default JDK (for example, OpenJDK), because ECS's default JDK may not be suitable for the sample project. Obtain Oracle JDK 1.8.111 or later from Oracle's official website.