Currently, ApsaraDB for MongoDB is only accessible through ECS intranet. If you want to locally access ApsaraDB for MongoDB by the public network, you can install rinetd on the ECS Linux server for port forwarding.
Install rinetd on the ECS Linux server.
wget http://www.boutell.com/rinetd/http/rinetd.tar.gz&&tar -xvf rinetd.tar.gz&&cd rinetd
sed -i 's/65536/65535/g' rinetd.c (Modify the port range)
mkdir /usr/man&&make&&make install
Open the configuration file.
Add the following content to the configuration file.
0.0.0.0 3717 MongoDB connection address 3717
Run the following command to start rinetd.
echo rinetd >>/etc/rc.localto enable auto-launch, or run
pkill rinetdto kill the process.
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 184.108.40.206, you can run the following command.
mongo --host 220.127.116.11: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 an open source software, if you have any issues, see the rinetd documentation or consult with rinetd engineers.