When I am connecting my replica set from local machine like this
\"mongodb://my_server_ip:27018/?readPreference=secondary&replicaSet=rs0&appname=Mon
Replica set must be configured with host addresses that are accessible from both RS nodes and the clients.
For an RS used over the network, this means public hostnames/IP addresses of the host nodes rather than loopback addresses.