If you use the first procedure, you must configure your applications
to connect to the replica set at both the old and new locations, which
often requires a restart and reconfiguration at the application layer
and which may affect the availability of your applications.
Re-configuring applications is beyond the scope of this document.

Restart each member on a different port and without using the
--replSet run-time option. Changing
the port number during maintenance prevents clients from connecting
to this host while you perform maintenance. Use the member’s usual
--dbpath, which in this
example is /data/db1. Use a command that resembles the following:

mongod --dbpath /data/db1/ --port 37017

For each member of the replica set, perform the following sequence
of operations:

Open a mongo shell connected to the mongod
running on the new, temporary port. For example, for a member
running on a temporary port of 37017, you would issue this
command:

mongo --port 37017

Edit the replica set configuration manually. The replica set
configuration is the only document in the system.replset
collection in the local database. Edit the replica set
configuration with the new hostnames and correct ports for all
the members of the replica set. Consider the following sequence of
commands to change the hostnames in a three-member set: