I made the installation of WiredTiger, but find that I cannot start the DB using the standard:
sudo service mongod start
It seems when I look into the log file (tail /var/log/mongodb/mongod.log):
2016-08-01T14:48:12.029+0200 I CONTROL [main] ***** SERVER RESTARTED *****
2016-08-01T14:48:12.032+0200 I CONTROL [initandlisten] MongoDB starting : pid=1238 port=27017 dbpath=/var/lib/mongodb 64-bit host=xxx
2016-08-01T14:48:12.032+0200 I CONTROL [initandlisten] db version v3.2.8
2016-08-01T14:48:12.032+0200 I CONTROL [initandlisten] git version: ed70e33130c977bda0024c125b56d159573dbaf0
2016-08-01T14:48:12.032+0200 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2g-fips 1 Mar 2016
2016-08-01T14:48:12.032+0200 I CONTROL [initandlisten] allocator: tcmalloc
2016-08-01T14:48:12.032+0200 I CONTROL [initandlisten] modules: enterprise
2016-08-01T14:48:12.032+0200 I CONTROL [initandlisten] build environment:
2016-08-01T14:48:12.032+0200 I CONTROL [initandlisten] distmod: ubuntu1604
2016-08-01T14:48:12.032+0200 I CONTROL [initandlisten] distarch: x86_64
2016-08-01T14:48:12.032+0200 I CONTROL [initandlisten] target_arch: x86_64
2016-08-01T14:48:12.032+0200 I CONTROL [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1", port: 27017 }, storage: { dbPath: "/var/lib/mongodb", engine: "wiredTiger", journ
al: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log", quiet: true } }
2016-08-01T14:48:12.052+0200 I STORAGE [initandlisten] exception in initAndListen: 98 Unable to create/open lock file: /var/lib/mongodb/mongod.lock errno:13 Permission denied Is a mongod instance already
running?, terminating
2016-08-01T14:48:12.052+0200 I CONTROL [initandlisten] dbexit: rc:
100
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: /var/lib/mongodb
journal:
enabled: true
engine: wiredTiger
# mmapv1:
# wiredTiger:
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1
I have changed the permissions as follows on:
chmod -R 777 /var/log/mongodb
chown -R /var/log/mongodb
But nothing makes a difference. There is no service running. I can run from the command line:
mongod
which gives the following:
2016-08-01T15:35:51.291+0200 I CONTROL [initandlisten] MongoDB starting : pid=5776 port=27017 dbpath=/data/db 64-bit host=brett
2016-08-01T15:35:51.291+0200 I CONTROL [initandlisten] db version v3.2.8
2016-08-01T15:35:51.291+0200 I CONTROL [initandlisten] git version: ed70e33130c977bda0024c125b56d159573dbaf0
2016-08-01T15:35:51.291+0200 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2g-fips 1 Mar 2016
2016-08-01T15:35:51.291+0200 I CONTROL [initandlisten] allocator: tcmalloc
2016-08-01T15:35:51.291+0200 I CONTROL [initandlisten] modules: enterprise
2016-08-01T15:35:51.291+0200 I CONTROL [initandlisten] build environment:
2016-08-01T15:35:51.291+0200 I CONTROL [initandlisten] distmod: ubuntu1604
2016-08-01T15:35:51.291+0200 I CONTROL [initandlisten] distarch: x86_64
2016-08-01T15:35:51.291+0200 I CONTROL [initandlisten] target_arch: x86_64
2016-08-01T15:35:51.291+0200 I CONTROL [initandlisten] options: {}
2016-08-01T15:35:51.311+0200 I - [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2016-08-01T15:35:51.311+0200 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=4G,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-08-01T15:35:51.722+0200 I CONTROL [initandlisten]
2016-08-01T15:35:51.722+0200 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2016-08-01T15:35:51.722+0200 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2016-08-01T15:35:51.722+0200 I CONTROL [initandlisten]
2016-08-01T15:35:51.722+0200 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2016-08-01T15:35:51.722+0200 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2016-08-01T15:35:51.722+0200 I CONTROL [initandlisten]
2016-08-01T15:35:51.722+0200 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
2016-08-01T15:35:51.722+0200 I NETWORK [HostnameCanonicalizationWorker] Starting hostname canonicalization worker
2016-08-01T15:35:51.723+0200 I NETWORK [initandlisten] waiting for connections on port 27017
But I cannot get mongod as a service! Trying permissions:
sudo chown -R mongodb:mongodb /var/lib/mongodb
or
sudo chown -R user:machine /var/lib/mongodb
or
sudo chown -R root:machine /var/lib/mongodb
If I run the following:
mongod --config /etc/mongod.conf
I can then connect to the DB with mongo
as follows:
MongoDB shell version: 3.2.8
connecting to: test
Server has startup warnings:
2016-08-09T19:46:31.583+0200 I CONTROL [initandlisten]
2016-08-09T19:46:31.583+0200 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2016-08-09T19:46:31.583+0200 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2016-08-09T19:46:31.583+0200 I CONTROL [initandlisten]
2016-08-09T19:46:31.583+0200 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2016-08-09T19:46:31.583+0200 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2016-08-09T19:46:31.583+0200 I CONTROL [initandlisten]
Here is the output from ls -la /var/lib/mongodb
total 216
drwxrwxrwx 4 xxx root 4096 Aug 19 12:37 .
drwxr-xr-x 78 root root 4096 Aug 9 15:05 ..
-rwxrwxrwx 1 xxx xxx 36864 Aug 10 11:22 collection-0--5694223804331577236.wt
drwxrwxrwx 2 xxx xxx 4096 Aug 10 11:22 diagnostic.data
-rwxrwxrwx 1 xxx xxx 36864 Aug 10 11:22 index-1--5694223804331577236.wt
drwxrwxrwx 2 xxx xxx 4096 Aug 9 19:46 journal
-rwxrwxrwx 1 xxx xxx 16384 Aug 10 11:22 _mdb_catalog.wt
-rwxrwxrwx 1 xxx xxx 36864 Aug 10 11:22 sizeStorer.wt
-rwxrwxrwx 1 xxx xxx 95 Aug 9 19:30 storage.bson
-rwxrwxrwx 1 xxx xxx 46 Aug 9 19:30 WiredTiger
-rwxrwxrwx 1 xxx xxx 4096 Aug 10 11:22 WiredTigerLAS.wt
-rwxrwxrwx 1 xxx xxx 21 Aug 9 19:30 WiredTiger.lock
-rwxrwxrwx 1 xxx xxx 918 Aug 10 11:22 WiredTiger.turtle
-rwxrwxrwx 1 xxx xxx 45056 Aug 10 11:22 WiredTiger.wt
I also tried removing the huge files as was suggested. But I can never find a way to get the service started.
Here is me running mongod:
2016-08-19T12:53:53.713+0200 I CONTROL [initandlisten] MongoDB starting : pid=9030 port=27017 dbpath=/data/db 64-bit host=xxx
2016-08-19T12:53:53.713+0200 I CONTROL [initandlisten] db version v3.2.8
2016-08-19T12:53:53.713+0200 I CONTROL [initandlisten] git version: ed70e33130c977bda0024c125b56d159573dbaf0
2016-08-19T12:53:53.713+0200 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2g-fips 1 Mar 2016
2016-08-19T12:53:53.713+0200 I CONTROL [initandlisten] allocator: tcmalloc
2016-08-19T12:53:53.713+0200 I CONTROL [initandlisten] modules: enterprise
2016-08-19T12:53:53.713+0200 I CONTROL [initandlisten] build environment:
2016-08-19T12:53:53.713+0200 I CONTROL [initandlisten] distmod: ubuntu1604
2016-08-19T12:53:53.713+0200 I CONTROL [initandlisten] distarch: x86_64
2016-08-19T12:53:53.713+0200 I CONTROL [initandlisten] target_arch: x86_64
2016-08-19T12:53:53.713+0200 I CONTROL [initandlisten] options: {}
2016-08-19T12:53:53.732+0200 I - [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2016-08-19T12:53:53.733+0200 I STORAGE [initandlisten] exception in initAndListen: 98 Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating
2016-08-19T12:53:53.733+0200 I CONTROL [initandlisten] dbexit: rc: 100
here is:
ls -ld /data/db/
drwxr-xr-x 4 mongodb nogroup 4096 Aug 19 13:10 /data/db/
I can start mongo using
sudo mongod
2016-08-19T13:13:47.117+0200 I CONTROL [initandlisten] MongoDB starting : pid=12360 port=27017 dbpath=/data/db 64-bit host=brett
2016-08-19T13:13:47.117+0200 I CONTROL [initandlisten] db version v3.2.8
2016-08-19T13:13:47.117+0200 I CONTROL [initandlisten] git version: ed70e33130c977bda0024c125b56d159573dbaf0
2016-08-19T13:13:47.117+0200 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2g-fips 1 Mar 2016
2016-08-19T13:13:47.117+0200 I CONTROL [initandlisten] allocator: tcmalloc
2016-08-19T13:13:47.117+0200 I CONTROL [initandlisten] modules: enterprise
2016-08-19T13:13:47.117+0200 I CONTROL [initandlisten] build environment:
2016-08-19T13:13:47.117+0200 I CONTROL [initandlisten] distmod: ubuntu1604
2016-08-19T13:13:47.117+0200 I CONTROL [initandlisten] distarch: x86_64
2016-08-19T13:13:47.117+0200 I CONTROL [initandlisten] target_arch: x86_64
2016-08-19T13:13:47.117+0200 I CONTROL [initandlisten] options: {}
2016-08-19T13:13:47.137+0200 I - [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2016-08-19T13:13:47.137+0200 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=4G,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-08-19T13:13:47.548+0200 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2016-08-19T13:13:47.548+0200 I CONTROL [initandlisten]
2016-08-19T13:13:47.549+0200 I CONTROL [initandlisten]
2016-08-19T13:13:47.549+0200 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2016-08-19T13:13:47.549+0200 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2016-08-19T13:13:47.549+0200 I CONTROL [initandlisten]
2016-08-19T13:13:47.549+0200 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2016-08-19T13:13:47.549+0200 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2016-08-19T13:13:47.549+0200 I CONTROL [initandlisten]
2016-08-19T13:13:47.549+0200 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
2016-08-19T13:13:47.549+0200 I NETWORK [HostnameCanonicalizationWorker] Starting hostname canonicalization worker
2016-08-19T13:13:47.550+0200 I NETWORK [initandlisten] waiting for connections on port 27017
But still no joy getting mongo as a service :(
Here is the /etc/init/mongod.conf
# Ubuntu upstart file at /etc/init/mongod.conf
# Recommended ulimit values for mongod or mongos
# See http://docs.mongodb.org/manual/reference/ulimit/#recommended-settings
#
limit fsize unlimited unlimited
limit cpu unlimited unlimited
limit as unlimited unlimited
limit nofile 64000 64000
limit rss unlimited unlimited
limit nproc 64000 64000
kill timeout 300 # wait 300s between SIGTERM and SIGKILL.
pre-start script
DAEMONUSER=${DAEMONUSER:-mongodb}
if [ ! -d /var/lib/mongodb ]; then
mkdir -p /var/lib/mongodb && chown mongodb:mongodb /var/lib/mongodb
fi
if [ ! -d /var/log/mongodb ]; then
mkdir -p /var/log/mongodb && chown mongodb:mongodb /var/log/mongodb
fi
touch /var/run/mongodb.pid
chown $DAEMONUSER /var/run/mongodb.pid
end script
start on runlevel [2345]
stop on runlevel [06]
script
ENABLE_MONGOD="yes"
CONF=/etc/mongod.conf
DAEMON=/usr/bin/mongod
DAEMONUSER=${DAEMONUSER:-mongodb}
DAEMONGROUP=${DAEMONGROUP:-mongodb}
if [ -f /etc/default/mongod ]; then . /etc/default/mongod; fi
# Handle NUMA access to CPUs (SERVER-3574)
# This verifies the existence of numactl as well as testing that the command works
NUMACTL_ARGS="--interleave=all"
if which numactl >/dev/null 2>/dev/null && numactl $NUMACTL_ARGS ls / >/dev/null 2>/dev/null
then
NUMACTL="$(which numactl) -- $NUMACTL_ARGS"
DAEMON_OPTS=${DAEMON_OPTS:-"--config $CONF"}
else
NUMACTL=""
DAEMON_OPTS="-- "${DAEMON_OPTS:-"--config $CONF"}
fi
if [ "x$ENABLE_MONGOD" = "xyes" ]
then
exec start-stop-daemon --start \
--chuid $DAEMONUSER:$DAEMONGROUP \
--pidfile /var/run/mongodb.pid \
--make-pidfile \
--exec $NUMACTL $DAEMON $DAEMON_OPTS
fi
end script
As others wrote... Error message points that problem is that process cannot create /var/lib/mongodb/mongod.lock
You need to understand that even you say (as root) 'service mongod start' (when you use sudo -command, command is executed as root), process (mongod) is started as user 'mongod'. So, that directory /var/lib/mongodb must be exist and be writable by userid mongod.
mkdir -p /var/lib/mongodb ; chown -R mongod: /var/lib/mongodb
sudo service mongod restart
(OR 'sudo -u mongod mongod -f /etc/mongod.conf')
Related
On mac Catalina, /data/db is no longer writeable, and so the new brew install of mongodb-community uses a new path, /usr/local/var/mongodb. I upgraded, following these instructions:
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/#install-mongodb-community-edition
and to confirm:
$ ls -al /usr/local/bin/mongod
lrwxr-xr-x 1 rkohr admin 44 Feb 5 10:49 /usr/local/bin/mongod -> ../Cellar/mongodb-community/4.2.3/bin/mongod
$ cat /usr/local/etc/mongod.conf
systemLog:
destination: file
path: /usr/local/var/log/mongodb/mongo.log
logAppend: true
storage:
dbPath: /usr/local/var/mongodb
net:
bindIp: 127.0.0.1
But it seems that the config is being ignored since it is still trying to use the old /data/db path:
$ mongod
2020-02-05T10:55:42.210-0500 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2020-02-05T10:55:42.215-0500 I CONTROL [initandlisten] MongoDB starting : pid=1518 port=27017 dbpath=/data/db 64-bit host=Robs-MacBook-Pro.local
2020-02-05T10:55:42.215-0500 I CONTROL [initandlisten] db version v4.2.3
2020-02-05T10:55:42.215-0500 I CONTROL [initandlisten] git version: 6874650b362138df74be53d366bbefc321ea32d4
2020-02-05T10:55:42.215-0500 I CONTROL [initandlisten] allocator: system
2020-02-05T10:55:42.215-0500 I CONTROL [initandlisten] modules: none
2020-02-05T10:55:42.215-0500 I CONTROL [initandlisten] build environment:
2020-02-05T10:55:42.215-0500 I CONTROL [initandlisten] distarch: x86_64
2020-02-05T10:55:42.215-0500 I CONTROL [initandlisten] target_arch: x86_64
2020-02-05T10:55:42.215-0500 I CONTROL [initandlisten] options: {}
2020-02-05T10:55:42.216-0500 E NETWORK [initandlisten] Failed to unlink socket file /tmp/mongodb-27017.sock Permission denied
2020-02-05T10:55:42.216-0500 F - [initandlisten] Fatal Assertion 40486 at src/mongo/transport/transport_layer_asio.cpp 683
2020-02-05T10:55:42.216-0500 F - [initandlisten]
***aborting after fassert() failure
#RobKohr To make it works, you have to run following command:
mongod --config /usr/local/etc/mongod.conf
See: https://docs.mongodb.com/manual/reference/configuration-options/#use-the-configuration-file
I have problem with mongoDB - I going step by step with official tutorial:
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
Also I installed through this answer( of course I changed some commands to download 4.2 not 4.0 like it is in this answer): https://askubuntu.com/questions/842592/apt-get-fails-on-16-04-or-18-04-installing-mongodb/842599#842599
But afterall it still doesnt work:
adrian#ubuntu:~$ sudo service mongod start
adrian#ubuntu:~$ sudo service mongod status
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2019-09-26 09:37:53 CEST; 2s ago
Docs: https://docs.mongodb.org/manual
Process: 5220 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=62)
Main PID: 5220 (code=exited, status=62)
Sep 26 09:37:51 ubuntu systemd[1]: Started MongoDB Database Server.
Sep 26 09:37:53 ubuntu systemd[1]: mongod.service: Main process exited, code=exited, status=62/n/a
Sep 26 09:37:53 ubuntu systemd[1]: mongod.service: Failed with result 'exit-code'.
Even when I try to investigate mongo logs it still doesnt tell me much:
adrian#ubuntu:~$ sudo tail -n 100 /var/log/mongodb/mongod.log
2019-09-26T09:37:51.893+0200 I CONTROL [main] ***** SERVER RESTARTED *****
2019-09-26T09:37:51.895+0200 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2019-09-26T09:37:51.901+0200 I CONTROL [initandlisten] MongoDB starting : pid=5220 port=27017 dbpath=/var/lib/mongodb 64-bit host=ubuntu
2019-09-26T09:37:51.901+0200 I CONTROL [initandlisten] db version v4.2.0
2019-09-26T09:37:51.901+0200 I CONTROL [initandlisten] git version: a4b751dcf51dd249c5865812b390cfd1c0129c30
2019-09-26T09:37:51.901+0200 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.1.1 11 Sep 2018
2019-09-26T09:37:51.901+0200 I CONTROL [initandlisten] allocator: tcmalloc
2019-09-26T09:37:51.901+0200 I CONTROL [initandlisten] modules: none
2019-09-26T09:37:51.901+0200 I CONTROL [initandlisten] build environment:
2019-09-26T09:37:51.901+0200 I CONTROL [initandlisten] distmod: ubuntu1804
2019-09-26T09:37:51.901+0200 I CONTROL [initandlisten] distarch: x86_64
2019-09-26T09:37:51.901+0200 I CONTROL [initandlisten] target_arch: x86_64
2019-09-26T09:37:51.901+0200 I CONTROL [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1", port: 27017 }, processManagement: { timeZoneInfo: "/usr/share/zoneinfo" }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }
2019-09-26T09:37:51.901+0200 I STORAGE [initandlisten] Detected data files in /var/lib/mongodb created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2019-09-26T09:37:51.901+0200 I STORAGE [initandlisten]
2019-09-26T09:37:51.901+0200 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2019-09-26T09:37:51.901+0200 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem
2019-09-26T09:37:51.901+0200 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=11527M,cache_overflow=(file_max=0M),session_max=33000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=[recovery_progress,checkpoint_progress],
2019-09-26T09:37:52.400+0200 I STORAGE [initandlisten] WiredTiger message [1569483472:400536][5220:0x7fc6c8d05b00], txn-recover: Recovering log 20 through 21
2019-09-26T09:37:52.460+0200 I STORAGE [initandlisten] WiredTiger message [1569483472:460670][5220:0x7fc6c8d05b00], txn-recover: Recovering log 21 through 21
2019-09-26T09:37:52.544+0200 I STORAGE [initandlisten] WiredTiger message [1569483472:544472][5220:0x7fc6c8d05b00], txn-recover: Main recovery loop: starting at 20/896 to 21/256
2019-09-26T09:37:52.607+0200 I STORAGE [initandlisten] WiredTiger message [1569483472:607556][5220:0x7fc6c8d05b00], txn-recover: Recovering log 20 through 21
2019-09-26T09:37:52.643+0200 I STORAGE [initandlisten] WiredTiger message [1569483472:643077][5220:0x7fc6c8d05b00], txn-recover: Recovering log 21 through 21
2019-09-26T09:37:52.669+0200 I STORAGE [initandlisten] WiredTiger message [1569483472:669301][5220:0x7fc6c8d05b00], txn-recover: Set global recovery timestamp: (0,0)
2019-09-26T09:37:52.677+0200 I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
2019-09-26T09:37:52.682+0200 I STORAGE [initandlisten] Timestamp monitor starting
2019-09-26T09:37:52.683+0200 I CONTROL [initandlisten]
2019-09-26T09:37:52.683+0200 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2019-09-26T09:37:52.684+0200 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2019-09-26T09:37:52.684+0200 I CONTROL [initandlisten]
2019-09-26T09:37:52.698+0200 I SHARDING [initandlisten] Marking collection local.system.replset as collection version: <unsharded>
2019-09-26T09:37:52.698+0200 F CONTROL [initandlisten] ** IMPORTANT: UPGRADE PROBLEM: Found an invalid featureCompatibilityVersion document (ERROR: BadValue: Invalid value for version, found 3.6, expected '4.2' or '4.0'. Contents of featureCompatibilityVersion document in admin.system.version: { _id: "featureCompatibilityVersion", version: "3.6" }. See http://dochub.mongodb.org/core/4.0-feature-compatibility.). If the current featureCompatibilityVersion is below 4.0, see the documentation on upgrading at http://dochub.mongodb.org/core/4.0-upgrade-fcv.
2019-09-26T09:37:52.698+0200 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2019-09-26T09:37:52.698+0200 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2019-09-26T09:37:52.698+0200 I - [initandlisten] Stopping further Flow Control ticket acquisitions.
2019-09-26T09:37:52.698+0200 I STORAGE [initandlisten] Deregistering all the collections
2019-09-26T09:37:52.698+0200 I STORAGE [initandlisten] Timestamp monitor shutting down
2019-09-26T09:37:52.698+0200 I STORAGE [initandlisten] WiredTigerKVEngine shutting down
2019-09-26T09:37:52.699+0200 I STORAGE [initandlisten] Shutting down session sweeper thread
2019-09-26T09:37:52.699+0200 I STORAGE [initandlisten] Finished shutting down session sweeper thread
2019-09-26T09:37:52.699+0200 I STORAGE [initandlisten] Shutting down journal flusher thread
2019-09-26T09:37:52.779+0200 I STORAGE [initandlisten] Finished shutting down journal flusher thread
2019-09-26T09:37:52.779+0200 I STORAGE [initandlisten] Shutting down checkpoint thread
2019-09-26T09:37:52.779+0200 I STORAGE [initandlisten] Finished shutting down checkpoint thread
2019-09-26T09:37:52.779+0200 I STORAGE [initandlisten] Downgrading WiredTiger datafiles.
2019-09-26T09:37:52.808+0200 I STORAGE [initandlisten] WiredTiger message [1569483472:808033][5220:0x7fc6c8d05b00], txn-recover: Recovering log 21 through 22
2019-09-26T09:37:52.848+0200 I STORAGE [initandlisten] WiredTiger message [1569483472:848763][5220:0x7fc6c8d05b00], txn-recover: Recovering log 22 through 22
2019-09-26T09:37:52.891+0200 I STORAGE [initandlisten] WiredTiger message [1569483472:891333][5220:0x7fc6c8d05b00], txn-recover: Main recovery loop: starting at 21/3328 to 22/256
2019-09-26T09:37:52.944+0200 I STORAGE [initandlisten] WiredTiger message [1569483472:944712][5220:0x7fc6c8d05b00], txn-recover: Recovering log 21 through 22
2019-09-26T09:37:52.977+0200 I STORAGE [initandlisten] WiredTiger message [1569483472:977288][5220:0x7fc6c8d05b00], txn-recover: Recovering log 22 through 22
2019-09-26T09:37:53.003+0200 I STORAGE [initandlisten] WiredTiger message [1569483473:3143][5220:0x7fc6c8d05b00], txn-recover: Set global recovery timestamp: (0,0)
2019-09-26T09:37:53.023+0200 I STORAGE [initandlisten] shutdown: removing fs lock...
2019-09-26T09:37:53.023+0200 I CONTROL [initandlisten] now exiting
2019-09-26T09:37:53.023+0200 I CONTROL [initandlisten] shutting down with code:62
I will be very grateful for any advice
Remove complete mongodb from your ubuntu
sudo apt-get purge mongo* // or sudo apt remove mongo*
sudo apt-get purge mongodb-org*
Backup your database and remove log and data using folder
sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongodb
Now install again with this
$ wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc \
sudo apt-key add -
Add sources
$ echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.2 multiverse" \
sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list
Then install mongodb package again
sudo apt-get install -y mongodb-org=4.2.0 \
mongodb-org-server=4.2.0 \
mongodb-org-shell=4.2.0 \
mongodb-org-mongos=4.2.0 \
mongodb-org-tools=4.2.0
Start service using mongodb
$ systemctl enable mongod.service
$ sudo service mongod start
Or Follow this doc installation process
i also have this issue, i solved by change the bindIp in mongo config
On Linux, a default /etc/mongod.conf configuration file is included
when using a package manager to install MongoDB.
sudo nano /etc/mongod.conf
then edit the bindIP to
bindIp: [127.0.0.1, X.X.X.X]
Then restart mongodb .
sudo service mongod stop
sudo service mongod start
when i run the command sudo service mongod start the MongoDB cannot start and when i run the service mongod status it shows it has not been started, and the log shows:
2018-07-05T14:32:03.595+0800 I CONTROL [main] ***** SERVER RESTARTED *****
2018-07-05T14:32:03.605+0800 I CONTROL [initandlisten] MongoDB starting : pid=15656 port=27017 dbpath=/var/lib/mongodb 64-bit host=iZbp1ik57sceo226yjpivxZ
2018-07-05T14:32:03.605+0800 I CONTROL [initandlisten] db version v4.0.0-rc7
2018-07-05T14:32:03.605+0800 I CONTROL [initandlisten] git version: 7230641bb09b1ceb04c3135cf83a5044c4838906
2018-07-05T14:32:03.605+0800 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
2018-07-05T14:32:03.605+0800 I CONTROL [initandlisten] allocator: tcmalloc
2018-07-05T14:32:03.605+0800 I CONTROL [initandlisten] modules: none
2018-07-05T14:32:03.605+0800 I CONTROL [initandlisten] build environment:
2018-07-05T14:32:03.605+0800 I CONTROL [initandlisten] distmod: ubuntu1604
2018-07-05T14:32:03.605+0800 I CONTROL [initandlisten] distarch: x86_64
2018-07-05T14:32:03.605+0800 I CONTROL [initandlisten] target_arch: x86_64
2018-07-05T14:32:03.605+0800 I CONTROL [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "0.0.0.0", port: 27017 }, processManagement: { timeZoneInfo: "/usr/share/zoneinfo" }, security: { authorization: "enabled" }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }
2018-07-05T14:32:03.605+0800 I STORAGE [initandlisten] Detected data files in /var/lib/mongodb created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2018-07-05T14:32:03.605+0800 I STORAGE [initandlisten]
2018-07-05T14:32:03.605+0800 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2018-07-05T14:32:03.605+0800 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem
2018-07-05T14:32:03.605+0800 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=488M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
2018-07-05T14:32:04.204+0800 E STORAGE [initandlisten] WiredTiger error (13) [1530772324:204155][15656:0x7fb5cb734a00], wiredtiger_open: /var/lib/mongodb/WiredTiger.turtle: handle-open: open: Permission denied Raw: [1530772324:204155][15656:0x7fb5cb734a00], wiredtiger_open: /var/lib/mongodb/WiredTiger.turtle: handle-open: open: Permission denied
2018-07-05T14:32:04.204+0800 E STORAGE [initandlisten] WiredTiger error (13) [1530772324:204458][15656:0x7fb5cb734a00], wiredtiger_open: /var/lib/mongodb/WiredTiger.turtle: handle-open: open: Permission denied Raw: [1530772324:204458][15656:0x7fb5cb734a00], wiredtiger_open: /var/lib/mongodb/WiredTiger.turtle: handle-open: open: Permission denied
2018-07-05T14:32:04.204+0800 E STORAGE [initandlisten] WiredTiger error (13) [1530772324:204610][15656:0x7fb5cb734a00], wiredtiger_open: /var/lib/mongodb/WiredTiger.turtle: handle-open: open: Permission denied Raw: [1530772324:204610][15656:0x7fb5cb734a00], wiredtiger_open: /var/lib/mongodb/WiredTiger.turtle: handle-open: open: Permission denied
2018-07-05T14:32:04.204+0800 F STORAGE [initandlisten] Failed to start up WiredTiger under any compatibility version.
2018-07-05T14:32:04.204+0800 F STORAGE [initandlisten] 13: Permission denied
2018-07-05T14:32:04.204+0800 F - [initandlisten] Fatal Assertion 28595 at src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp 194
2018-07-05T14:32:04.204+0800 F - [initandlisten]
***aborting after fassert() failure
but when i tried mongod --auth -f /etc/mongod.conf the server can start and when visit the log file it shows that:
2018-07-05T14:35:34.228+0800 I CONTROL [main] ***** SERVER RESTARTED *****
2018-07-05T14:35:34.239+0800 I CONTROL [initandlisten] MongoDB starting : pid=15665 port=27017 dbpath=/var/lib/mongodb 64-bit host=iZbp1ik57sceo226yjpivxZ
2018-07-05T14:35:34.239+0800 I CONTROL [initandlisten] db version v4.0.0-rc7
2018-07-05T14:35:34.239+0800 I CONTROL [initandlisten] git version: 7230641bb09b1ceb04c3135cf83a5044c4838906
2018-07-05T14:35:34.240+0800 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
2018-07-05T14:35:34.240+0800 I CONTROL [initandlisten] allocator: tcmalloc
2018-07-05T14:35:34.240+0800 I CONTROL [initandlisten] modules: none
2018-07-05T14:35:34.240+0800 I CONTROL [initandlisten] build environment:
2018-07-05T14:35:34.240+0800 I CONTROL [initandlisten] distmod: ubuntu1604
2018-07-05T14:35:34.240+0800 I CONTROL [initandlisten] distarch: x86_64
2018-07-05T14:35:34.240+0800 I CONTROL [initandlisten] target_arch: x86_64
2018-07-05T14:35:34.240+0800 I CONTROL [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "0.0.0.0", port: 27017 }, processManagement: { timeZoneInfo: "/usr/share/zoneinfo" }, security: { authorization: "enabled" }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }
2018-07-05T14:35:34.240+0800 I STORAGE [initandlisten] Detected data files in /var/lib/mongodb created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2018-07-05T14:35:34.240+0800 I STORAGE [initandlisten]
2018-07-05T14:35:34.240+0800 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2018-07-05T14:35:34.240+0800 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem
2018-07-05T14:35:34.240+0800 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=488M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
2018-07-05T14:35:35.005+0800 I STORAGE [initandlisten] WiredTiger message [1530772535:5560][15665:0x7f0ab9512a00], txn-recover: Main recovery loop: starting at 18/8960
2018-07-05T14:35:35.113+0800 I STORAGE [initandlisten] WiredTiger message [1530772535:113878][15665:0x7f0ab9512a00], txn-recover: Recovering log 18 through 19
2018-07-05T14:35:35.179+0800 I STORAGE [initandlisten] WiredTiger message [1530772535:179582][15665:0x7f0ab9512a00], txn-recover: Recovering log 19 through 19
2018-07-05T14:35:35.248+0800 I STORAGE [initandlisten] WiredTiger message [1530772535:248647][15665:0x7f0ab9512a00], txn-recover: Set global recovery timestamp: 0
2018-07-05T14:35:35.283+0800 I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
2018-07-05T14:35:35.311+0800 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2018-07-05T14:35:35.311+0800 I CONTROL [initandlisten]
2018-07-05T14:35:35.312+0800 I CONTROL [initandlisten]
2018-07-05T14:35:35.312+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2018-07-05T14:35:35.312+0800 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2018-07-05T14:35:35.312+0800 I CONTROL [initandlisten]
2018-07-05T14:35:35.312+0800 I CONTROL [initandlisten] ** WARNING: soft rlimits too low. rlimits set to 7856 processes, 65535 files. Number of processes should be at least 32767.5 : 0.5 times number of files.
2018-07-05T14:35:35.312+0800 I CONTROL [initandlisten]
2018-07-05T14:35:35.336+0800 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/var/lib/mongodb/diagnostic.data'
2018-07-05T14:35:35.337+0800 I NETWORK [initandlisten] waiting for connections on port 27017
and the whole config file is as below:
# mongod.conf
# Where and how to store data.
storage:
dbPath: /var/lib/mongodb
journal:
enabled: true
# engine:
# mmapv1:
# wiredTiger:
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
# network interfaces
net:
port: 27017
bindIp: 0.0.0.0
# how the process runs
processManagement:
timeZoneInfo: /usr/share/zoneinfo
#security:
security:
authorization: enabled
#operationProfiling:
#replication:
#sharding:
## Enterprise-Only Options:
#auditLog:
#snmp:
So, what is the matter with it? why the first method can not run it but the second method can start it?
According to #Markus W Mahlberg, and after run these command, the problem has been solved.
[sudo] chown mongodb.mongodb -R /var/lib/mongodb
If you ran the command mongod as root on the server while testing your configuration file, as in:
$ mongod -f /etc/mongod.conf
The mongo server will generate the mongo.lock file and the WiredTiger.lock files and further files in the mongodb folder with root:root ownership as in:
-rw------- 1 mongodb mongodb 36864 Nov 25 12:03 index-95--8062076833940689665.wt
-rw------- 1 mongodb mongodb 45056 Nov 25 12:03 index-96--8062076833940689665.wt
-rw------- 1 mongodb mongodb 36864 Nov 25 12:03 index-99--8062076833940689665.wt
drwx------ 2 mongodb mongodb 4096 Nov 25 15:23 journal/
-rw------- 1 mongodb mongodb 45056 Nov 25 15:32 _mdb_catalog.wt
-rw------- 1 root root 0 Nov 25 15:32 mongod.lock
-rw------- 1 mongodb mongodb 36864 Nov 25 15:32 sizeStorer.wt
-rw------- 1 mongodb mongodb 114 Oct 17 17:41 storage.bson
-rw------- 1 mongodb mongodb 44 Oct 17 17:41 WiredTiger
-rw------- 1 mongodb mongodb 4096 Nov 25 15:32 WiredTigerLAS.wt
-rw------- 1 root root 21 Nov 25 15:22 WiredTiger.lock
-rw------- 1 mongodb mongodb 1201 Nov 25 15:32 WiredTiger.turtle
-rw------- 1 mongodb mongodb 188416 Nov 25 15:32 WiredTiger.wt
The service is most likely configured to run mongod with the mongodb user. which will not have permission to remove, or overwrite the WiredTiger.lock nor the mongod.lock or any other file that were created when mongod was running using the root user. In the case above the /var/lib/mongodb/WiredTiger.turtle
The solution is to reset the ownership of all the files in the folder in the case above the /var/lib/mongodb/ folder to the mongodb user:
$ sudo chown -R mongodb:mongodb /var/lib/mongodb/
That should solve the issue.
On a mac OS
Browse to the data directory you configured when installing mongodb. For ex: data/db where the mongod.lock and WiredTiger.lock are present
sudo chown -R {username}:{groupname} /data/db
Make sure you have stopped any mongo processes
run 'mongod' command
You should now see the prompt which is now ready to accept connections.
I upgraded from debian 6 to debian 8. After that I upgraded MongoDB from ~2.5 to 3.2.9. They seemed to have changed the db path since I could not see any of my databases. I upgraded the dbpath. Stil I can't see any of my databases.
seprst#SESTOWS011:/data/db$ ls
graddays graddays.0 graddays.ns journal local local.0 local.ns mongod.lock mypdb mypdb.0 mypdb.ns
seprst#SESTOWS011:/data/db$ sudo service mongod stop
seprst#SESTOWS011:/data/db$ mongod --dbpath /data/db
2016-08-17T12:02:26.468+0200 I CONTROL [initandlisten] MongoDB starting : pid=22283 port=27017 dbpath=/data/db 64-bit host=SESTOWS011
2016-08-17T12:02:26.468+0200 I CONTROL [initandlisten] db version v3.2.9
2016-08-17T12:02:26.468+0200 I CONTROL [initandlisten] git version: 22ec9e93b40c85fc7cae7d56e7d6a02fd811088c
2016-08-17T12:02:26.468+0200 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1t 3 May 2016
2016-08-17T12:02:26.469+0200 I CONTROL [initandlisten] allocator: tcmalloc
2016-08-17T12:02:26.469+0200 I CONTROL [initandlisten] modules: none
2016-08-17T12:02:26.469+0200 I CONTROL [initandlisten] build environment:
2016-08-17T12:02:26.469+0200 I CONTROL [initandlisten] distmod: debian71
2016-08-17T12:02:26.469+0200 I CONTROL [initandlisten] distarch: x86_64
2016-08-17T12:02:26.469+0200 I CONTROL [initandlisten] target_arch: x86_64
2016-08-17T12:02:26.469+0200 I CONTROL [initandlisten] options: { storage: { dbPath: "/data/db" } }
2016-08-17T12:02:26.513+0200 I - [initandlisten] Detected data files in /data/db created by the 'mmapv1' storage engine, so setting the ac tive storage engine to 'mmapv1'.
2016-08-17T12:02:26.530+0200 I JOURNAL [initandlisten] journal dir=/data/db/journal
2016-08-17T12:02:26.545+0200 I JOURNAL [initandlisten] recover : no journal files present, no recovery needed
2016-08-17T12:02:26.590+0200 I JOURNAL [initandlisten] warning couldn't write to / rename file /data/db/journal/prealloc.0: couldn't open file / data/db/journal/prealloc.0 for writing errno:9 Bad file descriptor
2016-08-17T12:02:26.590+0200 I STORAGE [initandlisten] exception in initAndListen: 13516 couldn't open file /data/db/journal/j._0 for writing er rno:9 Bad file descriptor, terminating
2016-08-17T12:02:26.590+0200 I CONTROL [initandlisten] now exiting
2016-08-17T12:02:26.590+0200 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2016-08-17T12:02:26.590+0200 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2016-08-17T12:02:26.590+0200 I NETWORK [initandlisten] shutdown: going to flush diaglog...
2016-08-17T12:02:26.590+0200 I NETWORK [initandlisten] shutdown: going to close sockets...
2016-08-17T12:02:26.591+0200 I STORAGE [initandlisten] shutdown: waiting for fs preallocator...
2016-08-17T12:02:26.591+0200 I STORAGE [initandlisten] shutdown: final commit...
2016-08-17T12:02:26.591+0200 I STORAGE [initandlisten] shutdown: closing all files...
2016-08-17T12:02:26.591+0200 I STORAGE [initandlisten] closeAllFiles() finished
2016-08-17T12:02:26.591+0200 I CONTROL [initandlisten] dbexit: rc: 100
seprst#SESTOWS011:/data/db$ sudo service mongod start
seprst#SESTOWS011:/data/db$ mongo
MongoDB shell version: 3.2.9
connecting to: test
Server has startup warnings:
2016-08-17T12:02:40.540+0200 I CONTROL [initandlisten]
2016-08-17T12:02:40.540+0200 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2016-08-17T12:02:40.540+0200 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2016-08-17T12:02:40.540+0200 I CONTROL [initandlisten]
> show dbs
local 0.000GB
>
Any suggestions?
there is formatting issue with comment so posting as answer
ps -xa | grep mongod
open config file cat /etc/mongod.conf
for me it's dbPath: /var/lib/mongodb
you can check your settings.
to make changes permanent at your own risk
sudo service mongod stop
sudo ln -s /data/db/ /var/lib/mongodb
sudo chown mongodb:mongodb /data/db/
sudo service mongod start
//test if mongodb user can access new location:
sudo -u mongodb -s cd /data/db/
After I install mongodb via homebrew, I get the following message when I type mongod:
kamflamenco ~ $ mongod
2016-08-02T15:34:39.934-0700 I CONTROL [initandlisten] MongoDB starting : pid=4167 port=27017 dbpath=/data/db 64-bit host=Kenzos-MacBook-Pro.local
2016-08-02T15:34:39.935-0700 I CONTROL [initandlisten] db version v3.2.8
2016-08-02T15:34:39.935-0700 I CONTROL [initandlisten] git version: ed70e33130c977bda0024c125b56d159573dbaf0
2016-08-02T15:34:39.935-0700 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2h 3 May 2016
2016-08-02T15:34:39.935-0700 I CONTROL [initandlisten] allocator: system
2016-08-02T15:34:39.935-0700 I CONTROL [initandlisten] modules: none
2016-08-02T15:34:39.935-0700 I CONTROL [initandlisten] build environment:
2016-08-02T15:34:39.935-0700 I CONTROL [initandlisten] distarch: x86_64
2016-08-02T15:34:39.935-0700 I CONTROL [initandlisten] target_arch: x86_64
2016-08-02T15:34:39.935-0700 I CONTROL [initandlisten] options: {}
2016-08-02T15:34:39.936-0700 I - [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2016-08-02T15:34:39.938-0700 I STORAGE [initandlisten] exception in initAndListen: 98 Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating
2016-08-02T15:34:39.938-0700 I CONTROL [initandlisten] dbexit: rc: 100
I am new to this and I've tried researching on the error. However, I have no luck, including typing
sudo chmod 777
The only time mongod works is if I type sudo in front of it
sudo mongod
But I do not feel this is correct...
remove the mongod.lock file:
sudo rm /data/db/mongod.lock