I am currently developing an application that uses a remote MongoDB database. Is there a way to retain the existing connection to the remote database when Nodemon restarts the app locally?
Related
I am facing the following situation:
I have a docker container (db) running a PostgreSQL database on my machine.
Furthermore, currently I have another container (server), which can successfully connect to that database from the same machine.
However, what I want is to connect to the db database from the server container, even if it is running on different machine. How could I do that?
I found this: https://www.codegrepper.com/code-examples/whatever/how+to+connect+to+remote+postgres+database+from+command+line
and this: https://www.a2hosting.com/kb/developer-corner/postgresql/remote-postgresql-connections#Method-2.3A-Set-up-a-direct-connection.
Both solutions make connection to the machine running the db container through ssh. However, I can whitelist only some valid users to be able to ssh to the machine running the db container, but not the user (which is the root) of the server container.
I hope my question is clear!
Thanks for any help!
p.s.: both containers are defined in a docker-compose file.
I am trying to connect an application in .net core from a linux machine to a mongo replicaset. But I am getting a timeout error.
Unhandled exception. System.TimeoutException: A timeout occured after 30000ms selecting a server using CompositeServerSelector
The replica ips are accessible from this machine, a response is obtained by pinging.
If in linux the connection to mongo is to a single instance of the replica, it works correctly.
This same code in windows connects without problem.
If you are certain IP connectivity works, most likely you have the hostnames wrong. The hostnames used in RS config must work from each client.
See https://github.com/p-mongo/mongodb-faq.
My server is running on AWS EC2 and I noticed that it has 45000 mongo connections from our app's server IP. Though in code, there is only one mongo connection getting created at start.
Can anyone help me out here in debugging why it has so many connections?
PS: We use PM2 to restart the server, could it be because of that?
So I have application A and Application B, I want to connect to the mongo instance of application B (through apollo server) which is deployed with mup in another server. By default, you cannot connect to the mongo instance of an application deployed with mup from outside. I tried setting bind_ip=0.0.0.0 in mongo config and set the necessary users and passwords but no luck.
The connections work find if all applications are running in the same server.
I currently have an app running MongoDB, it works great locally. I am now struggling to find any information if I can host this on my server. Can I ssh into my server and install MongoDB or do I need a service like Mongo Labs?