Hello to all friends.
I have been running mongodb on my server for some time.
But I can not enable its security. As a result, my database was hacked and all my information was lost.
But my problem is that my meteor software does not run without replication, in this case, without replication, I can enable security and access the database by creating a user. But when the meteor software can not connect to the database, while I am sure I entered the username and password correctly.
I get this error:
Error: $MONGO_OPLOG_URL must be set to the 'local' database of a Mongo replica set
Here are my settings:
{
"apps": [
{
"name": "ghadr",
"cwd": "/home/Ghadr/Ghadr",
"script": "main.js",
"instances":1,
"env": {
"NODE_ENV": "staging",
"WORKER_ID": "0",
"PORT": "3000",
"ROOT_URL": "http://ghadr.org",
"MONGO_URL": "mongodb://username:password@127.0.0.1:27017/meteor?authSource=admin",
"MONGO_OPLOG_URL": "mongodb://username:password@127.0.0.1:27017/local?authSource=admin",
"HTTP_FORWARDED_COUNT": "1",
}
}
]
}
I also created the database user with the following command :
use admin
db.createUser(
{
user: "username",
pwd: "password",
roles: [
{ role: "userAdminAnyDatabase", db: "admin" },
{ role: 'readWrite', db:'meteor'},
{ role: 'readWrite', db:'local'},
"readWriteAnyDatabase" ,"dbAdminAnyDatabase"
]
}
)
In short, with what I said, the meteor does not connect to the database. I even deleted “MONGO_OPLOG_URL” but still got the same error, if I thought the definition of this variable was not mandatory.