i made installation of wiredtiger, find cannot start db using standard:
sudo service mongod start
it seems when log file (tail /var/log/mongodb/mongod.log):
2016-08-01t14:48:12.029+0200 control [main] ***** server restarted ***** 2016-08-01t14:48:12.032+0200 control [initandlisten] mongodb starting : pid=1238 port=27017 dbpath=/var/lib/mongodb 64-bit host=xxx 2016-08-01t14:48:12.032+0200 control [initandlisten] db version v3.2.8 2016-08-01t14:48:12.032+0200 control [initandlisten] git version: ed70e33130c977bda0024c125b56d159573dbaf0 2016-08-01t14:48:12.032+0200 control [initandlisten] openssl version: openssl 1.0.2g-fips 1 mar 2016 2016-08-01t14:48:12.032+0200 control [initandlisten] allocator: tcmalloc 2016-08-01t14:48:12.032+0200 control [initandlisten] modules: enterprise 2016-08-01t14:48:12.032+0200 control [initandlisten] build environment: 2016-08-01t14:48:12.032+0200 control [initandlisten] distmod: ubuntu1604 2016-08-01t14:48:12.032+0200 control [initandlisten] distarch: x86_64 2016-08-01t14:48:12.032+0200 control [initandlisten] target_arch: x86_64 2016-08-01t14:48:12.032+0200 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 storage [initandlisten] exception in initandlisten: 98 unable create/open lock file: /var/lib/mongodb/mongod.lock errno:13 permission denied mongod instance running?, terminating 2016-08-01t14:48:12.052+0200 control [initandlisten] dbexit: rc:
100
# mongod.conf # documentation of options, see: # http://docs.mongodb.org/manual/reference/configuration-options/ # , how store data. storage: dbpath: /var/lib/mongodb journal: enabled: true engine: wiredtiger # mmapv1: # wiredtiger: # 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 permissions follows on:
chmod -r 777 /var/log/mongodb chown -r /var/log/mongodb
but nothing makes difference. there no service running. can run command line:
mongod
which gives following:
2016-08-01t15:35:51.291+0200 control [initandlisten] mongodb starting : pid=5776 port=27017 dbpath=/data/db 64-bit host=brett 2016-08-01t15:35:51.291+0200 control [initandlisten] db version v3.2.8 2016-08-01t15:35:51.291+0200 control [initandlisten] git version: ed70e33130c977bda0024c125b56d159573dbaf0 2016-08-01t15:35:51.291+0200 control [initandlisten] openssl version: openssl 1.0.2g-fips 1 mar 2016 2016-08-01t15:35:51.291+0200 control [initandlisten] allocator: tcmalloc 2016-08-01t15:35:51.291+0200 control [initandlisten] modules: enterprise 2016-08-01t15:35:51.291+0200 control [initandlisten] build environment: 2016-08-01t15:35:51.291+0200 control [initandlisten] distmod: ubuntu1604 2016-08-01t15:35:51.291+0200 control [initandlisten] distarch: x86_64 2016-08-01t15:35:51.291+0200 control [initandlisten] target_arch: x86_64 2016-08-01t15:35:51.291+0200 control [initandlisten] options: {} 2016-08-01t15:35:51.311+0200 - [initandlisten] detected data files in /data/db created 'wiredtiger' storage engine, setting active storage engine 'wiredtiger'. 2016-08-01t15:35:51.311+0200 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 control [initandlisten] 2016-08-01t15:35:51.722+0200 control [initandlisten] ** warning: /sys/kernel/mm/transparent_hugepage/enabled 'always'. 2016-08-01t15:35:51.722+0200 control [initandlisten] ** suggest setting 'never' 2016-08-01t15:35:51.722+0200 control [initandlisten] 2016-08-01t15:35:51.722+0200 control [initandlisten] ** warning: /sys/kernel/mm/transparent_hugepage/defrag 'always'. 2016-08-01t15:35:51.722+0200 control [initandlisten] ** suggest setting 'never' 2016-08-01t15:35:51.722+0200 control [initandlisten] 2016-08-01t15:35:51.722+0200 ftdc [initandlisten] initializing full-time diagnostic data capture directory '/data/db/diagnostic.data' 2016-08-01t15:35:51.722+0200 network [hostnamecanonicalizationworker] starting hostname canonicalization worker 2016-08-01t15:35:51.723+0200 network [initandlisten] waiting connections on port 27017
but cannot mongod 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 run following:
mongod --config /etc/mongod.conf
i can connect db mongo
as follows:
mongodb shell version: 3.2.8 connecting to: test server has startup warnings: 2016-08-09t19:46:31.583+0200 control [initandlisten] 2016-08-09t19:46:31.583+0200 control [initandlisten] ** warning: /sys/kernel/mm/transparent_hugepage/enabled 'always'. 2016-08-09t19:46:31.583+0200 control [initandlisten] ** suggest setting 'never' 2016-08-09t19:46:31.583+0200 control [initandlisten] 2016-08-09t19:46:31.583+0200 control [initandlisten] ** warning: /sys/kernel/mm/transparent_hugepage/defrag 'always'. 2016-08-09t19:46:31.583+0200 control [initandlisten] ** suggest setting 'never' 2016-08-09t19:46:31.583+0200 control [initandlisten]
here output 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 tried removing huge files suggested. can never find way service started.
here me running mongod:
2016-08-19t12:53:53.713+0200 control [initandlisten] mongodb starting : pid=9030 port=27017 dbpath=/data/db 64-bit host=xxx 2016-08-19t12:53:53.713+0200 control [initandlisten] db version v3.2.8 2016-08-19t12:53:53.713+0200 control [initandlisten] git version: ed70e33130c977bda0024c125b56d159573dbaf0 2016-08-19t12:53:53.713+0200 control [initandlisten] openssl version: openssl 1.0.2g-fips 1 mar 2016 2016-08-19t12:53:53.713+0200 control [initandlisten] allocator: tcmalloc 2016-08-19t12:53:53.713+0200 control [initandlisten] modules: enterprise 2016-08-19t12:53:53.713+0200 control [initandlisten] build environment: 2016-08-19t12:53:53.713+0200 control [initandlisten] distmod: ubuntu1604 2016-08-19t12:53:53.713+0200 control [initandlisten] distarch: x86_64 2016-08-19t12:53:53.713+0200 control [initandlisten] target_arch: x86_64 2016-08-19t12:53:53.713+0200 control [initandlisten] options: {} 2016-08-19t12:53:53.732+0200 - [initandlisten] detected data files in /data/db created 'wiredtiger' storage engine, setting active storage engine 'wiredtiger'. 2016-08-19t12:53:53.733+0200 storage [initandlisten] exception in initandlisten: 98 unable create/open lock file: /data/db/mongod.lock errno:13 permission denied mongod instance running?, terminating 2016-08-19t12:53:53.733+0200 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 control [initandlisten] mongodb starting : pid=12360 port=27017 dbpath=/data/db 64-bit host=brett 2016-08-19t13:13:47.117+0200 control [initandlisten] db version v3.2.8 2016-08-19t13:13:47.117+0200 control [initandlisten] git version: ed70e33130c977bda0024c125b56d159573dbaf0 2016-08-19t13:13:47.117+0200 control [initandlisten] openssl version: openssl 1.0.2g-fips 1 mar 2016 2016-08-19t13:13:47.117+0200 control [initandlisten] allocator: tcmalloc 2016-08-19t13:13:47.117+0200 control [initandlisten] modules: enterprise 2016-08-19t13:13:47.117+0200 control [initandlisten] build environment: 2016-08-19t13:13:47.117+0200 control [initandlisten] distmod: ubuntu1604 2016-08-19t13:13:47.117+0200 control [initandlisten] distarch: x86_64 2016-08-19t13:13:47.117+0200 control [initandlisten] target_arch: x86_64 2016-08-19t13:13:47.117+0200 control [initandlisten] options: {} 2016-08-19t13:13:47.137+0200 - [initandlisten] detected data files in /data/db created 'wiredtiger' storage engine, setting active storage engine 'wiredtiger'. 2016-08-19t13:13:47.137+0200 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 control [initandlisten] ** warning: running process root user, not recommended. 2016-08-19t13:13:47.548+0200 control [initandlisten] 2016-08-19t13:13:47.549+0200 control [initandlisten] 2016-08-19t13:13:47.549+0200 control [initandlisten] ** warning: /sys/kernel/mm/transparent_hugepage/enabled 'always'. 2016-08-19t13:13:47.549+0200 control [initandlisten] ** suggest setting 'never' 2016-08-19t13:13:47.549+0200 control [initandlisten] 2016-08-19t13:13:47.549+0200 control [initandlisten] ** warning: /sys/kernel/mm/transparent_hugepage/defrag 'always'. 2016-08-19t13:13:47.549+0200 control [initandlisten] ** suggest setting 'never' 2016-08-19t13:13:47.549+0200 control [initandlisten] 2016-08-19t13:13:47.549+0200 ftdc [initandlisten] initializing full-time diagnostic data capture directory '/data/db/diagnostic.data' 2016-08-19t13:13:47.549+0200 network [hostnamecanonicalizationworker] starting hostname canonicalization worker 2016-08-19t13:13:47.550+0200 network [initandlisten] waiting connections on port 27017
but still no joy getting mongo service :(
here /etc/init/mongod.conf
# ubuntu upstart file @ /etc/init/mongod.conf # recommended ulimit values mongod or mongos # see http://docs.mongodb.org/manual/reference/ulimit/#recommended-settings # limit fsize unlimited unlimited limit cpu unlimited unlimited limit unlimited unlimited limit nofile 64000 64000 limit rss unlimited unlimited limit nproc 64000 64000 kill timeout 300 # wait 300s between sigterm , sigkill. pre-start script daemonuser=${daemonuser:-mongodb} if [ ! -d /var/lib/mongodb ]; mkdir -p /var/lib/mongodb && chown mongodb:mongodb /var/lib/mongodb fi if [ ! -d /var/log/mongodb ]; 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 ]; . /etc/default/mongod; fi # handle numa access cpus (server-3574) # verifies existence of numactl testing command works numactl_args="--interleave=all" if numactl >/dev/null 2>/dev/null && numactl $numactl_args ls / >/dev/null 2>/dev/null 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" ] 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 problem process cannot create /var/lib/mongodb/mongod.lock
you need understand (as root) 'service mongod start'
(when use sudo -command
, command
executed root
), process (mongod
) started user 'mongod'
. so, directory /var/lib/mongodb
must exist , writable 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')
Comments
Post a Comment