I would like to duplicate port 127.0.0.1:27017 to 127.0.0.1:27018.
My initial attempts were using ip tables:
iptables -t nat -I PREROUTING -p tcp --dport 27018 -j REDIRECT --to-port 27017
(And variations of this idea). But this did not work.
mongo --host 127.0.0.1 --port 27018 MongoDB shell version: 2.6.10 connecting to: 127.0.0.1:27018/test 2019-01-12T04:04:12.403+0000 warning: Failed to connect to 127.0.0.1:27018, reason: errno:111 Connection refused 2019-01-12T04:04:12.404+0000 Error: couldn't connect to server 127.0.0.1:27018 (127.0.0.1), connection attempt failed at src/mongo/shell/mongo.js:148 exception: connect failed
What is the correct way of allowing one mongo instance to be accessible via 27017 and 27018.