MongoDB locally to production - mongodb

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?

Related

How can I connect and use MongoDB Compass from Windows to MongoDb server on WSL2

I want to work with Mongo Compass running in Windows and connect to MongoDb server in WSL2.
Both MongoDb services are working fine (I can connect from Windows to MongoDb server on Windows and from WSL2 to MongoDb server on WSL2).
Windows build 19042.
Thanks!
Unless you are running a pretty old build (from 2018 or earlier) WSL includes a feature known as Localhost Forwarding, which should automatically allow you to use localhost in Mongo Compass in Windows to connect to the database running under WSL.
However, sometimes that features "breaks", especially if you hibernate or turn on Windows with the Fast Startup feature enabled (which is the default).
If this is the case, try wsl --shutdown and restart WSL. Then disable Fast Startup. If you do need to hibernate, remember that you may need to wsl --shutdown again to restore the forwarding mechanism.
See this answer for some additional details.
As far, as I understood, to access something running on WSL from you host-machine(Windows) you need to manually map host:port of your WSL MongoDB server to localhost.
This link describes the topic, I hope:
https://learn.microsoft.com/en-us/windows/wsl/networking#accessing-a-wsl-2-distribution-from-your-local-area-network-lan
After mapping your port you probably will connect to your MongoDB server via Compass with mapped address and port.

How to connect apollo server to a remote mongo instance of an application deployed with mup

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.

Connect mongo with meteor in production

I have deployed my meteor application on localhost for demo purpose by following what was mentioned here.
$export MONGO_URL='mongodb://localhost'
$ export PORT=3000
$ export ROOT_URL='http://example.com'
$ node main.js
I have had a bunch of collections in my meteor's mongo instance while development and need to move it to the new db that the deployed version connects to. I've taken a mongo dump of that and I know how to restore it. My question is, how exactly do I connect to the mongo db in order to do this?
I've tried:
mongo localhost
mongo localhost:3000
mongo -U localhost
They don't seem to work.
NOTE -
I do not want to run the mongo in development environment using meteor mongo. I have to deploy this in the client machine.
You can use the Meteor command line tools to attach to your local meteor instance.
meteor mongo
Taken from https://docs.meteor.com/commandline.html#meteormongo
Also, I think your commands didn't work 'cause the meteor mongo instance is hosted on port 3001 instead of 3000. Port 3000 hosts the actual meteor app, 3001 is the mongo instance.
As k.chao.0424 says you can use meteor mongo to connect to the mongo db via terminal or command line if you are using windows. But as i see you used the port 3000 for mongodb. I suggest you a simple way you just run the follwing command to run meteor and mongo db just write on your terminal:-
meteor
or if you are using ubuntu and any permission issues than write:-
sudo meteor
It will automatically run your project on 3000 port and your mongdb in 3001 port as by default after running app you can connect with mongodb via following command:-
meteor mongo
Hope this will help!

robomongo aws ec2 ubuntu

Trying to make a remote connection from Robomongo to my ec2 ubuntu mongodb. I have been able to make connections to other non-ec2 ubuntu servers with Robomongo. But when I try with ec2 I keep getting the "you skipped authorization" error. I can remote connect to it in the terminal, but not with Robomongo. Is there something I a missing with ec2 remote connections?
What I have done:
created a mongo user administrator
make a connection within Robomongo
I am able to connect but says I skipped authorization.
My mongo log reads:
Failed to authenticate neil#admin with mechanism MONGODB-CR: AuthenticationFailed MONGODB-CR credentials missing in the user document
The Robomongo (at least 0.8.4) does not support Mongo 3.0 at this time.
For PHP, just update mongo.so module via pecl, because only 1.6 version is fully support Mongo 3.0.
https://github.com/paralect/robomongo/issues/766

Meteorjs, how to set MONGO_OPLOG_URL to use localhost's MongoDB replication directly?

My service is running on one server with Metoer project and MongoDB,
and there's one another replication server for MongoDB.
So I've configured Mongo replication with two official IP, and configured two MONGO_OPLOG_URL with the same two official IP when running Meteor project.
The question is, in this case,
when Meteor project fetch some data, does it use the network to get the data from the local MongoDB?
Because I didn't setup any hostname setting for its own official IP on my machine, so I doubt it may occur some data traffic to outside.
If I am right, how to config to use the Meteor server its localhost MongoDB without network traffic,
or if I am wrong, how does it work to use localhost db inside of the server if I use official IP for replication setting and meteor running environment?
Thanks in advance.