I had issues while deploying Mongo on Linux, running on AWS.
vim /etc/yum.repos.d/mongodb-org-3.0.repo
sudo yum install -y mongodb-org
Error: Package: mongodb-org-tools-3.0.12-1.amzn1.x86_64 (Mongodb-org-3.0)
Requires: libgcc_s.so.1(GCC_3.0)(64bit)
Error: Package: mongodb-org-mongos-3.0.12-1.amzn1.x86_64 (Mongodb-org-3.0)
Requires: /bin/bash
Error: Package: mongodb-org-server-3.0.12-1.amzn1.x86_64 (Mongodb-org-3.0)
Requires: openssl
Hence I downloaded the tar file for mongodb and untar using
tar -xvzf mongodb-linux-x86_64-amazon-3.2.7.tgz
When I go into directory of bin and use mongod or mongo command it works, however try to use as service, it gives error.
cd mongodb-linux-x86_64-amazon-3.2.7/bin
root#ip-172-31-43-40:/mongodb-linux-x86_64-amazon-3.2.7/bin# service mongod start
mongod: unrecognized service
root#ip-172-31-43-40:/mongodb-linux-x86_64-amazon-3.2.7/bin#export PATH=$PATH:/mongodb-linux-x86_64-ubuntu1404-3.2.7/bin/
root#ip-172-31-43-40:/mongodb-linux-x86_64-ubuntu1404-3.2.7/bin# mongod
2016-06-25T10:30:48.591+0000 I CONTROL [initandlisten] MongoDB starting : pid=21208 port=27017 dbpath=/data/db 64-bit host=ip-172-31-43-40
2016-06-25T10:30:48.591+0000 I CONTROL [initandlisten] db version v3.2.7
2016-06-25T10:30:48.591+0000 I CONTROL [initandlisten] git version: 4249c1d2b5999ebbf1fdf3bc0e0e3b3ff5c0aaf2
2016-06-25T10:30:48.591+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014
2016-06-25T10:30:48.591+0000 I CONTROL [initandlisten] allocator: tcmalloc
2016-06-25T10:30:48.591+0000 I CONTROL [initandlisten] modules: none
2016-06-25T10:30:48.591+0000 I CONTROL [initandlisten] build environment:
2016-06-25T10:30:48.591+0000 I CONTROL [initandlisten] distmod: ubuntu1404
2016-06-25T10:30:48.591+0000 I CONTROL [initandlisten] distarch: x86_64
2016-06-25T10:30:48.591+0000 I CONTROL [initandlisten] target_arch: x86_64
2016-06-25T10:30:48.591+0000 I CONTROL [initandlisten] options: {}
2016-06-25T10:30:48.614+0000 I - [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2016-06-25T10:30:48.614+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-06-25T10:30:48.987+0000 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2016-06-25T10:30:48.987+0000 I CONTROL [initandlisten]
2016-06-25T10:30:48.987+0000 I CONTROL [initandlisten]
2016-06-25T10:30:48.987+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2016-06-25T10:30:48.987+0000 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2016-06-25T10:30:48.987+0000 I CONTROL [initandlisten]
2016-06-25T10:30:48.987+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2016-06-25T10:30:48.987+0000 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2016-06-25T10:30:48.987+0000 I CONTROL [initandlisten]
2016-06-25T10:30:48.988+0000 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
2016-06-25T10:30:48.988+0000 I NETWORK [initandlisten] waiting for connections on port 27017
2016-06-25T10:30:48.988+0000 I NETWORK [HostnameCanonicalizationWorker] Starting hostname canonicalization worker
2016-06-25T10:31:30.997+0000 I NETWORK [initandlisten] connection accepted from 127.0.0.1:56229 #1 (1 connection now open)
In other terminal/console
root#ip-172-31-43-40:/mongodb-linux-x86_64-ubuntu1404-3.2.7/bin# mongoMongoDB shell version: 3.2.7
connecting to: test
Server has startup warnings:
2016-06-25T10:30:48.987+0000 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2016-06-25T10:30:48.987+0000 I CONTROL [initandlisten]
2016-06-25T10:30:48.987+0000 I CONTROL [initandlisten]
2016-06-25T10:30:48.987+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2016-06-25T10:30:48.987+0000 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2016-06-25T10:30:48.987+0000 I CONTROL [initandlisten]
2016-06-25T10:30:48.987+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2016-06-25T10:30:48.987+0000 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2016-06-25T10:30:48.987+0000 I CONTROL [initandlisten]
>
Unable to run mongod as a service...Hence want to know the steps needed for daemon to be started and kept running continuously (like a service)
It appears as if the pid folder and file permissions don't work with the default daemon.
The simplest solution is disable the pid file by just putting a # in front of the line in the config file.
vi /etc/mongod.conf
find the line that says pidfilepath=/var/run/mongodb/mongod.pid and change it accordingly.
# pidfilepath=/var/run/mongodb/mongod.pid
For information on what commenting it out does check here.
http://docs.mongodb.org/manual/reference/configuration-options/#processManagement.pidFilePath
Related
Trying to initialize mongod, but getting below error. I know DB path is not set correctly. How can I set DB path in Mac?
The path I'm trying to set is "/Users/kopal/Downloads/mongodb-macos-x86_64-4.2.1/bin/data"
2019-11-02T22:11:51.748-0400 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2019-11-02T22:11:51.777-0400 I CONTROL [initandlisten] MongoDB starting : pid=2292 port=27017 dbpath=/data/db 64-bit host=Kopals-MacBook-Air.local
2019-11-02T22:11:51.777-0400 I CONTROL [initandlisten] db version v4.2.1
2019-11-02T22:11:51.777-0400 I CONTROL [initandlisten] git version: edf6d45851c0b9ee15548f0f847df141764a317e
2019-11-02T22:11:51.777-0400 I CONTROL [initandlisten] allocator: system
2019-11-02T22:11:51.777-0400 I CONTROL [initandlisten] modules: none
2019-11-02T22:11:51.777-0400 I CONTROL [initandlisten] build environment:
2019-11-02T22:11:51.777-0400 I CONTROL [initandlisten] distarch: x86_64
2019-11-02T22:11:51.777-0400 I CONTROL [initandlisten] target_arch: x86_64
2019-11-02T22:11:51.778-0400 I CONTROL [initandlisten] options: {}
2019-11-02T22:11:51.786-0400 I STORAGE [initandlisten] exception in initAndListen: NonExistentPath: Data directory /data/db not found., terminating
2019-11-02T22:11:51.789-0400 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2019-11-02T22:11:51.789-0400 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2019-11-02T22:11:51.789-0400 I - [initandlisten] Stopping further Flow Control ticket acquisitions.
2019-11-02T22:11:51.790-0400 I CONTROL [initandlisten] now exiting
2019-11-02T22:11:51.790-0400 I CONTROL [initandlisten] shutting down with code:100```
When you start mongod, add the --dbpath option such as:
mongod --dbpath "/Users/kopal/Downloads/mongodb-macos-x86_64-4.2.1/bin/data"
or set the path in the mongod.conf as follows.
storage:
dbPath: "/Users/kopal/Downloads/mongodb-macos-x86_64-4.2.1/bin/data"
I am trying to connect to the mongo server, using the "mongo" command in the command prompt and this error is showing: "exception: connect failed"
Here is how I am trying to do it:
enter image description here
This is the mongodb.log
2018-03-27T14:00:19.299+0800 I CONTROL [main] ***** SERVER RESTARTED *****
2018-03-27T14:00:19.647+0800 I CONTROL [main] Trying to start Windows service 'MongoDB'
2018-03-27T14:00:19.648+0800 I CONTROL [initandlisten] MongoDB starting : pid=10480 port=27017 dbpath=d:\mongodbData\db 64-bit host=DESKTOP-KEA31I3
2018-03-27T14:00:19.648+0800 I CONTROL [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
2018-03-27T14:00:19.648+0800 I CONTROL [initandlisten] db version v3.6.3
2018-03-27T14:00:19.648+0800 I CONTROL [initandlisten] git version: 9586e557d54ef70f9ca4b43c26892cd55257e1a5
2018-03-27T14:00:19.648+0800 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1u-fips 22 Sep 2016
2018-03-27T14:00:19.648+0800 I CONTROL [initandlisten] allocator: tcmalloc
2018-03-27T14:00:19.648+0800 I CONTROL [initandlisten] modules: none
2018-03-27T14:00:19.648+0800 I CONTROL [initandlisten] build environment:
2018-03-27T14:00:19.649+0800 I CONTROL [initandlisten] distmod: 2008plus-ssl
2018-03-27T14:00:19.649+0800 I CONTROL [initandlisten] distarch: x86_64
2018-03-27T14:00:19.649+0800 I CONTROL [initandlisten] target_arch: x86_64
2018-03-27T14:00:19.649+0800 I CONTROL [initandlisten] options: { service: true, storage: { dbPath: "d:\mongodbData\db" }, systemLog: { destination: "file", logAppend: true, path: "d:\mongodbData\log\mongodb.log" } }
2018-03-27T14:00:19.651+0800 I - [initandlisten] Detected data files in d:\mongodbData\db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2018-03-27T14:00:19.651+0800 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=7632M,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-03-27T14:00:19.834+0800 I STORAGE [initandlisten] WiredTiger message [1522130419:833660][10480:140722874245456], txn-recover: Main recovery loop: starting at 4/6272
2018-03-27T14:00:19.970+0800 I STORAGE [initandlisten] WiredTiger message [1522130419:970024][10480:140722874245456], txn-recover: Recovering log 4 through 5
2018-03-27T14:00:20.046+0800 I STORAGE [initandlisten] WiredTiger message [1522130420:46191][10480:140722874245456], txn-recover: Recovering log 5 through 5
2018-03-27T14:00:20.172+0800 I CONTROL [initandlisten]
2018-03-27T14:00:20.172+0800 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2018-03-27T14:00:20.172+0800 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2018-03-27T14:00:20.172+0800 I CONTROL [initandlisten]
2018-03-27T14:00:20.173+0800 I CONTROL [initandlisten] ** WARNING: This server is bound to localhost.
2018-03-27T14:00:20.173+0800 I CONTROL [initandlisten] ** Remote systems will be unable to connect to this server.
2018-03-27T14:00:20.173+0800 I CONTROL [initandlisten] ** Start the server with --bind_ip <address> to specify which IP
2018-03-27T14:00:20.173+0800 I CONTROL [initandlisten] ** addresses it should serve responses from, or with --bind_ip_all to
2018-03-27T14:00:20.173+0800 I CONTROL [initandlisten] ** bind to all interfaces. If this behavior is desired, start the
2018-03-27T14:00:20.173+0800 I CONTROL [initandlisten] ** server with --bind_ip 127.0.0.1 to disable this warning.
2018-03-27T14:00:20.173+0800 I CONTROL [initandlisten]
2018-03-27T14:00:20.173+0800 I CONTROL [initandlisten]
2018-03-27T14:00:20.173+0800 I CONTROL [initandlisten] ** WARNING: The file system cache of this machine is configured to be greater than 40% of the total memory. This can lead to increased memory pressure and poor performance.
2018-03-27T14:00:20.174+0800 I CONTROL [initandlisten] See http://dochub.mongodb.org/core/wt-windows-system-file-cache
2018-03-27T14:00:20.174+0800 I CONTROL [initandlisten]
2018-03-27T14:00:20.402+0800 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory 'd:/mongodbData/db/diagnostic.data'
2018-03-27T14:00:20.404+0800 I NETWORK [initandlisten] waiting for connections on port 27017
2018-03-27T14:00:20.404+0800 I STORAGE [initandlisten] Service running
Please help me. How to fix it
Run this following command :
sudo service mongodb stop
sudo rm /var/lib/mongodb/mongod.lock
sudo service mongod restart
mongo
2017-05-11T12:03:49.700+0530 I CONTROL [initandlisten] MongoDB starting : pid=5716 port=27017 dbpath=/data/db/ 64-bit host=localhost
2017-05-11T12:03:49.700+0530 I CONTROL [initandlisten] db version v3.2.0
2017-05-11T12:03:49.700+0530 I CONTROL [initandlisten] git version: 45d947729a0315accb6d4f15a6b06be6d9c19fe7
2017-05-11T12:03:49.700+0530 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014
2017-05-11T12:03:49.700+0530 I CONTROL [initandlisten] allocator: tcmalloc
2017-05-11T12:03:49.700+0530 I CONTROL [initandlisten] modules: none
2017-05-11T12:03:49.700+0530 I CONTROL [initandlisten] build environment:
2017-05-11T12:03:49.700+0530 I CONTROL [initandlisten] distmod: ubuntu1404
2017-05-11T12:03:49.700+0530 I CONTROL [initandlisten] distarch: x86_64
2017-05-11T12:03:49.700+0530 I CONTROL [initandlisten] target_arch: x86_64
2017-05-11T12:03:49.700+0530 I CONTROL [initandlisten] options: { storage: { dbPath: "/data/db/" } }
2017-05-11T12:03:49.724+0530 E NETWORK [initandlisten] Failed to unlink socket file /tmp/mongodb-27017.sock errno:1 Operation not permitted
2017-05-11T12:03:49.724+0530 I - [initandlisten] Fatal Assertion 28578
2017-05-11T12:03:49.724+0530 I - [initandlisten]
***aborting after fassert() failure`enter code here`
I am not able to start Mongodb server i tried using service as well and using --dbpath as well i don't know what is the issue. i tried to delete journal files as well but that didn't work
Try to delete the file /tmp/mongodb-27017.sock manually and restart the process.
Have you tried starting it with Sudo from the terminal like so
sudo mongod
this will require your system username and password
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.
I updated mongo to version 3.2 now I am getting this error. Earlier I was not getting error. Only after updating mongo I am getting this error. I even tried to stop and start the mongod service again but still it is showing the same error.
rahul ~ $ mongod
2016-01-10T23:39:51.696+0530 I CONTROL [initandlisten] MongoDB starting : pid=6630 port=27017 dbpath=/data/db 64-bit host=rahulcomp24-HP-ENVY-15-Notebook-PC
2016-01-10T23:39:51.696+0530 I CONTROL [initandlisten] db version v3.2.0
2016-01-10T23:39:51.696+0530 I CONTROL [initandlisten] git version: 45d947729a0315accb6d4f15a6b06be6d9c19fe7
2016-01-10T23:39:51.696+0530 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014
2016-01-10T23:39:51.696+0530 I CONTROL [initandlisten] allocator: tcmalloc
2016-01-10T23:39:51.696+0530 I CONTROL [initandlisten] modules: none
2016-01-10T23:39:51.696+0530 I CONTROL [initandlisten] build environment:
2016-01-10T23:39:51.696+0530 I CONTROL [initandlisten] distmod: ubuntu1404
2016-01-10T23:39:51.696+0530 I CONTROL [initandlisten] distarch: x86_64
2016-01-10T23:39:51.696+0530 I CONTROL [initandlisten] target_arch: x86_64
2016-01-10T23:39:51.696+0530 I CONTROL [initandlisten] options: {}
2016-01-10T23:39:51.717+0530 E NETWORK [initandlisten] listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017
2016-01-10T23:39:51.717+0530 E NETWORK [initandlisten] addr already in use
2016-01-10T23:39:51.717+0530 E STORAGE [initandlisten] Failed to set up sockets during startup.
2016-01-10T23:39:51.717+0530 I CONTROL [initandlisten] dbexit: rc: 48
`
rahul ~ $ mongo
MongoDB shell version: 3.2.0
connecting to: test
Server has startup warnings:
2016-01-10T23:38:16.095+0530 I CONTROL [initandlisten]
2016-01-10T23:38:16.095+0530 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2016-01-10T23:38:16.095+0530 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2016-01-10T23:38:16.095+0530 I CONTROL [initandlisten]
2016-01-10T23:38:16.095+0530 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2016-01-10T23:38:16.095+0530 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2016-01-10T23:38:16.095+0530 I CONTROL [initandlisten]
Find the process running on port 27017:
C:\Users\hughes> netstat -aon | findstr 27017
TCP 0.0.0.0:27017 0.0.0.0:0 LISTENING 3344
The last column shows the PID (3344). Find the process name for that PID:
C:\Users\hughes> tasklist /fi "pid eq 3344"
Image Name PID Session Name Session# Mem Usage
========================= ======== ================ =========== ============
VirtualBox.exe 3344 Console 1 101,908 K
For me it turned out that VirtualBox's port forwarding was the issue.
check if db in running, run:
ps aux | grep mongo
locate the db (ex. here is 77071) and kill it, run:
kill -9 77071
so the mongod output tells
listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017"
which means some process is already using the same socet. For instance, if I try to run mongod when its already running, I get exactly this output. Are you sure that this is not your case? I would guess so, as the mongo shell seems to connect successfully...