How to run same db folder - mongodb

I am running mongod --storageEngine=mmapv1 in console
and everything is fine. It uses by standard the C:\data\db folder.
But after I reload my computer and try same command it throws an error.
C:\mongodb\bin>mongod --storageEngine=mmapv1
2018-05-18T10:53:45.491+0300 I CONTROL [main]
2018-05-18T10:53:45.491+0300 W CONTROL [main] 32-bit servers don't have journal
ing enabled by default. Please use --journal if you want durability.
2018-05-18T10:53:45.491+0300 I CONTROL [main]
2018-05-18T10:53:45.491+0300 I CONTROL [main] Hotfix KB2731284 or later update
is not installed, will zero-out data files
2018-05-18T10:53:45.506+0300 I CONTROL [initandlisten] MongoDB starting : pid=2
396 port=27017 dbpath=C:\data\db\ 32-bit host=yaposhytiil-ara
2018-05-18T10:53:45.506+0300 I CONTROL [initandlisten] targetMinOS: Windows Vis
ta/Windows Server 2008
2018-05-18T10:53:45.506+0300 I CONTROL [initandlisten] db version v3.2.20
2018-05-18T10:53:45.506+0300 I CONTROL [initandlisten] git version: a7a144f40b7
0bfe290906eb33ff2714933544af8
2018-05-18T10:53:45.506+0300 I CONTROL [initandlisten] allocator: tcmalloc
2018-05-18T10:53:45.506+0300 I CONTROL [initandlisten] modules: none
2018-05-18T10:53:45.506+0300 I CONTROL [initandlisten] build environment:
2018-05-18T10:53:45.506+0300 I CONTROL [initandlisten] distarch: i386
2018-05-18T10:53:45.506+0300 I CONTROL [initandlisten] target_arch: i386
2018-05-18T10:53:45.506+0300 I CONTROL [initandlisten] options: { storage: { en
gine: "mmapv1" } }
2018-05-18T10:53:45.506+0300 W - [initandlisten] Detected unclean shutdow
n - C:\data\db\mongod.lock is not empty.
2018-05-18T10:53:45.528+0300 I STORAGE [initandlisten] **************
Unclean shutdown detected.
Please visit http://dochub.mongodb.org/core/repair for recovery instructions.
*************
2018-05-18T10:53:45.531+0300 I STORAGE [initandlisten] exception in initAndList
en: 12596 old lock file, terminating
2018-05-18T10:53:45.532+0300 I CONTROL [initandlisten] dbexit: rc: 100
As I understand it's locks the data from access.
I wouldn't waste your time, but I didn't know how to google it...
Is it because of 32bit Windows, or some user access settings, or I have to repair/delete db folder every time?

Related

Getting error running 'Mongod' to start mongodb

I'm trying to run mongodb, but typing 'mongod' is giving me the error below, do you know how to fix it?
mongod
2021-05-14T15:12:30.819-0400 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2021-05-14T15:12:30.846-0400 I CONTROL [initandlisten] MongoDB starting : pid=60494 port=27017 dbpath=/data/db 64-bit host=Chris.local
2021-05-14T15:12:30.846-0400 I CONTROL [initandlisten] db version v4.2.3
2021-05-14T15:12:30.846-0400 I CONTROL [initandlisten] git version: 6874650b362138df74be53d366bbefc321ea32d4
2021-05-14T15:12:30.846-0400 I CONTROL [initandlisten] allocator: system
2021-05-14T15:12:30.846-0400 I CONTROL [initandlisten] modules: none
2021-05-14T15:12:30.846-0400 I CONTROL [initandlisten] build environment:
2021-05-14T15:12:30.846-0400 I CONTROL [initandlisten] distarch: x86_64
2021-05-14T15:12:30.846-0400 I CONTROL [initandlisten] target_arch: x86_64
2021-05-14T15:12:30.846-0400 I CONTROL [initandlisten] options: {}
2021-05-14T15:12:30.848-0400 I STORAGE [initandlisten] exception in initAndListen: NonExistentPath: Data directory /data/db not found., terminating
2021-05-14T15:12:30.849-0400 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2021-05-14T15:12:30.849-0400 I - [initandlisten] Stopping further Flow Control ticket acquisitions.
2021-05-14T15:12:30.849-0400 I CONTROL [initandlisten] now exiting
2021-05-14T15:12:30.849-0400 I CONTROL [initandlisten] shutting down with code:100
Log file usually contains the clue to debug
You can see in the log
2021-05-14T15:12:30.848-0400 I STORAGE [initandlisten] exception in initAndListen: NonExistentPath: Data directory /data/db not found., terminating
The directory /data/db is not found, you need to create this directory and make sure mongod has write permission to this folder.

How do I change mongodb data directory on windows

My MongoDB server was running fine until yesterday. But then I encountered this error:
2020-03-31T10:21:25.981+0530 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2020-03-31T10:21:25.986+0530 I CONTROL [initandlisten] MongoDB starting : pid=7544 port=27017 dbpath=C:\data\db\ 64-bit host=DESKTOP-IP084D8
2020-03-31T10:21:25.987+0530 I CONTROL [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
2020-03-31T10:21:25.987+0530 I CONTROL [initandlisten] db version v4.2.3
2020-03-31T10:21:25.987+0530 I CONTROL [initandlisten] git version: 6874650b362138df74be53d366bbefc321ea32d4
2020-03-31T10:21:25.987+0530 I CONTROL [initandlisten] allocator: tcmalloc
2020-03-31T10:21:25.987+0530 I CONTROL [initandlisten] modules: none
2020-03-31T10:21:25.987+0530 I CONTROL [initandlisten] build environment:
2020-03-31T10:21:25.987+0530 I CONTROL [initandlisten] distmod: 2012plus
2020-03-31T10:21:25.987+0530 I CONTROL [initandlisten] distarch: x86_64
2020-03-31T10:21:25.987+0530 I CONTROL [initandlisten] target_arch: x86_64
2020-03-31T10:21:25.988+0530 I CONTROL [initandlisten] options: {}
2020-03-31T10:21:25.990+0530 I STORAGE [initandlisten] exception in initAndListen: NonExistentPath: Data directory C:\data\db\ not found., terminating
2020-03-31T10:21:25.990+0530 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2020-03-31T10:21:25.990+0530 I - [initandlisten] Stopping further Flow Control ticket acquisitions.
2020-03-31T10:21:25.990+0530 I CONTROL [initandlisten] now exiting
2020-03-31T10:21:25.991+0530 I CONTROL [initandlisten] shutting down with code:100
I do not know how the data path got changed. I have to change the MongoDB data path from C:\data\db\ to C:\Program Files\MongoDB\Server\4.2\data, so I tried changing it using the following command, but it doesn't recognize the path:
mongod --dbpath C:\Program Files\MongoDB\Server\4.2\data
What should be the format of the path to be entered here?
Use CMD as a system administrator and type
mongod --dbpath C:\myfolder\myproj\data\db"

mongodb no such file or directory wiredtiger_kv_engine

what I did :
went to the database directory and
mongod --dbpath .
then I got this:
2017-02-16T23:51:51.965+0800 I CONTROL [initandlisten] MongoDB starting : pid=31656 port=27017 dbpath=. 64-bit host=WIN-01604161705
2017-02-16T23:51:51.966+0800 I CONTROL [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
2017-02-16T23:51:51.968+0800 I CONTROL [initandlisten] db version v3.4.1
2017-02-16T23:51:51.969+0800 I CONTROL [initandlisten] git version: 5e103c4f5583e2566a45d740225dc250baacfbd7
2017-02-16T23:51:51.970+0800 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1t-fips 3 May 2016
2017-02-16T23:51:51.971+0800 I CONTROL [initandlisten] allocator: tcmalloc
2017-02-16T23:51:51.972+0800 I CONTROL [initandlisten] modules: none
2017-02-16T23:51:51.973+0800 I CONTROL [initandlisten] build environment:
2017-02-16T23:51:51.974+0800 I CONTROL [initandlisten] distmod: 2008plus-ssl
2017-02-16T23:51:51.975+0800 I CONTROL [initandlisten] distarch: x86_64
2017-02-16T23:51:51.975+0800 I CONTROL [initandlisten] target_arch: x86_64
2017-02-16T23:51:51.978+0800 I CONTROL [initandlisten] options: { storage: { dbPath: "." } }
2017-02-16T23:51:51.982+0800 I - [initandlisten] Detected data files in . created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2017-02-16T23:51:51.982+0800 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=3519M,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2017-02-16T23:51:51.992+0800 I - [initandlisten] Assertion: 28595:2: No such file or directory src\mongo\db\storage\wiredtiger\wiredtiger_kv_engine.cpp 267
2017-02-16T23:51:51.992+0800 I STORAGE [initandlisten] exception in initAndListen: 28595 2: No such file or directory, terminating
2017-02-16T23:51:51.993+0800 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2017-02-16T23:51:51.994+0800 I NETWORK [initandlisten] shutdown: going to flush diaglog...
2017-02-16T23:51:51.996+0800 I CONTROL [initandlisten] now exiting
2017-02-16T23:51:51.998+0800 I CONTROL [initandlisten] shutting down with code:100
I don't know what's going on at all.
all that I have done is just common things like revising my files in other directories, merge the branch 'master' into 'b2' using github client.
I doubt that something went wrong when I did the 'merge' operation.
I have tried using git revert to make it roll back, still getting the same error.
Should I reinstall mongodb? I'm doing so.

sudo service mongod start : mongod: unrecognized service

I'm testing learning locker which is based on MongoDB it's all inside a ubuntu14.04 docker https://hub.docker.com/r/hadyrashwan/learninglocker-ubuntu14.04/ . I got it to work but I can't start Mongodb automatically tried the repair command and changing the name in start service command to Mongodb or mongo but not working. but running Mongodb just make it start but I want to start it automatically not opening a terminal and leave it open so the system continues to work
root#bd1997365c3a:/# mongodb
2016-09-06T07:41:51.816+0000 I CONTROL [initandlisten] MongoDB starting : pid=197 port=27017 dbpath=/data/db 64-bit host=bd1997365c3a
2016-09-06T07:41:51.817+0000 I CONTROL [initandlisten] db version v3.2.9
2016-09-06T07:41:51.817+0000 I CONTROL [initandlisten] git version: 22ec9e93b40c85fc7cae7d56e7d6a02fd811088c
2016-09-06T07:41:51.817+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014
2016-09-06T07:41:51.817+0000 I CONTROL [initandlisten] allocator: tcmalloc
2016-09-06T07:41:51.817+0000 I CONTROL [initandlisten] modules: none
2016-09-06T07:41:51.817+0000 I CONTROL [initandlisten] build environment:
2016-09-06T07:41:51.817+0000 I CONTROL [initandlisten] distmod: ubuntu1404
2016-09-06T07:41:51.817+0000 I CONTROL [initandlisten] distarch: x86_64
2016-09-06T07:41:51.817+0000 I CONTROL [initandlisten] target_arch: x86_64
2016-09-06T07:41:51.817+0000 I CONTROL [initandlisten] options: {}
2016-09-06T07:41:51.823+0000 I - [initandlisten] Detected data files in /data/db created by the 'mmapv1' storage engine, so setting the active storage engine to 'mmapv1'.
2016-09-06T07:41:51.867+0000 I JOURNAL [initandlisten] journal dir=/data/db/journal
2016-09-06T07:41:51.867+0000 I JOURNAL [initandlisten] recover : no journal files present, no recovery needed
2016-09-06T07:41:52.027+0000 I JOURNAL [durability] Durability thread started
2016-09-06T07:41:52.027+0000 I JOURNAL [journal writer] Journal writer thread started
2016-09-06T07:41:52.101+0000 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2016-09-06T07:41:52.101+0000 I CONTROL [initandlisten]
2016-09-06T07:41:52.102+0000 I CONTROL [initandlisten]
2016-09-06T07:41:52.102+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2016-09-06T07:41:52.102+0000 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2016-09-06T07:41:52.102+0000 I CONTROL [initandlisten]
2016-09-06T07:41:52.102+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2016-09-06T07:41:52.102+0000 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2016-09-06T07:41:52.102+0000 I CONTROL [initandlisten]
2016-09-06T07:41:52.111+0000 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
2016-09-06T07:41:52.112+0000 I NETWORK [HostnameCanonicalizationWorker] Starting hostname canonicalization worker
2016-09-06T07:41:52.112+0000 I NETWORK [initandlisten] waiting for connections on port 27017
If already you install the mongodb just uninstall based on mongodb config
Before going do all stuff first install mongodb server.
sudo apt install mongodb-server
Then continue to install what mongodb config suggest you.
Once done your mongodb configuration you can go
sudo service mongodb start
Note: Its not mongod its mongodb
I had same problem. It seems there is some mis-configuration if you install via source code.
Re-installing mongoDB using apt-get activated mongod as a service for
me.

MongoDB not working in Vagrant Centos Box

I cant seem to fork off an instance of the MongoDB daemon when I am logged in to a Centos 7.1 Box. I have created the data/db folder and everytime I try to run
./bin/mongod --dbpath data/db
I get a mess of errors
2016-01-26T00:44:23.820+0000 I CONTROL [initandlisten] MongoDB starting : pid=2735 port=27017 dbpath=data/db 64-bit host=localhost.localdomain
2016-01-26T00:44:23.820+0000 I CONTROL [initandlisten] db version v3.2.1
2016-01-26T00:44:23.820+0000 I CONTROL [initandlisten] git version: a14d55980c2cdc565d4704a7e3ad37e4e535c1b2
2016-01-26T00:44:23.821+0000 I CONTROL [initandlisten] allocator: tcmalloc
2016-01-26T00:44:23.821+0000 I CONTROL [initandlisten] modules: none
2016-01-26T00:44:23.821+0000 I CONTROL [initandlisten] build environment:
2016-01-26T00:44:23.821+0000 I CONTROL [initandlisten] distarch: x86_64
2016-01-26T00:44:23.821+0000 I CONTROL [initandlisten] target_arch: x86_64
2016-01-26T00:44:23.821+0000 I CONTROL [initandlisten] options: { storage: { dbPath: "data/db" } }
2016-01-26T00:44:23.842+0000 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=1G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2016-01-26T00:44:23.853+0000 E STORAGE [initandlisten] WiredTiger (22) [1453769063:853352][2735:0x7f09f2eddcc0], connection: data/db/WiredTiger.wt: fsync: Invalid argument
2016-01-26T00:44:23.856+0000 I - [initandlisten] Fatal Assertion 28561
2016-01-26T00:44:23.856+0000 I - [initandlisten]
***aborting after fassert() failure
The strange thing is I did it earlier and it worked. What could be the problem?
It turns out that putting the downloaded mongodb database in the synced folder between the host machine and the virtual machine caused some type of permissions issue or configuration issue.
When you take it out of the synced folder - which most likely has the Vagrantfile - and put it in a folder thats not synced/shared it seems to work just fine. Thought id save someone the 5 hours I wasted :-)