when I try to initialize a MongoDB project , it says " 2018-07-28T21:54:34.391+0530 F CONTROL [main] Failed global initialization: BadValue: dbPath requires an absolute file path with Windows services".
If someone knows what is the reason for that, please let me know...
my command is :
C:\"Program Files"\MongoDB\Server\4.0\bin>mongod --directoryperdb --dbpath C:\"Program Files"\MongoDB\Server\4.0\data\db --logpath C:\"Program Files"\MongoDB\Server\4.0\log\mongo.log --logappend --install
when I try to initialize it returns an error like below...
2018-07-28T21:54:34.391+0530 F CONTROL [main] Failed global initialization: BadValue: dbPath requires an absolute file path with Windows services
my dbpath -> C:\Program Files\MongoDB\Server\4.0\data\db
my logpath -> C:\Program Files\MongoDB\Server\4.0\log\mongo.log
Have you installed the mongodb? If you haven't done the install, download the mongodb from the link and install it:
https://www.mongodb.com/dr/fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-ssl-4.0.0-signed.msi/download
Create the database folder from command prompt
mkdir c:\mongodb\data\db
Create a folder for the log files.
mkdir c:\mongodb\logs
Create a folder for the config files
mkdir c:\mongodb\config
Create a file called mongodb.cfg with the following contents under the config folder c:\mongodb\config.
port=27017
dbpath=C:\mongodb\data\db\
logpath=C:\mongodb\logs\mongod.log
maxConns=100
Start the mongod (for a manual startup. To automate the startup, use step 6 instead)
"C:\Program Files\MongoDB\Server\4.0\bin\mongod" --directoryperdb --config "C:\mongodb\config\mongodb.cfg" --fork
Alternatively define the service
"C:\Program Files\MongoDB\Server\4.0\bin\mongod" --directoryperdb --config "C:\mongodb\config\mongodb.cfg" --install --serviceName "MongoDB"
net start MongoDB
Now your database in localhost with the port 27017 is running. You can create or use the database in node.js or in your favorite programming language.
Related
I'm trying to install mongodb on my centos server. after downloading and unziping the file I used the command rpm -ivh mongodb-org-server-4.0.5-1.el6.x86_64.rpm to install mongodb, then mkdir -p /var/lib/mongo and mkdir -p /var/log/mongodb to create the MongoDB data and log directories. I did chown -R mongod:mongod <directory> to set the owner and group of these directories to mongod. I modified the path : export PATH=<mongodb-install-directory>/bin:$PATH
but when I want to start mongo it fails Starting mongod: [FAILED]
it is the stack trace in mongodb log file:
2019-01-13T10:45:13.807+0330 F - [initandlisten] Fatal assertion 28520 knownError: 28: No space left on device at src/mongo/db/storage/kv/kv_storage_ gine.cpp 128
2019-01-13T10:45:13.807+0330 F - [initandlisten]
***aborting after fassert() failure
2019-01-13T10:45:13.949+0330 F - [initandlisten] Got signal: 6 (Aborted
0x7fc4b8b36b11 0x7fc4b8b35d29 0x7fc4b8b3620d 0x7fc4b4fb3710 0x7fc4b4c42925 0x c4b4c44105 0x7fc4b715570b 0x7fc4b73a42a5 0x7fc4b73a6d40 0x7fc4b720c066 0x7fc4b ffa7a 0x7fc4b70d7f90 0x7fc4b71c1466 0x7fc4b7156fb9 0x7fc4b4c2ed1d 0x7fc4b71bf5
----- BEGIN BACKTRACE -----
{"backtrace":[{"b":"7FC4B6741000","o":"23F5B11","s":"_ZN5mongo15printStackTrac RSo"},{"b":"7FC4B6741000","o":"23F4D29"},{"b":"7FC4B6741000","o":"23F520D"},{" :"7FC4B4FA4000","o":"F710"},{"b":"7FC4B4C10000","o":"32925","s":"gsignal"},{"b "7FC4B4C10000","o":"34105","s":"abort"},{"b":"7FC4B6741000","o":"A1470B","s":" N5mongo42fassertFailedWithStatusNoTraceWithLocationEiRKNS_6StatusEPKcj"},{"b": FC4B6741000","o":"C632A5","s":"_ZN5mongo15KVStorageEngine11loadCatalogEPNS_16O rationContextE"},{"b":"7FC4B6741000","
can any one knows why it doesn't start successfully?
It doesn't know the use command either when I want to make a database.
Why are you using version mongodb-org-server-4.0.5-1.el6.x86_64?
I recently installed mongodb on a shared centos server from godaddy. I used this version of mongodb: https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-4.0.5.tgz.
Remove all the files and folders from your first attempt, and try the version above. Hope it helps!
Edit:
SOLUTION by kometen
Does the file /tmp/mongodb-27017.sock exist? If so try to delete it, ie. 'sudo rm /tmp/mongodb-27017.sock'.
Hello I have an nodejs app.In order to setup the app I have a folder called "setup" with the following files:
commands.js
index.sh
index.js
I have also an the following npm script:
setup:sh ./setup/index.sh
Here are the contents of index.sh
#!/bin/sh
echo "Optikos app database setup on progress";
node "$PWD/setup/index.js";
mongo --p 27019 "$PWD/setup/commands.js";
However when I run the script I get the following error:
./setup/index.sh: 4: ./setup/index.sh: mongo: not found
However mongo is already installed and in my $PATH
Any ideas why this is happening?
Here is my $PATH:
/home/mkcodergr/.npm-global/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/mkcodergr/Documents/GitHub/optikos-app/node_modules/.bin:~/mongo/bin:~/Downloads/ngrok:~/.npm-global/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
The problem was in my ~/.profile file.
I changed the following lines in the end of the file:
PATH="~/.npm-global/bin:$PATH"
PATH="~/Downloads/ngrok:$PATH"
PATH="~/mongo/bin:$PATH"
to:
PATH="$HOME/.npm-global/bin:$PATH"
PATH="$HOME/Downloads/ngrok:$PATH"
PATH="$HOME/mongo/bin:$PATH"
And reloaded my profile and it worked
Mysql5.7.18 why won't start, I extract is the edition version.
mysql server could not start.
cmd : net start mysql.
error:server not start.
Mysql installation tutorial:
1. Download mysql archives decompression;
2. New data folder under the mysql root path
3. Enter the DOS, then CD to mysql installation location bin directory;
4. Execute the command: mysqld -- the initialize - insecure - user = mysql
5. Execute the command: net start mysql
Basic installation ends
I have an alpine machine on my virtual machine and I want to install mongodb. I added the package for mongodb using "apk add mongodb". I started mongo daemon using command mongod in one terminal. Then opened another terminal with mongo shell using mongo --disableJavaScriptJIT. I tried adding files and reading them from the database and that worked fine. But when I do sudo service mongodb restart I got the following output.
* Caching service dependencies ... [ ok ]
* Starting mongodb ...
* start-stop-daemon: failed to start `/usr/bin/mongod' [ !! ]
* ERROR: mongodb failed to start
The first thing you should do is to read the log file. I think that you’ll read here that mongodb doesn’t have rights to access some files. When you started it manually, you haven’t run it as user mongodb, have you…?
If this hypothesis is right, then the solution is to fix owner (and group) of the /var/lib/mongodb (recursively).
i'm having trouble starting my mongodb. I've installed it yesterday and even have put some records in the db. But later when I wanted to go further with the project and tried to start the db again it wouldn't start.
this is what I tried in my cmd (ps I'm using Windows 8 and i've turned off my firewall)
c:\mongo\bin>mongod --> error dbpath(\data\db) does not exist
c:\mongo\bin>mongo --> failed to connect to 127.0.0.1:27017 reason: errno:10061
c:\mongo\bin>mongo.exe --> failed to connect to 127.0.0.1:27017 reason: errno:10061
c:\mongo\bin>mongod.exe --> error dbpath(\data\db) does not exist
So generaly , it just keeps saying that the dbpath doesn't exist , but it does because in my c:\mongo\bin map i have a map data and in that map there is a map db
Try to explicitly specify path via --dbpath option or in config file, like this:
mongod --dbpath c:\data\db
worked for me to make a map in windows explorer and then run mongod.
But it needs to be the drive where mongo is installed c:\data\db and not in for example e:\data\db