2016年接入流星生产数据库 [英] Accessing meteor production database in 2016

查看:17
本文介绍了2016年接入流星生产数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎此线程中的答案(访问 Meteor 生产数据库)不再起作用当你想在 2016 年访问流星生产数据库时.我想使用

访问流星生产数据库 blah.meteor.com<块引用>

流星蒙戈 blah.meteor.com

相反,我得到的是:

<块引用>

连接到:sg-mother1-6243.servers.mongodirector.com:27017/blah_meteor_com2016-01-18T15:21:49.884+0200 错误: 18 { ok: 0.0, errmsg: "auth failed", code: 18 } at src/mongo/shell/db.js:1210异常:登录失败

然后我尝试了

<块引用>

meteor mongo --url blah.meteor.com

我得到用户名光标.我输入我的流星站点用户名并按回车键,然后获取密码光标.我输入上述用户名的密码并按回车键.我得到以下网址:

<块引用>

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

然后每次我重新进入

meteor mongo --url blah.meteor.com

假设我已经登录,但我看到的网址与上面显示的网址相似.我通过输入以下内容阅读了meteor mongo 命令"文档:

<块引用>

流星蒙戈 --help

在文档中,我阅读了以下行:

<块引用>

指定--url (-U) 将返回一个 URL,而不是打开一个 shell适用于外部程序连接数据库.对于远程已部署应用程序上的数据库,URL 的有效期为一分钟.

对于意义,我回到了我在beggining中提到的线程(stackoverflow.com/questions/11801278/accessing-meteor-production-database)并阅读:

<块引用>

所以它的意思是,通过运行带有 --url 选项的命令提供的 url 用于通过某些外部应用程序连接到数据库,即不是流星."

除了我在 2015 年曾经做过的,我不知道还有什么应用程序可以帮助我连接到流星生产数据库,即:

<块引用>

流星蒙戈 blah.meteor.com

我在某处读到我可以使用 mongo shell intead,但我不知道如何打开它,而且我不知道当它与meteor 一起安装时的 mongo 安装目录.我使用的是 linux (fedora) 操作系统.

2016年如何访问流星生产数据库?有没有发生过升级导致我无法像 2015 年那样轻松访问流星生产数据库的情况?

解决方案

您正在尝试连接到 3.0 版的数据库,而您的 meteor mongo 命令仍在使用 2.6.7 版的 mongo>

试试这个解决方法:

  • 直接在您的机器上安装 Mongo 版本 (3.x).
  • 然后运行这个命令(安装 sed 时应该可以在 osx、linux 和 windows 上工作):

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

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

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?

解决方案

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

这篇关于2016年接入流星生产数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆