If I understand the question correctly, you are changing the name to IP address mapping while the MongoDB process is running, and the replica set behaves strangely. Is this correct?
If yes, then unfortunately there’s not much the server can do to fix itself since the situation is not under its control. A replica set node tries to connect to other nodes in the replica set, but if it asks the OS for the address for a certain node, but the address given to it is wrong, there is nothing it can do about it.
I would recommend to shutdown MongoDB while these IP remapping are being done, and restart them once all the correct IP mappings are in place. Having a set of very confused replica set is generally not a good thing, especially if you’re doing writes while this is going on.
Mongodb Version 2.4.6 was running on centos 7
Please note that version 2.4.6 is seriously outdated now. The 2.4 series was released in March 2013 (7 years ago) and was out of support in March 2016 (4 years ago). Please consider using a supported version (see Support Policy for a list of supported versions).
Best regards,
Kevin