Hi fellows.
I am able to connect a non-dockerized replica set using uri = "mongodb://<host-ip-address>:27017/?replicaSet=rs0"
.
For this case I use a mongo.conf file that has:
net:
port: 27017
bindIp: 127.0.0.1,<host-ip-address>
replication:
replSetName: "rs0"
Then, starting the replica from mongosh with rs.initiante()
I get:
{
info2: 'no configuration specified. Using a default configuration for the set',
me: '10.18.3.101:27017',
ok: 1,
'$clusterTime': {
clusterTime: Timestamp({ t: 1735656335, i: 1 }),
signature: {
hash: Binary.createFromBase64('AAAAAAAAAAAAAAAAAAAAAAAAAAA=', 0),
keyId: Long('0')
}
},
operationTime: Timestamp({ t: 1735656335, i: 1 })
}
Now, with de dockerized version I am trying this docker run code to get the same simple replica set configuration runing:
docker run --name mongodb -d -p 27017:27017 mongo --replSet "rs0" --bind_ip_all
Then, starting the replica from mongosh with docker exec -it mongodb mongosh --eval "rs.initiate()"
I get:
{
info2: 'no configuration specified. Using a default configuration for the set',
me: '662dbb861df2:27017',
ok: 1,
'$clusterTime': {
clusterTime: Timestamp({ t: 1735657007, i: 1 }),
signature: {
hash: Binary.createFromBase64('AAAAAAAAAAAAAAAAAAAAAAAAAAA=', 0),
keyId: Long('0')
}
},
operationTime: Timestamp({ t: 1735657007, i: 1 })
}
So I am not able to conect with that uri anymore.
I appreciate any help in advance!
=)
Federico