edit-icon download-icon

ECS Linux

Last Updated: Jan 17, 2018

Currently, ApsaraDB for MongoDB is only accessible through ECS intranet. If you must locally access ApsaraDB for MongoDB by the public network, you can install rinetd on the ECS Linux server for port forwarding.

Procedure

  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
  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 start rinetd.

    1. rinetd


    Note: Run echo rinetd >>/etc/rc.local to enable auto-launch, or run pkill rinetd to kill the process.

  5. Perform a verification test.

    Run the mongo shell command locally to connect to the ECS Linux server and verify using 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 you complete the preceding steps, 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. As rinetd is open source software, if you have any issues, see the rinetd documentation or consult with rinetd engineers.

Thank you! We've received your feedback.