Quick Start for MongoDB on CloudBox

更新时间:
复制 MD 格式

This topic describes how to use MongoDB on CloudBox, from creating an instance to connecting to the database.

Step 1: Create an instance

Before you start, create a MongoDB on CloudBox instance.
Note This tutorial uses an example where a password is set during instance creation.
  1. Log on to the MongoDB console.
  2. In the navigation pane on the left, click Replica Set Instances.
  3. On the Replica Set Instances page, click Create Instance.
  4. On the instance purchase page, configure the following parameters.
    ParameterDescription
    Product TypeSelect Replica Set (Pay-As-You-Go) on CloudBox.
    RegionSelect a region customized for CloudBox.
    Only the following regions support MongoDB on CloudBox instances:
    • China (Hangzhou)
    • China (Beijing)
    • China (Heyuan)
    ZoneSelect a zone customized for CloudBox.
    Database VersionSelect a database version based on your business needs.
    • MongoDB 5.0
    • MongoDB 4.4
    Storage EngineThe value is fixed to WiredTiger.
    Storage ClassThe value is fixed to standard SSD.
    Primary and Secondary NodesThe value is fixed to Three Nodes.
    Resource GroupSelect a resource group to manage the instance. You can add the instance to an existing resource group or create a new one. For more information about how to create a resource group, see Create a resource group.
    Note By setting a resource group, you can centrally manage multiple cloud resources across different regions under a single Alibaba Cloud account.
    Network TypeThe value is fixed to virtual private cloud (VPC).
    VPCSelect an available VPC.

    If you do not have an available VPC, create one in the VPC console. For more information, see Create and manage a VPC. After the VPC is created, return to the ApsaraDB for MongoDB purchase page and click the 刷新 icon to refresh the list.

    vSwitchSelect an available vSwitch.

    If you do not have an available vSwitch, create one in the VPC console. For more information, see Create and manage a vSwitch. After the vSwitch is created, return to the ApsaraDB for MongoDB purchase page and click the 刷新 icon to refresh the list.

    SpecificationsSelect the CPU and memory specifications for the instance.

    For information about the specifications supported by CloudBox instances, see Product specifications.

    Storage SpaceThe storage space for each node in the instance. The value must be a multiple of 10 and range from 20 GB to 6000 GB.
    UsernameThe value is fixed to root.
    Password SettingsSet the password for the root account. You can choose one of the following methods:
    • Set Now: Set the password immediately.
    • Set After Creation: Set the password after the instance is running. For more information, see (Optional) Reset a password.
    PasswordIf you choose to set the password now, follow these rules:
    • It must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters.

      The special characters are !@#$%^&*()_+-=.

    • The password must be 8 to 32 characters in length.
    QuantitySelect the number of instances with the same configuration. The value must be an integer from 1 to 10.
  5. After you configure the parameters, click Buy Now.
  6. On the Confirm Order page, confirm the parameter settings, and then read and select the Terms of Service.
  7. Click Activate Now. The system automatically deducts the fee within the next hour.
  8. Click Console to go to the instance list page and view the instance that is being created.

Step 2: Log on to the database

You need to log on to the database to manage its data. This topic uses Data Management (DMS) to demonstrate how to log on to a database.

  1. Log on to the ApsaraDB for MongoDB console .

  2. In the left-side navigation pane, click Replica Set Instances.

  3. In the upper-left corner of the page, select the resource group and region to which the desired instance belongs.

  4. Click the ID of the instance that you want to manage or click Manage in the Actions column.

  5. In the upper-right corner of the page that appears, click Log On and select Primary, Secondary, or Readonly. Then, you are redirected to the DMS page.

    Note
    • Primary: the primary node in the replica set instance. If you connect to this node, you can perform both read and write operations on the databases of the replica set instance.

    • Secondary: secondary nodes in the replica set instance. If you connect to a secondary node, you can perform only read operations on the databases of the replica set instance.

    • Readonly: read-only nodes in the replica set instance. If you connect to a read-only node, you can perform only read operations on the databases of the replica set instance.

  6. In the Log on to Database Instance dialog box, configure the parameters described in the following table.

    Parameter

    Description

    Database Type

    The engine of the database. By default, the engine of the database to be connected is selected.

    Instance Region

    The region in which the instance is deployed. By default, the region of the current instance is selected.

    Connection String Address

    The endpoint of the instance. By default, the endpoint of the current instance is displayed.

    Database Name

    The name of the authentication database in which the database account is created.

    Note
    • If Database Account is set to root, the database name is admin.

    • We recommend that you do not log on to a database as the root user in the production environment. You can create a user and grant permissions based on your requirements. For more information, see Manage user permissions on MongoDB databases.

    Security hosting

    The instance for which you enable security hosting enters the logon-free state. For more information about how to enable security hosting, see Security hosting.

    Database Account

    The account that is used to access the database. The initial account is root.

    Database Password

    The password of the database account.

    Note

    If you have forgotten the password of the root account, reset a password.

    Control Mode

    The mode that you use to manage the instance. Select a control mode based on your business requirements.

  7. Click Login.

    Note

    If you want the browser to save the password, select Remember password and then click Login.