Sample Header Ad - 728x90

Can't migrate standalone MongoDB to Cluster

0 votes
1 answer
381 views
I'm trying to convert a standalone MongoDB database into a cluster in order to migrate my database to MongoDB Atlas. I've followed the following steps to try and convert it: 1. Stop my mongodb instance 2. Changed the configuration to the following content:
........................

#how the process runs

processManagement:   
     timeZoneInfo: /usr/share/zoneinfo

security:
   authorization: enabled

replication:  
  replSetName: "rs0"
3. Restarted mongodb with the following command: sudo mongod --config /etc/mongod.conf --fork 4. Logged into mongodb, to the admin database, with a user who has the following roles: clusterMonitor, readAnyDatabase, userAdminAnyDatabase 5. Executed the command rs.initiate() And it gave me the following error:
{
        “ok” : 0,
        “errmsg” : “not authorized on admin to execute command { replSetInitiate: undefined, $db: \“admin\” }“,
        “code” : 13,
        “codeName” : “Unauthorized”
}
I have tried the previous steps in a dev server, and everything worked fine, bun in my production environment it didn't work, any help is appreciated.
Asked by Victor Castillo Torres (271 rep)
Nov 22, 2019, 09:04 PM
Last activity: Nov 22, 2019, 09:53 PM