I have a small Percona MongoDB database running on AWS. I have stopped that instance, attached a VM to the volume of that instance and copied all the files of database. Then, I added all these files to Azure and created another Percona MongoDB instance. It starts successfully, however, after some time (~3mins) it shuts down.
Looking into the Operator logs, I can see this:
2024-10-04T14:15:08.425Z INFO initiating replset {"controller": "psmdb-controller", "object": {"name":"perconamongodbcluster","namespace":"mongodb-test"}, "namespace": "mongodb-test", "name": "perconamongodbcluster", "reconcileID": "f9172ffe-ec97-459e-9a38-79313941a919", "replset": "rs0", "pod": "perconamongodbcluster-rs0-0"}
2024-10-04T14:15:20.963Z ERROR failed to reconcile cluster {"controller": "psmdb-controller", "object": {"name":"perconamongodbcluster","namespace":"mongodb-test"}, "namespace": "mongodb-test", "name": "perconamongodbcluster", "reconcileID": "f9172ffe-ec97-459e-9a38-79313941a919", "replset": "rs0", "error": "handleReplsetInit: exec add admin user: command terminated with exit code 1 / Current Mongosh Log ID:\t66fff876b571db865b127c2b\nConnecting to:\t\tmongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&tls=true&tlsCertificateKeyFile=%2Ftmp%2Ftls.pem&tlsAllowInvalidCertificates=true&tlsCAFile=%2Fetc%2Fmongodb-ssl%2Fca.crt&appName=mongosh+2.1.5\nUsing MongoDB:\t\t7.0.8-5\nUsing Mongosh:\t\t2.1.5\nmongosh 2.3.1 is available for download: https://www.mongodb.com/try/download/shell\n\nFor mongosh info see: https://docs.mongodb.com/mongodb-shell/\n\n / MongoServerError: Command createUser requires authentication\n",
So it seems that Authentication is missing and the Operator is not able to start the replicaset. When I look at the logs of Pod, I see strange things as well:
{"t":{"$date":"2024-10-04T14:21:38.859+00:00"},"s":"W", "c":"REPL", "id":21405, "ctx":"ReplCoord-0","msg":"Locally stored replica set configuration does not have a valid entry for the current node; waiting for reconfig or remote heartbeat","attr":{"error":{"code":74,"codeName":"NodeNotFound","errmsg":"No host described in new configuration with {version: 44, term: 13} for replica set rs0 maps to this node"},"localConfig":{"_id":"rs0","version":44,"term":13,"members":[{"_id":0,"host":"perconamongodbcluster-rs0-0.perconamongodbcluster-rs0.perconamongodb.svc.cluster.local:27017","arbiterOnly":false,"buildIndexes":true,"hidden":false,"priority":2,"tags":{"podName":"perconamongodbcluster-rs0-0","serviceName":"perconamongodbcluster","nodeName":"ip-10-20-23-65.eu-central-1.compute.internal"},"secondaryDelaySecs":0,"votes":1}],"protocolVersion":1,"writeConcernMajorityJournalDefault":true,"settings":{"chainingAllowed":true,"heartbeatIntervalMillis":2000,"heartbeatTimeoutSecs":10,"electionTimeoutMillis":10000,"catchUpTimeoutMillis":-1,"catchUpTakeoverDelayMillis":30000,"getLastErrorModes":{},"getLastErrorDefaults":{"w":1,"wtimeout":0},"replicaSetId":{"$oid":"66df0cb532b0d77ab0ea8b13"}}}}}
Locally stored replica set configuration does not have a valid entry for the current node - it seems that the configuration of Replica set is not correct.
The question is - how can I reset the configuration completely and let the mongodb reconfigure itself? I have been trying to do that as databaseAdmin user, however, no success. I have been trying to drop local
database - can’t find user who has sufficient rights to do so. What options do I have?