无法通过自托管的Parse连接到mLab数据库 [英] Unable to connect to mLab database from self-hosted Parse

查看:60
本文介绍了无法通过自托管的Parse连接到mLab数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

TL; DR::我可以使我的解析仪表板与本地托管的Parse服务器和mongo db实例进行通信,但无法使解析服务器与与mLab托管的数据库进行通信.

TL;DR: I can get my parse dashboard talking to my locally-hosted Parse server and mongo db instance but cannot get the parse server to talk to the mLab-hosted database.

我正在阅读Parse迁移指南,并在本地运行mongo DB,parse-server-example和parse-dashboard.当我在解析index.js文件中使用以下详细信息时,我可以成功连接仪表板并查看数据库中的测试项目:

I am going through the Parse migration guide and have got mongo DB, parse-server-example and parse-dashboard running locally. When I use the following details in the parse index.js file I can successfully connect the dashboard and see the test items in the database:

databaseURI: 'mongodb://localhost:27017/dev',
cloud: __dirname + '/cloud/main.js',
appId: '1',
masterKey: '1',
serverURL: 'http://localhost:1337/parse'

我已经在本地安装了mongo db,使用外壳连接到我的mLab实例时,我可以看到数据库内容.当我在index.jsdatabaseURI参数中使用相同的mLab连接字符串时,仪表板将无法再查看数据库内容和本地托管的解析服务器上的/test页面.

I have installed mongo db locally and when connecting to my mLab instance with the shell I can see the database content. When I use that same mLab connection string in the databaseURI parameter within index.js the dashboard can no longer see the database content and the /test page on the locally-hosted parse server.

解析迁移指南"指出...

The Parse Migration Guide states...

转到安全性和安全性"控制台中应用程序设置"的键"部分 并记下文件密钥"和主密钥"值.传递给 index.js中的ParseServer构造函数.您不再需要使用 客户端密钥与Parse Server.

Go to the Security & Keys section of App Settings in your Dashboard and take note of the File Key and Master Key values. Pass that into the ParseServer constructor in index.js. You no longer need to use a client key with Parse Server.

我可以找到那些密钥,但是看不到将文件密钥放入index.js的位置.

I can find those keys but I cannot see where to put the File Key into the index.js.

我也不明白,如果本地托管的Parse服务器和mLab数据库一无所知,为什么需要这些密钥.

I also do not understand why those keys are required if the locally-hosted Parse server and mLab database know nothing about them.

推荐答案

步骤:

在mLab/mongo实例中创建您的用户/密码

create your user/pwd in the mLab/mongo instance

从mLab仪表板获取数据库URL

get the db URL from mLab dashboard

使用命令lib客户端连接以验证解析服务器将执行的操作 使用.这将验证您将在下面使用的用户/密码...

connect using a command lib client to verify what parse-server will use. this verifies the user/pwd you will use below...

回到'parse-server.js'对其进行配置,以实现mongo/remote

go back to 'parse-server.js' to config it for mongo/remote

var databaseUri = $what-was-on-cli-client-above

var api = new ParseServer({
  databaseURI: databaseUri || 'mongodb://<db.....

  .... 

这篇关于无法通过自托管的Parse连接到mLab数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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