How to get mongod.exe to start via gitbash? - mongodb

I was having problems with getting mongo (via mongosh command) to start in gitbash.
I was able to solve it via getting mongod.exe to start in windows(10) via ControlPanel>System/security>AdministrativeTools>Services (following the answer at https://stackoverflow.com/a/56354829/5358730).
Further to that I was wondering whether there is a way to do the same via commands written in the gitbash terminal itself?
I notice there several questions on asking mongodb to start (eg How to start mongdb How to start MongoDB server? How to start using MongoDB? How to start mongodb in windows 10 How to start mongodb shell? Start mongo from Windows command file), but I dont think these address using gitbash commands to get the file to start. Apologies if I've missed anything.
Thanks.

Related

How to start mongodb service for windows

How can I run my mongo db service on windows 10
I have downloaded mongo db. tried coping data files in required directories . Whenever I try start mongodb service from task manager->services it shows windows could not start mongo db service.
Here's the official documentation about how to install and run MonogDB in window. Link
Secondly this question is also asked before you can get help from here too.
If you already have installed MongoDB in your window OS and make sure you have set the environment variable for MongoDB.
To start MongoDB server - type 'mongod' in command prompt.
Start MongoDB server
To start client - type 'mongo' in command prompt.
Start MongoDB client

Mongodb is not running

I have installed mongodb in my computer. But whenever I try to launch it, it's not running. I have entered command , as "mongo" to start the mongodb, which shows following resuts, but the application is not opening.
Any one having any idea how can I fix this? Please share it. Thanx!
Environment: Ubuntu 16.04
Those are warnings that appear at the first mongo start. Don't worry to much about them.
Since the process is still running and you got the small > character there, that means you successfully connected to the MongoDB server.
mongod is the MongoDB server (you can check if it's running by running ps aux | grep mongod) and the mongo cli tool is a cli client connecting to the server. Here you can run commands.
For example, create your first document:
use myDatabase
db.people.insert({ name: "Rhea" })
db.people.find()
In conclusion, both the MongoDB server and client are running but you got a few warnings that only appear the first time when you run mongo.
Initially in one terminal write mongod.
Then on another terminal : mongo .
The first one will start the mongo server.
The second one will start the interpreter.
You can try various commands in the interpreter.

Can't start mongodb server in windows 7

I am using windows 7 64 bit laptop ,it contain 8 gb RAM ,i installed mongodb sucessfully ,while i am trying to connect the server using the "net start MongoDB" i stuck there lot? and it show service name is invalid, anyone could help me to retify this problem?
Open command prompt,
Navigate to where the mongodb is installed(usually at C:\Program Files\MongoDB\Server\3.2\bin),
Type mongod and hit enter.
From MongoDB documentation :
Start MongoDB.
To start MongoDB, run mongod.exe. For example, from the
Command Prompt:
"C:\Program Files\MongoDB\Server\3.4\bin\mongod.exe"
This starts the main MongoDB database process. The waiting for
connections message in the console output indicates that the
mongod.exe process is running successfully.
You take a look into log of console , you will see path of db (ex:C:\data\db)
Mongod not auto create folder when it not exist
You should create folder struct follow the log then run mongod.exe again. It will work.

Mongodb will not start

It has been a while since I have used Mongodb and I am running into a problem. I have an EC2 instance that had Mongodb running on it, but I had turned off the instance for a few months. After turning the instance back on, Mongodb will not start correctly. No log file is being created so I do not know what is causing the problem.
When I type:
sudo service mongodb start
I get the message:
mongodb start/running, process 2432
but mongo is not actually running and a mongod.lock file is being created.
If I type:
mongod
by itself, Mongodb will actually start and be usable. But, I must leave the terminal window up and not cancel out of the command to keep it running. I have to open up a second terminal window to access my databases. I guess my main question is how I get the mongod service to stay running itself without having to leave a terminal window open with the command running.
Sorry if my explanation doesn't make sense. Hopefully you get what I mean. Anyone have any idea what I am missing? I had this problem before months ago and was able to solve it. Sadly, I didn't write down the missing ingredient.
For that, run command using Nohup
nohup mongod &
Then you can terminate you terminal.

mongoDB test error

I came to know about mongoDB and looked for test.So I made it install and then for test when I used command mongo on terminal it showed an error like this
MongoDB shell version: 1.8.2
connecting to: test
Sun Jul 31 01:06:07 Error: couldn't connect to server 127.0.0.1 shell/mongo.js:79
exception: connect failed
So can someone tell me what is the problem.I am using ubuntu 11.04.For installation instruction I had used this site.I am newbie to this mongoDB so please helpe me.Any help will be highly appreciable.
All you need to do is open 2 terminal tabs. In one, run
mongod
which starts the MongoDB server.
In the other, run
mongo
which is the shell that connects to your MongoDB server.
It looks like MongoDB isn't running. Can you connect to the web interface in your browser?
http://localhost:28017
Also, do you see the process running on your machine? You should see an entry for mongod when running ...
$ top
or
$ ps aux
why not install mongodb from 10gen's own debian repository? much easier and more likely to work
http://www.mongodb.org/display/DOCS/Ubuntu+and+Debian+packages
To see if mongodb is running, this also helps:
sudo service mongodb status
if it is running, and you still get the same error, then it must be the weird localhost bug that mongodb has. it assumes localhost is 127.0.1.1 for some reason. try
mongo 127.0.1.1
I had the same problem. Just try to create folder c:\data and next c:\data\db