edit-icon download-icon

How to access to ApsaraDB for MongoDB through the Internet?

Last Updated: Sep 30, 2017

Currently, ApsaraDB for MongoDB is accessible by ECS intranet. If you want to access ApsaraDB for MongoDB through Internet, install rinetd on the ECS Linux server, to implement forwarding.

  1. Install rinetd on the ECS Linux server.

    1. wget http://www.boutell.com/rinetd/http/rinetd.tar.gz&&tar -xvf rinetd.tar.gz&&cd rinetd
    2. sed -i 's/65536/65535/g' rinetd.c (Modify the port range)
    3. mkdir /usr/man&&make&&make install

    Note: The rinetd installation package obtained from the download URL may be unavailable, you can search for the rinetd installation package from other sources and download it for use.

  2. Open the configuration file.

    1. vi /etc/rinetd.conf
  3. Add the following content to the configuration file.

    1. 0.0.0.0 3717 MongoDB connection address 3717
    2. logfile /var/log/rinetd.log
  4. Run the following command to launch rinetd.

    1. rinetd

    Run the following command to launch rinetd.

  5. Perform the verification test.

    Run mongo shell locally to connect to the ECS Linux server to perform logon authentication. For example, if the IP address of the server with rinetd installed is 1.1.1.1, you can run the following command:

    1. mongo --host 1.1.1.1:3717 -u root -p password --authenticationDatabase admin

    After performing the preceding steps, you can use a local PC or server to connect to Port 3717 of the ECS Linux server to access ApsaraDB for MongoDB through the public network.

    Note: You can use the preceding scheme to test and use rinetd. Since rinetd is open source software, if you have any problems in use, read its official documentation or contact rinetd engineers for help.

Thank you! We've received your feedback.