Whether the mongodb replication set can be taken from the disk and taken out separately to make a new mongodb server.

I tried to do this, but could not copy set initialization.

Feb.28,2021

Yes, the operation goes like this:

  1. do not add -- replSet parameter to start the instance;
  2. Delete local database:
    use local;
    db.dropDatabase ();
  3. add -- replSet restart;
  4. reinitialize a new replication set;
The principle of

is simple: the copied node is already a member of a replication set, and of course you are not allowed to reinitialize it. However, this information is stored in some collections of the local library (if you are interested, you can see which collections are available). So if you delete these collections, the system will think that this is a replication set that has not been initialized. Then you can initialize it.
it is possible to change the contents of the tables inside without actually deleting the local library. But it may be more complicated. If you are interested, you can explore for yourself.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e98158-16a6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e98158-16a6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?