Replica Set Erro código 76. O que eu faço?

6 views
Skip to first unread message

Carlos Herriot

unread,
May 14, 2019, 11:11:28 AM5/14/19
to MongoDB Brasil
Tentei criar da seguinte forma:
1) Criei os 3 diretórios em que cada réplica iria ficar:
C:>C:\temp\replSet_0 
C:>C:\temp\replSet_1 
C:>C:\temp\replSet_2

2) Fiz o mongod apontar para cada um deles:
c:\Program Files\MongoDB\Server\4.0\bin> mongod --replSet myReplSet --logpath c:\temp\replSet_0\rs_0.log --dbpath c:\temp\replSet_0\ --port 27017 –smallfiles 
c:\Program Files\MongoDB\Server\4.0\bin> mongod --replSet myReplSet --logpath c:\temp\replSet_1\rs_0.log --dbpath c:\temp\replSet_0\ --port 27018 –smallfiles 
c:\Program Files\MongoDB\Server\4.0\bin> mongod --replSet myReplSet --logpath c:\temp\replSet_2\rs_0.log --dbpath c:\temp\replSet_0\ --port 27019 –smallfiles 

3) Configurei o replica set
c:\Program Files\MongoDB\Server\4.0\bin>mongo --port 27017
config = {_id: "myReplSet", members:[{_id:0, host:"localhost:27017"},{_id:1, host:"localhost:27018"},{_id:0, host:"localhost:27019"}]};

Ele retornou isso aqui (acredito q tenha ido tudo bem tmb):
{
        "_id" : "myReplSet",
        "members" : [
                {
                        "_id" : 0,
                        "host" : "localhost:27017"
                },
                {
                        "_id" : 1,
                        "host" : "localhost:27018"
                },
                {
                        "_id" : 0,
                        "host" : "localhost:27019"
                }
        ]
}

4) Inicializei, e foi onde apareceu o erro:
rs.initiate(config)
Ele retornou o erro:
{
        "ok" : 0,
        "errmsg" : "This node was not started with the replSet option",
        "code" : 76,
        "codeName" : "NoReplicationEnabled"
}
E eu não sei o que fazer. Alguém me ajuda?
ReplicaçãoErro02.png
Reply all
Reply to author
Forward
0 new messages