Hi,
I want to take first backup of mongodb data then i will restore the same data
i have another database name which is having 2gb size i will take backup and restore of this data but unable to do if because below error im getting
i have deploy mongodb 3 pods of using this operator mongodb-kubernetes-operator
kubectl get po
NAME READY STATUS RESTARTS AGE
mongodb-kubernetes-operator-558d9545b8-zjm4c 1/1 Running 0 2d22h
mongodb-0 2/2 Running 0 87m
mongodb-1 2/2 Running 0 85m
mongodb-2 2/2 Running 0 88m
when i type this command it return this connection string along with srv
kubectl get secret mongodb-admin-new-user -o json | jq -r '.data | with_entries(.value |= @base64d)'
{
"connectionString.standard": "mongodb://new-user:xxxxx@mongodb-0.mongodb-svc.default.svc.cluster.local:27017,mongodb-1.mongodb-svc.default.svc.cluster.local:27017,mongodb-2.mongodb-svc.default.svc.cluster.local:27017/admin?replicaSet=mongodb&ssl=false",
"connectionString.standardSrv": "mongodb+srv://new-user:xxxxxxxx@mongodb-svc.default.svc.cluster.local/admin?replicaSet=mongodb&ssl=false",
"password": "xxxxxxxx",
"username": "new-user"
after that i run this command
mongodump --uri="mongodb://new-users:xxxxx@mongodb-0.mongodb-svc.default.svc.cluster.local:27017,mongodb-1.mongodb-svc.default.svc.cluster.local:27017,mongodb-2.mongodb-svc.default.svc.cluster.local:27017/admin?replicaSet=mongodb&ssl=false"
after executing above command i got below error
Failed: can't create session: failed to connect to mongodb://new-users:xxxxxx@-mongodb-0.mongodb-svc.default.svc.cluster.local:27017,mongodb-1.mongodb-svc.default.svc.cluster.local:27017,mongodb-2.mongodb-svc.default.svc.cluster.local:27017/admin?replicaSet=mongodb&ssl=false: server selection error: server selection timeout, current topology: { Type: ReplicaSetNoPrimary, Servers: [{ Addr: mongodb-0.mongodb-svc.default.svc.cluster.local:27017, Type: Unknown, Last error: dial tcp: lookup mongodb-0.mongodb-svc.default.svc.cluster.local: Temporary failure in name resolution }, { Addr: mongodb-1.mongodb-svc.default.svc.cluster.local:27017, Type: Unknown, Last error: dial tcp: lookup mongodb-1.mongodb-svc.default.svc.cluster.local: Temporary failure in name resolution }, { Addr: mongodb-2.mongodb-svc.default.svc.cluster.local:27017, Type: Unknown, Last error: dial tcp: lookup mongodb-2.mongodb-svc.default.svc.cluster.local: Temporary failure in name resolution }, ] }
even if i run this command also i get same error
mongodump --uri="mongodb://new-users:xxxxxx@mongodb-0.mongodb-svc.default.svc.cluster.local:27017,mongodb-1.mongodb-svc.default.svc.cluster.local:27017,mongodb-2.mongodb-svc.default.svc.cluster.local
and using with srv
mongodump --uri="mongodb+srv://new-user:xxxxxx@mongodb-svc.default.svc.cluster.local/admin?replicaSet=mongodb&ssl=false"
2025-01-03T17:14:00.597+0530 error parsing command line options: error parsing uri: lookup _mongodb._tcp.mongodb-svc.default.svc.cluster.local on 127.0.0.53:53: server misbehaving
```
with srv i get this error
```
error parsing command line options: error parsing uri: lookup _mongodb._tcp.mongodb-svc.default.svc.cluster.local on 127.0.0.53:53: server misbehaving
mongodump --version
mongodump version: 100.10.0
git version: 6d4f001be3fcfxxxxxxxxee02ef233a9
Go version: go1.21.12
os: linux
arch: amd64
compiler: gc
Last is that im also looking for automatic daily or weekly or month backup so that i dont have to take backup manually any helpfull on this will be great