Getting started with Cloud DB for MongoDB
    • PDF

    Getting started with Cloud DB for MongoDB

    • PDF

    Article Summary

    Available in VPC

    The Getting started with Cloud DB for MongoDB describes what you need to do to properly use Cloud DB for MongoDB after checking the Cloud DB for MongoDB environmental requirements and supported specifications and fully understanding the Overall usage scenario and Glossary. The following is the content dealt with in Getting started with Cloud DB for MongoDB.

    • How to create an application server (app server) from the NAVER Cloud Platform console
    • How to test the application server access
    • How to create the MongoDB Server from the NAVER Cloud Platform console
    • How to test the MongoDB Server connection

    If you have completed the above, then you have completed the basic procedure for using Cloud DB for MongoDB. Afterward, you have the option of proceeding with the following tasks for more efficient server management and operation.

    • Event and notification settings using NAVER Cloud Platform's Cloud Insight
    • Managing administration permissions using NAVER Cloud Platform's Sub Account
    • Storage of log files and backup files using NAVER Cloud Platform's Object Storage

    The above tasks can be done from Cloud Insight, Sub Account, or Object Storage after subscribing, rather than in Cloud DB for MongoDB. They are not explained in detail in this guide. For detailed instructions, refer to Cloud Insight user guide, Sub Account user guide, and Object Storage user guide.

    Create application server

    The following describes how to create an application server from the NAVER Cloud Platform console.

    Caution

    In this section, we will briefly introduce how to create an application server. For more information about full creation methods, see Server user guide.

    1. Access the NAVER Cloud Platform console.
    2. Click VPC from the Platform menu to switch to the VPC environment.
    3. Click the Services > Compute > Server menus, in that order.
    4. Click the [Create server] button.
    5. Select the server image and click the [Next] button.
    6. Enter the required information, and then click the [Next] button.
    7. If you do not have an existing authentication key, then create a new authentication key and click the [Next] button.
    8. If you do not have ACG, create a new one.
    9. For simple installation, set it as 0.0.0.0/0 to allow access from anywhere.
    10. After the final confirmation, click the [Create server] button.
    Caution
    • The ACG name of the application server from step 8 is used when adding ACG to the MongoDB Server later on.
    • In step 9, configure a single IP address to only allow access from your personal PC, if possible, for security. Please check your personal PC's IP address at http://www.findip.kr/.

    Set access environment

    From the NAVER Cloud Platform console, you can set up the access environment for application servers by either setting up a public IP or an SSL VPN.

    Caution

    In this section, we will briefly introduce how to set up the access environment. For more information about setting up the access environment, see Public IP user guide and SSL VPN user guide.

    Set public IP

    The following describes how to set up a public IP.

    1. Access the NAVER Cloud Platform console.
    2. Click VPC from the Platform menu to switch to the VPC environment.
    3. Click the Services > Compute > Server menus, in that order.
    4. Click the Public IP menu.
    5. Click the [Request for public IP] button.
    6. Select the target server, enter a memo, and then click the [Next] button.
    7. Click the [Create] button.

    Get admin password

    After setting up the public IP, you can get the admin (root) password required for accessing the application server through the following steps:

    1. Access the NAVER Cloud Platform console.
    2. Click VPC from the Platform menu to switch to the VPC environment.
    3. Click the Services > Compute > Server menus, in that order.
    4. Click the [Manage servers] button, and then click the Get admin password menu.
    5. Enter the authentication key generated while creating the server.
    6. Click the [Get password] button.
    7. Check the password.

    Set SSL VPN

    You can allow external access to the MongoDB server to be created by using SSL VPN through the following steps:

    1. Create SSL VPN
    2. Add the VPN range to subnet's route table
    3. Set the MongoDB Server's ACG
    4. Set the MongoDB Server's DB user
    5. Check the access information of the MongoDB Server

    1. Create SSL VPN

    The following describes how to create an SSL VPN.

    1. From the NAVER Cloud Platform console, click the Services > Security > SSL VPN menus in that order.
    2. Click the SSL VPN menu.
    3. Click the [Request for an SSL VPN] button.
    4. When the Create SSL VPN pop-up window appears, enter the required information, and then click the [Create] button.
    5. After creation, check the SSL VPN IP address range from the delivered email or the SSL VPN page of the console.

    2. Add the VPN range to subnet's route table

    The following describes how to add a VPN range to the subnet's route table.

    1. From the NAVER Cloud Platform console, click the Services > Networking > VPC menus in that order.
    2. Click the Route table menu.
    3. Register the range of each SSL VPN to the route table of the subnet to be used.
    4. Click and select the route table to set up, and then click the [Set routes] button.
    5. When the Set route table pop-up window appears, enter the required information.
      • Destination: SSL VPN's IP pool
      • Target Type: SSL VPN
      • Target name: the name of the created SSL VPN
    6. Click the [OK] button.

    3. Set the MongoDB Server's ACG

    The following describes how to set up a MongoDB Server's ACG.

    1. From the NAVER Cloud Platform console, click the Services > Database > Cloud DB for MongoDB menus in this order.
    2. Click the DB Server menu.
    3. From the details page of the server to be configured, click the clouddb_ico-01_vpc button of the ACG.
    4. Click the [Set ACG] button.
    5. Add settings to allow SSL VPN access.
      • Access source: the IP address bandwidth of SSL VPN
      • Allowed port: DB server port
    6. Click the [Apply] button.

    4. Set the MongoDB Server's DB user

    The following describes how to set up MongoDB Server's DB user.

    1. From the NAVER Cloud Platform console, click the Services > Database > Cloud DB for MongoDB menus in this order.
    2. Click the DB Server menu.
    3. Click to select the server to configure, and then click the Manage DB > Manage DB user buttons, in that order.
    4. Add DB user to allow access from the VPN bandwidth.
    5. Click the [Save] button.

    5. Check the access information of the MongoDB Server

    After completing the external access settings using SSL VPN, check the access information of the MongoDB Server. The following describes how to view this information.

    1. From the NAVER Cloud Platform console, click the Services > Database > Cloud DB for MongoDB menus in this order.
    2. Click the DB Server menu.
    3. Click to select the server you want to check, and check the necessary information from the View details page.
      • Private domain: it is a domain that can only be accessed from NAVER Cloud Platform servers, and is used similarly as the DB server host name.
      • DB access port

    Test application server access

    You can use the terminal program, PuTTY, to test if you can properly connect to the application server through the following steps:

    1. Run PuTTY.

    2. Enter the IP address and port number acquired from the access environment settings for Host Name (or IP address) and Port.
      clouddbformongodb-start_putty_vpc

    3. Click the [Open] button.

    4. When the PuTTY Security Alert pop-up window appears, click the [Accept] button.
      clouddbformongodb-start_connect_vpc

    5. When the cmd window for server access appears, enter the password you got from Get admin password.
      clouddbformongodb-start_login_vpc

    Note

    You can change the password through the passwd command.

    Creating MongoDB Server

    Some of the services provided by NAVER Cloud Platform require you to go through the subscription procedure from the console before starting actual usage. However, for Cloud DB for MongoDB, you can start using it upon creation of a MongoDB Server without a separate subscription step. The following describes how to create a MongoDB Server from the NAVER Cloud Platform console.

    Caution
    • In this section, we will briefly introduce how to create a MongoDB Server. For more information about full creation methods, see DB Server.
    • Since an additional subscription step does not exist for Cloud DB for MongoDB, an additional subscription cancellation step also does not exist. If you want to stop using Cloud DB for MongoDB and prevent charges from incurring, then delete the DB Servers you created and were running. For how to delete a MongoDB Server, refer to DB Server.
    1. Access the NAVER Cloud Platform console.
    2. Click VPC from the Platform menu to switch to the VPC environment.
    3. From the console, click the Services > Database > Cloud DB for MongoDB menus in that order.
    4. Click the DB Server menu.
    5. Click the [Create DB Server] button.
    6. Enter the cluster settings information, and then click the [Next] button.
    7. Enter the server settings information, and then click the [Next] button.
    8. Enter the DB settings information, and then click the [Next] button.
    9. Click the [Create] button.

    Set ACG

    The following describes how to set up the Access Control Group (ACG) for a MongoDB Server from the NAVER Cloud Platform console.

    Caution

    In this section, we will briefly introduce how to set up the ACG. See Set firewall (ACG) for more information about setting up the ACG.

    1. Access the NAVER Cloud Platform console.
    2. Click VPC from the Platform menu to switch to the VPC environment.
    3. From the console, click the Services > Database > Cloud DB for MongoDB menus in that order.
    4. Click the ACG menu.
      clouddbformongodb-start-acg_vpc_en
    5. Click and select the ACG to set up, and then click the [Set ACG] button.
      • Select the ACG of the MongoDB server automatically created
    6. Enter the ACG name of the application server in Access source.
    7. Enter the port number in Allowed port.
    8. Click the [Add] button.
    9. Click the [Apply] button.

    Test the MongoDB Server connection

    The following describes how to test if you can connect properly to the created MongoDB Server by installing the MongoDB client.

    1. Check the DB access string, port number, account ID, and password information for the MongoDB Server access.

      • DB access string: check the DB access string at [Manage DB] > Create DB access string.
      • Account ID: check the value that was set up when creating the MongoDB Server.
      • Account password: check the value that was set up when creating the MongoDB Server.
    2. Access the application server

    3. Check the download link below for the shell package that matches the version of MongoDB and the OS.

    4. Download the package from the link in step 3 and unzip it.
      The following example shows downloading MongoDB version 4.2.24's shell in a CentOS 7.8 environment.

      [root@test ~]# wget https://fastdl.mongodb.org/linux/mongodb-shell-linux-x86_64-rhel70-4.2.24.tgz
      --2023-11-07 10:17:58--  https://fastdl.mongodb.org/linux/mongodb-shell-linux-x86_64-rhel70-4.2.24.tgz
      Resolving fastdl.mongodb.org (fastdl.mongodb.org)... 13.225.128.113, 13.225.128.55, 13.225.128.3, ...
      Connecting to fastdl.mongodb.org (fastdl.mongodb.org)|13.225.128.113|:443... connected.
      HTTP request sent, awaiting response... 200 OK
      Length: 17789774 (17M) [application/gzip]
      Saving to: ‘mongodb-shell-linux-x86_64-rhel70-4.2.24.tgz’
      
      100%[======================================>] 17,789,774  8.91MB/s   in 1.9s
      
      2023-11-07 10:18:00 (8.91 MB/s) - ‘mongodb-shell-linux-x86_64-rhel70-4.2.24.tgz’ saved [17789774/17789774]
      
      
      [root@test ~]# tar xvfz mongodb-shell-linux-x86_64-rhel70-4.2.24.tgz
      mongodb-linux-x86_64-rhel70-4.2.24/THIRD-PARTY-NOTICES.gotools
      mongodb-linux-x86_64-rhel70-4.2.24/README
      mongodb-linux-x86_64-rhel70-4.2.24/THIRD-PARTY-NOTICES
      mongodb-linux-x86_64-rhel70-4.2.24/MPL-2
      mongodb-linux-x86_64-rhel70-4.2.24/LICENSE-Community.txt
      mongodb-linux-x86_64-rhel70-4.2.24/bin/mongo
      
    5. Move to the unzipped package directory.

    6. Access the MongoDB by referring to the DB access string identified in step 1.

      [root@test mongodb]# ./bin/mongo mongodb://user:pwd@1ite9.vpc.mg.naverncp.com:17017,1ited.vpc.mg.naverncp.com:17017/admin
       MongoDB shell version v4.2.24
       connecting to: mongodb://1ite9.vpc.mg.naverncp.com:17017,1ited.vpc.mg.naverncp.com:17017/admin?compressors=disabled&gssapiServiceName=mongodb
       Implicit session: session { "id" : UUID("e88ef3bb-b13b-4600-9127-a5a605a15d43") }
       MongoDB server version: 4.2.24
       mongos>
      

    Was this article helpful?

    What's Next
    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.