Wednesday, April 6, 2016

Problems on migrating Parse.com app to AWS EC2 Ubuntu

Leave a Comment

I have an EC2 machine with Ubuntu installed on it. On the machine, I have installed Node.js, MongoDB, and Github version of Parse Server.

I have created a database called 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.

In the Parse.com settings, I've clicked at the Migrate button, and entered this address:

mongodb://username:password@<ipaddress>:27017/euro 

and below the address field, it was written No reachable servers.

What can I do in order to solve it and to migrate the app to my EC2 Instance?

EDIT #1:
I have restarted my AWS server, so my Public IP address has been changed. I've tried to change my connection string to the new IP using this address:

mongodb://username:password@<ipaddress>:27017/euro 

But suddenly it shows No reachable servers.
What should I do in order to solve this problem? I want to migrate it as soon as possible.

EDIT #2:
I've checked this command sudo netstat -pan | grep mongod to check on which IP it is listening and I got this output:

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? localhost?

1 Answers

Answers 1

I solved it using MongoDB guide and this answer.

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.

$ 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. I was supposed to use this command $ sudo service mongod restart.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment