Mongoerror: failed to connect to server localhost:27017 on first connect - node.js

I have created an application using MEAN, After that, I have created the ec2 Linux instance, where I am running this application.I have installed all the dependencies.
Added port 27017 on security group page.
running the command on the ec2 instance as node server.js
Node: My mongo DB is outside my cloud instance i.e on my laptop.
How can I fix this error?

You need to open your laptop to internet which is almost impossible (and you shouldn't). That means you need a MongoDB server which is accessible by your EC2 Linux instance.
You may use a free mongodb hosting such as mlab
On the other hand you can enable another EC2 instance and setup your own mongodb. Beware that you may need to setup firewall if it's not an internal network.

Related

Dockerizing Express-MongoDB Atlas (docker-compose)

My apologies if this is a noob question but, is it possible to configure a docker-compose file to get an already-existing Mongo Atlas database working as part of a docker network?
I have searched in internet but everyone is using new local mongodb connections or new mongodb Atlas ones.
(I have an express node forum running and its hosted on Atlas cloud db)
First of all you need to understand that MongoDB Atlas is a Cloud platform for MongoDB, so the database lives somewhere in the cloud, e.g. AWS.
While Docker network is a local network that Docker creates for you to encapsulate different containers into one net, thus making it possible to communicate between each other, and by the same token be isolated from world.
The answer is that you cannot make MongoDB Atlas part of your Docker network, because Atlas is not a Container that you could embed into your network. But the good news that you don't need to, because you can connect to the Atlas instance anyways from any computer, in condition that configuration of your Atlas allows to establish connections.

Tunnel between local linux machine( behind NAT) to aws instance(linux)

Is there any utility through which i can create a tunnel between local linux machine and aws instance..
I used this http://www.rkeene.org/projects/info/wiki/142
Its good, but multiple connections don't work properly.
Please suggest me other possibilities
The simplest way I see it's establishing a VPN connection between your external machine and your AWS VPC. You could just have an EC2 instance running OpenVPN facing internet on AWS, and set a client on the other end. You could even use Amazon VPN, but it implements IPSEC, which could be a little more tricky to connect from you Linux box. Another advantage of OpenVPN is that you can have as many clients as you want coming from anywhere.

Unable to access couchbase web console for AWS EC2 RHEL server

I have just installed couchbase 3.0.1 on Amazon Web Services EC2 free RHEL instance (3.10.0-123.8.1.el7.x86_64). The installation was successful and I the couchbase is running on this server.
To access couchbase web console from web browser I need to to use the syntaax http://:8091
unfortunately this is not working. I tried using Public DNS and Public IP both.
For example:
On Google Chrome browser --> http://ec2-54-69-221-173.us-west-2.compute.amazonaws.com:8091
I have also installed the couchbase outside the AWS on VMPlayer. That works fine.
Please let me know is there any additional step I need to take care in case of AWS instance?
Thanks in advance.
I would start troubleshooting this in two ways:
1) Confirm there a couchbase process running on port 8091 on that node using netstat.
2) Make sure you have your security groups for this node set up to allow access to port 8091. If not, add a rule to the security group.
If I had to guess, it is going to be #2 though.

Virtual machine in Azure not quite the same as a real machine

Hope somebody could give me a hint?
When trying to use an Azure virtual machine to host a database I have problems with the hostname:port way to access the virtual machine instead of just hostname.
For example, I got a preview scadcam.cloudapp.net:51165 virtual machine. When I try to access the database hosted in there, my application thinks I´m trying to comunicate with the database thru this port.
Is there a way to define a url that does not show the port? Something like scadcam.cloudapp.net/51165 ?
I´m sure there are a lot of applications that may have this type of problem, so I suppose there is a way to do it?
Reagards
So you want to host a database in a Virtual Machine, so I'm assuming you're trying to host an instance of SQL Server. If you want to connect to the hostname without having to specify the port you should start by doing the following:
Create an unnamed instance in your SQL Server installation
Add an endpoint for port 1433 to your virtual machine (see this link)
Also, if you're using .NET to connect to that database it's pretty easy to specify the port if you don't use port 1433:
Data Source=myserver.cloudapp.net,4999;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;
In your question I also see that you're talking about scadcam.cloudapp.net:51165. Note that 51165 is probably the random port that is used for remote desktop, and you can't use that same port to connect to your database.

Keeping Elastic Search alive on Amazon EC2 Linux Instance

I have elastic search running on a linux instance on Amazon EC2. I use tunnelier to connect to the instance. I'm new to EC2 and tunnelier (I'm more familiar with Windows Servers and Remote desktop). The problem is that when I disconnect the tunnelier console, my Elastic Search Server is no longer available for clients connecting to it. I would like to know how to keep the Elastic Search Server alive, serving client requests without my having to keep a tunnelier session active.
I guess I didn't ask this properly or so. Anyway, I found the answer here: http://www.elasticsearch.org/tutorials/2011/08/22/elasticsearch-on-ec2.html. Really really helpful. Thanks a million to the author. Helped me set up elastic search as a service on EC2.

Resources