0
我想在我自己的機器上與mongo數據庫在同一臺機器上設置一個解析服務器。按照這個教程,https://medium.com/@dmathewwws/guide-to-building-your-own-parse-server-aad6568b743d解析mongo數據庫無法連接到服務器
但我有一些問題,解析抱怨不能連接到我的數據庫。
2017-07-22T17:41:39.888Z - Error generating response. { MongoError: failed to connect to server [localhost:27017] on first connect
at Pool.<anonymous> (/parse/node_modules/mongodb-core/lib/topologies/server.js:313:35)
at emitOne (events.js:115:13)
at Pool.emit (events.js:210:7)
at Connection.<anonymous> (/parse/node_modules/mongodb-core/lib/connection/pool.js:260:12)
at Object.onceWrapper (events.js:318:30)
at emitTwo (events.js:125:13)
at Connection.emit (events.js:213:7)
at Socket.<anonymous> (/parse/node_modules/mongodb-core/lib/connection/connection.js:162:49)
at Object.onceWrapper (events.js:316:30)
at emitOne (events.js:115:13)
name: 'MongoError',
message: 'failed to connect to server [localhost:27017] on first connect' }
蒙戈DB似乎對27017
Proto Recv-Q Send-Q Local Address Foreign Address State User Inode PID/Program name
tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN 112 24024 3200/mongod
運行,我還可以通過命令行太連接,
mongo mongodb://username:[email protected]:27017/myDB
MongoDB shell version: 3.2.15
connecting to: mongodb://username:[email protected]:27017/myDB
> show collections
test
>
這裏是我的船塢文件設置。
environment:
...
DATABASE_URI: mongodb://username:[email protected]:27017/myDB
mongo:
image: mongo:3.2.15
expose:
- "27017"
volumes:
- /mnt/database/mongodb
mongodb實際上坐在另一個卷中,具有此權限。
[email protected]:/mnt/database# ls -lh
total 20K
drwx------ 2 root root 16K Jul 20 02:34 lost+found
drwxr-xr-x 4 mongodb mongodb 4.0K Jul 22 17:10 mongodb
在此先感謝!
注:請勿張貼#2 –
感謝您的應用程序鍵,關鍵是從教程 – Wesley
我複製/粘貼看到。 Github上還有高級用法。 https://github.com/yongjhih/docker-parse-server/blob/master/ADVANCE.md –