[英]Problems on migrating Parse.com app to AWS EC2 Ubuntu
I have an EC2 machine with Ubuntu installed on it. 我有一台安装了Ubuntu的EC2机器。 On the machine, I have installed Node.js, MongoDB, and Github version of Parse Server.
在机器上,我安装了Node.js,MongoDB和Github版本的Parse Server。
I have created a database called euro. 我创建了一个名为euro的数据库。 In this database, I've created a user using this code:
在这个数据库中,我使用以下代码创建了一个用户:
> use euro
switched to db euro
> db.createUser(
... {
... user: 'username',
... pwd: 'password',
... roles: [ { role: 'readWrite', db:'euro' } ]
... }
... )
Before migrating the app, I have noticed that in AWS EC2 Instances Managment page, you can see 2 IPs addresses: Public IP and a Private IP, so I used the Public IP. 在迁移应用程序之前,我注意到在AWS EC2 Instances Managment页面中,您可以看到2个IP地址:公共IP和私有IP,因此我使用了公共IP。
In the Parse.com settings, I've clicked at the Migrate button, and entered this address: 在Parse.com设置中,我点击了Migrate按钮,并输入了以下地址:
mongodb://username:password@<ipaddress>:27017/euro
and below the address field, it was written No reachable servers
. 在地址字段下面,写了
No reachable servers
。
What can I do in order to solve it and to migrate the app to my EC2 Instance? 我该怎么做才能解决它并将应用程序迁移到我的EC2实例?
EDIT #1: 编辑#1:
I have restarted my AWS server, so my Public IP address has been changed. 我已重新启动我的AWS服务器,因此我的公共IP地址已更改。 I've tried to change my connection string to the new IP using this address:
我试图使用以下地址将我的连接字符串更改为新IP:
mongodb://username:password@<ipaddress>:27017/euro
But suddenly it shows No reachable servers
. 但突然间它显示
No reachable servers
。
What should I do in order to solve this problem? 我该怎么做才能解决这个问题? I want to migrate it as soon as possible.
我想尽快迁移它。
EDIT #2: 编辑#2:
I've checked this command sudo netstat -pan | grep mongod
我检查了这个命令
sudo netstat -pan | grep mongod
sudo netstat -pan | grep mongod
to check on which IP it is listening and I got this output: sudo netstat -pan | grep mongod
检查它正在监听哪个IP,我得到了这个输出:
tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN 10945/mongod
tcp 0 0 127.0.0.1:27017 127.0.0.1:45406 ESTABLISHED 10945/mongod
unix 2 [ ACC ] STREAM LISTENING 28614 10945/mongod /tmp/mongodb-2
Is it listening on the Public IP? 是在听公共知识产权吗? Private IP?
私人IP? localhost?
本地主机?
I solved it using MongoDB guide and this answer. 我使用MongoDB 指南和这个答案解决了它。
The problem was some warnings that I got when I've started the server. 问题是我启动服务器时收到的一些警告。 Apperently It had prevented Parse.com from connecting to my MongoDB.
显然它阻止了Parse.com连接到我的MongoDB。
$ mongo
MongoDB shell version: 3.0.11
connecting to: test
Server has startup warnings:
2016-04-01T07:28:10.926+0000 I CONTROL [initandlisten]
2016-04-01T07:28:10.926+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2016-04-01T07:28:10.926+0000 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2016-04-01T07:28:10.926+0000 I CONTROL [initandlisten]
2016-04-01T07:28:10.926+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2016-04-01T07:28:10.926+0000 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2016-04-01T07:28:10.926+0000 I CONTROL [initandlisten]
>
I wasn't able to solve it because I used this command $ service mongod restart
without root permission. 我无法解决它因为我在没有root权限的情况下使用了这个命令
$ service mongod restart
。 I was supposed to use this command $ sudo service mongod restart
. 我应该使用这个命令
$ sudo service mongod restart
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.