Hello,
I am very new to mongodb and I want to replicate a primary and one secondary node.
The replSetName is rs0 and if I log into mongodb I see on the primary rs0:OTHER
So I have to change this into rs0:PRIMARY but anything I do went wrong and the state everytime is OTHER.
The machines are running on a rockylinux 8.4
MongoDB Version is 4.0 wiredtiger
>rs0:OTHER> rs.status()
{
"ok" : 0,
"errmsg" : "Our replica set config is invalid or we are not a member of it",
"code" : 93,
"codeName" : "InvalidReplicaSetConfig"
}
The /etc/hosts file looks on any machine like this:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.0.1 rocketchat1.fritz.box rocketchat1
192.168.0.2 rocketchat2.fritz.box rocketchat2
> rs0:OTHER> rs.initiate()
{
"ok" : 0,
"errmsg" : "already initialized",
"code" : 23,
"codeName" : "AlreadyInitialized"
}
Anything I have forgotten? Please tell me and I will write it here