Closed SumNeuron closed 5 years ago
No idea about this shards thing. Maybe you can try MongoDB Atlas instead as they acquired Mlab anyway https://cloud.mongodb.com/.
@JarnoRFB I click that link and I am directed to the same place / project instance.
Then I click connect and get:
Copy the URI connection string:
mongodb://<USER>:<PASSWORD>@<host-shard-0>:<port>,<host-shard-1>:<port>/test? ssl=true&replicaSet=<host-shard-0>&authSource=admin&retryWrites=true
or
mongodb+srv://<user>:<PASSWORD>@<host>/test?retryWrites=true
Have you tried: ex.observers.append(MongoObserver.create(url=mongourl, db_name='test')) You have to set the db_name in MongoObserver.create too, i guess. Works for me.
@Mastercorp
I've added db_name
, I still get timeout
db_name = '<DB_NAME>'
mongourl = 'mongodb://{user}:{password}@{server_specs}/{db}{extra}'.format(
user = "<USER>",
password = urllib.parse.quote('<PASSWORD>'),
server_specs= (
'<HOST-SHARD-0>:<PORT>,'
'<HOST-SHARD-1>:<PORT>,'
'<HOST-SHARD-2>:<PORT>'
),
db=db_name,
extra = '?ssl=true&replicaSet=<HOST-SHARD-0>&authSource=admin&retryWrites=true'
)
mo = MongoObserver.create(
url=mongourl,
ssl=True,
db_name=db_name,
# replicaSet=<HOST-SHARD-0>,
# authSource='admin',
# retryWrites=True
)
ex.observers.append(mo)
@SumNeuron Maybe its a problem with your region? What region did you choose for your Cloud Provider? I am running on aws with Frankfurt ( eu-central-1, Free Tier ) Cluster Tier M0.
my setup looks like this: ( i named the db and HOST the same. )
mongourl = ("mongodb://USER:PASSWORD@sacred-shard-00-00-3fwam.mongodb.net:27017,"
"sacred-shard-00-01-3fwam.mongodb.net:27017,sacred-shard-00-02-3fwam.mongodb.net:27017/sacred"
"?ssl=true&replicaSet=sacred-shard-0&authSource=admin&retryWrites=true")
ex.observers.append(MongoObserver.create(url=mongourl,
db_name='sacred'))
I am running google Belgium also free
@SumNeuron
must be a problem with mlab. Your code works on my setup without any problems. Mabye try to change to AWS and Frankfurt.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I am trying to use MLab as a cloud solution for
MongoObserver
.I created a free account and named my project
sacred
I am now trying to add my MongoObserve but it always gives me a timeout.
From MLab:
so I have this:
but I always get timeout...