Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.2k views
in Technique[技术] by (71.8m points)

mongodb - Accessing meteor production database in 2016

It seems the answer in this thread (Accessing Meteor production database) does not work anymore when you want to access a meteor production database in 2016. I want to access a meteor production database blah.meteor.com using

meteor mongo blah.meteor.com

instead what I get is:

connecting to: sg-mother1-6243.servers.mongodirector.com:27017/blah_meteor_com 2016-01-18T15:21:49.884+0200 Error: 18 { ok: 0.0, errmsg: "auth failed", code: 18 } at src/mongo/shell/db.js:1210 exception: login failed

Then I tried

meteor mongo --url blah.meteor.com

I get username cursor. I enter my meteor site username and press enter and then get password cursor. I enter password for the above username and press enter. I get presented with the following url:

mongodb://client-2ee8c14d:c1546ca8-4e7e-5883-0214-150b309fb4fb@SG-mother1-6242.servers.mongodirector.com:27017/blah_meteor_com

Then every time I re-enter

meteor mongo --url blah.meteor.com

I am assumed to have logged on already, and I just get presented with a similar url to the one I was presented with just above. I read the "meteor mongo command" documentation by entering:

meteor mongo --help

In the documentation I read the following line:

Instead of opening a shell, specifying --url (-U) will return a URL suitable for an external program to connect to the database. For remote databases on deployed applications, the URL is valid for one minute.

For the meaning, I went back to the thread (stackoverflow.com/questions/11801278/accessing-meteor-production-database) I mentioned in the beggining and read:

"So what it's saying is, the url provided by running the command with the --url option is for connecting to the database by some external application, i.e. other than meteor."

I don't know what other application can help me connect to meteor production database other than what I used to do in 2015, which is:

meteor mongo blah.meteor.com

I read somewhere that I can use the mongo shell intead but I don't know how to open it and I don't know the mongo installation directory when it is installed with meteor. I am using linux (fedora) OS.

How do I access meteor production database in 2016? Are there upgrades that happened that make me not to be able to access meteor production database as easily as I did in 2015?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You are trying to connect to a database version 3.0 while your meteor mongo command still use the version 2.6.7 of mongo

Try this workaround :

  • Install Mongo version (3.x) directly on your machine.
  • Then run this command (should work on osx, linux and windows when sed is installed):

    mongo `meteor mongo --url XXX.meteor.com | sed 's/mongodb:///-u /' | sed 's/:/ -p /' | sed 's/@/ /'`

Source: https://forums.meteor.com/t/meteor-mongo-xxx-meteor-com-giving-exception-login-failed-workaround/15289


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...