While trying to access the mongodb I am getting error that connection is failed
while running mongod command I am getting
2019-02-25T11:05:05.870+0530 I CONTROL [initandlisten] MongoDB
starting : pid=2580 port=27017 dbpath=/data/db 64-bit host=gten
2019-02-25T11:05:05.870+0530 I CONTROL [initandlisten] db version
v3.6.3
2019-02-25T11:05:05.870+0530 I CONTROL [initandlisten] git
version: 9586e557d54ef70f9ca4b43c26892cd55257e1a5
2019-02-25T11:05:05.870+0530 I CONTROL [initandlisten] OpenSSL
version: OpenSSL 1.1.0g 2 Nov 2017
2019-02-25T11:05:05.870+0530 I CONTROL [initandlisten] allocator:
tcmalloc
2019-02-25T11:05:05.870+0530 I CONTROL [initandlisten] modules:
none
2019-02-25T11:05:05.870+0530 I CONTROL [initandlisten] build
environment:
2019-02-25T11:05:05.871+0530 I CONTROL [initandlisten]
distarch: x86_64
2019-02-25T11:05:05.871+0530 I CONTROL [initandlisten]
target_arch: x86_64
2019-02-25T11:05:05.871+0530 I CONTROL [initandlisten] options:
{}
2019-02-25T11:05:05.962+0530 I STORAGE [initandlisten] exception
in initAndListen: IllegalOperation: Attempted to create a lock
file on a read-only directory: /data/db, terminating
2019-02-25T11:05:05.962+0530 I CONTROL [initandlisten] now
exiting
2019-02-25T11:05:05.962+0530 I CONTROL [initandlisten] shutting
down with code:100
and while I run mongo command, I am getting
MongoDB shell version v4.0.6
connecting to: mongodb://127.0.0.1:27017/?gssapiServiceName=mongodb
2019-02-25T11:16:44.802+0530 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect#src/mongo/shell/mongo.js:343:13
#(connect):1:6
exception: connect failed
I dont know what's the issue I have follwe the [https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/] and [https://www.howtoforge.com/tutorial/install-mongodb-on-ubuntu-16.04/]
to install the mongo.
Config:
I am using UBUNTU 18.04.
Any help is appreciated i have gone through many answers and tried all but still facing the same issue.Thanks in advance
After doing a lot of stuff I am getting
2019-02-25T18:52:27.197+0530 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2019-02-25T18:52:27.200+0530 I CONTROL [initandlisten] MongoDB starting : pid=27390 port=27017 dbpath=/data/db 64-bit host=gten
2019-02-25T18:52:27.200+0530 I CONTROL [initandlisten] db version v4.0.6
2019-02-25T18:52:27.200+0530 I CONTROL [initandlisten] git version: caa42a1f75a56c7643d0b68d3880444375ec42e3
2019-02-25T18:52:27.200+0530 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.1.0g 2 Nov 2017
2019-02-25T18:52:27.200+0530 I CONTROL [initandlisten] allocator: tcmalloc
2019-02-25T18:52:27.200+0530 I CONTROL [initandlisten] modules: none
2019-02-25T18:52:27.200+0530 I CONTROL [initandlisten] build environment:
2019-02-25T18:52:27.200+0530 I CONTROL [initandlisten] distmod: ubuntu1804
2019-02-25T18:52:27.200+0530 I CONTROL [initandlisten] distarch: x86_64
2019-02-25T18:52:27.200+0530 I CONTROL [initandlisten] target_arch: x86_64
2019-02-25T18:52:27.200+0530 I CONTROL [initandlisten] options: {}
2019-02-25T18:52:27.200+0530 E STORAGE [initandlisten] Failed to set up listener: SocketException: Address already in use
2019-02-25T18:52:27.200+0530 I CONTROL [initandlisten] now exiting
2019-02-25T18:52:27.200+0530 I CONTROL [initandlisten] shutting down with code:48
If you face this issue It means you are trying to connect mongo shall without
running server on local which give this problem
Some system are not run mongo service automatically on start of machine.
So you need to start it manually.
Run this command to run service on every time when you start your machine or whenever you want to use mongo
sudo service mongod start
// or
sudo systemctl start mongod
Run sudo service mongod status and see what it returns.
If it is stopped,
run sudo service mongod start to start the mongodb and try connecting to it.
If sudo service mongod start is giving a error then
Create the file /lib/systemd/system/mongod.service with the following content:
[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target
[Service]
User=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf
[Install]
WantedBy=multi-user.target
If you still persist error please share console error. On start, we may help you better.
As per the error, message the user trying to start the mongod process don't have write access to /data/db folder.
Run the following command to enable the user to write to /data/db folder
sudo chown -R $USER:$USER /data/db
or create a new folder with current users permission and start mongod with --dbpath option
mkdir mydata/db
mongod --dbpath mydata/db
Try this one. This may help.
sudo chmod 777 /data/db
Related
Use case:
I want to start SQL Server via docker on my mac for test and dev purposes.
As I do not want to loose my databases switching docker containers I want to use volumes.
Using docker volumes I can do that.
docker run --name 'mssql' -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=SuperSecret' -p 1433:1433 -v mssqldata:/var/opt/mssql -d mcr.microsoft.com/mssql/server
But on mac the volume data is also stored inside the VM.
So next I tried to setup a docker compose configuration to store files on my favorite place.
version: '3'
volumes:
dbdata:
driver: local
driver_opts:
type: 'none'
o: 'bind'
device: '/Users/rausch/Documents/docker-volumes/mssql/data'
services:
sql1:
image: "mcr.microsoft.com/mssql/server"
ports:
- 1433:1433
environment:
PATH: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
ACCEPT_EULA: Y
SA_PASSWORD: 1sa!1234
MSSQL_PID: Standard
volumes:
- dbdata:/var/opt/mssql
Starting this with
docker compose -f myconfig.yml up
The sql server starts and start copy the files to my defined location
But the docker image exists with error.
Here the output:
Creating volume "documents_dbdata" with local driver
Creating documents_sql1_1 ... done
Attaching to documents_sql1_1
sql1_1 | SQL Server 2019 will run as non-root by default.
sql1_1 | This container is running as user mssql.
sql1_1 | To learn more visit https://go.microsoft.com/fwlink/?linkid=2099216.
sql1_1 | 2020-05-30 07:27:18.60 Server Setup step is copying system data file 'C:\templatedata\master.mdf' to '/var/opt/mssql/data/master.mdf'.
2020-05-30 07:27:19.67 Server Did not find an existing master data file /var/opt/mssql/data/master.mdf, copying the missing default master and other system database files. If you have moved the database location, but not moved the database files, startup may fail. To repair: shutdown SQL Server, move the master database to configured location, and restart.
2020-05-30 07:27:19.70 Server Setup step is copying system data file 'C:\templatedata\mastlog.ldf' to '/var/opt/mssql/data/mastlog.ldf'.
2020-05-30 07:27:19.79 Server Setup step is copying system data file 'C:\templatedata\model.mdf' to '/var/opt/mssql/data/model.mdf'.
2020-05-30 07:27:19.98 Server Setup step is copying system data file 'C:\templatedata\modellog.ldf' to '/var/opt/mssql/data/modellog.ldf'.
2020-05-30 07:27:20.17 Server Setup step is copying system data file 'C:\templatedata\msdbdata.mdf' to '/var/opt/mssql/data/msdbdata.mdf'.
2020-05-30 07:27:20.47 Server Setup step is copying system data file 'C:\templatedata\msdblog.ldf' to '/var/opt/mssql/data/msdblog.ldf'.
2020-05-30 07:27:20.55 Server Setup step is FORCE copying system data file 'C:\templatedata\model_replicatedmaster.mdf' to '/var/opt/mssql/data/model_replicatedmaster.mdf'.
2020-05-30 07:27:20.70 Server Setup step is FORCE copying system data file 'C:\templatedata\model_replicatedmaster.ldf' to '/var/opt/mssql/data/model_replicatedmaster.ldf'.
2020-05-30 07:27:20.78 Server Setup step is FORCE copying system data file 'C:\templatedata\model_msdbdata.mdf' to '/var/opt/mssql/data/model_msdbdata.mdf'.
2020-05-30 07:27:21.02 Server Setup step is FORCE copying system data file 'C:\templatedata\model_msdblog.ldf' to '/var/opt/mssql/data/model_msdblog.ldf'.
2020-05-30 07:27:22.99 Server Microsoft SQL Server 2019 (RTM-CU4) (KB4548597) - 15.0.4033.1 (X64)
sql1_1 Mar 14 2020 16:10:35
sql1_1 Copyright (C) 2019 Microsoft Corporation
sql1_1 Standard Edition (64-bit) on Linux (Ubuntu 18.04.4 LTS) <X64>
2020-05-30 07:27:23.01 Server UTC adjustment: 0:00
2020-05-30 07:27:23.02 Server (c) Microsoft Corporation.
2020-05-30 07:27:23.03 Server All rights reserved.
2020-05-30 07:27:23.04 Server Server process ID is 36.
2020-05-30 07:27:23.05 Server Logging SQL Server messages in file '/var/opt/mssql/log/errorlog'.
2020-05-30 07:27:23.06 Server Registry startup parameters:
sql1_1 -d /var/opt/mssql/data/master.mdf
sql1_1 -l /var/opt/mssql/data/mastlog.ldf
sql1_1 -e /var/opt/mssql/log/errorlog
2020-05-30 07:27:23.10 Server Error: 17113, Severity: 16, State: 1.
2020-05-30 07:27:23.10 Server Error 87(The parameter is incorrect.) occurred while opening file '/var/opt/mssql/data/master.mdf' to obtain configuration information at startup. An invalid startup option might have caused the error. Verify your startup options, and correct or remove them if necessary.
documents_sql1_1 exited with code 1
So, anyone can tell me what I do wrong?
I was able to get it to start on macOS using a Docker volume. Note my compose.yml file requires at least version 3.2 to allow the service's volumes definition to work:
version: "3.2"
services:
sql1:
image: "mcr.microsoft.com/mssql/server"
ports:
- 1433:1433
environment:
PATH: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
ACCEPT_EULA: Y
SA_PASSWORD: 1sa!1234
MSSQL_PID: Standard
volumes:
- type: volume
source: mssql
target: /var/opt/mssql
volumes:
mssql:
external:
name: mssql
I then launched the container with:
$ docker volume create mssql
mssql
$ docker volume inspect mssql
[
{
"CreatedAt": "2020-05-30T09:36:31Z",
"Driver": "local",
"Labels": {},
"Mountpoint": "/var/lib/docker/volumes/mssql/_data",
"Name": "mssql",
"Options": {},
"Scope": "local"
}
]
$ docker-compose -f compose.yml up
# lots of startup log...
Hope this helps.
I have MacOs Catalina version 10.15.5 and I installed mongoDB following the steps indicated at their site https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/ using Homebrew. When I check my mongoDB if its correctly installed I use which mongo command and I get /usr/local/bin/mongo response. When I use mongo --version and mongod --version I get:
MongoDB shell version v4.2.7
git version: 51d9fe12b5d19720e72dcd7db0f2f17dd9a19212
allocator: system
modules: none
build environment:
distarch: x86_64
target_arch: x86_64
and
db version v4.2.7
git version: 51d9fe12b5d19720e72dcd7db0f2f17dd9a19212
allocator: system
modules: none
build environment:
distarch: x86_64
target_arch: x86_64
respectevely which I think it means its correctly installed and should work.
But when I open terminal and run the command brew services start mongodb-community#4.2 as indicated on the site I get:
Error: undefined method `resolve_alias' for Formula:Class
/usr/local/bin/brew-services.rb:154:in `service'
/usr/local/bin/brew-services.rb:203:in `check'
/usr/local/bin/brew-services.rb:193:in `run!'
/usr/local/bin/brew-services.rb:397:in `<top (required)>'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/usr/local/Homebrew/Library/Homebrew/utils.rb:81:in `require?'
/usr/local/Homebrew/Library/Homebrew/brew.rb:112:in `<main>'
NOTE: my brew is updated and upgraded successfully!
I searched on the internet any solution but I cant find anything that solves the problem... If anyone had faced similar problem please explain step by step and with details how you had solved it?!?!
If I directly run command mongod I get:
2020-06-04T01:19:41.351+0200 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2020-06-04T01:19:41.355+0200 W ASIO [main] No TransportLayer configured during NetworkInterface startup
2020-06-04T01:19:41.355+0200 I CONTROL [initandlisten] MongoDB starting : pid=24712 port=27017 dbpath=/data/db 64-bit host=Air-de-Ruslan.home
2020-06-04T01:19:41.355+0200 I CONTROL [initandlisten] db version v4.2.7
2020-06-04T01:19:41.355+0200 I CONTROL [initandlisten] git version: 51d9fe12b5d19720e72dcd7db0f2f17dd9a19212
2020-06-04T01:19:41.355+0200 I CONTROL [initandlisten] allocator: system
2020-06-04T01:19:41.355+0200 I CONTROL [initandlisten] modules: none
2020-06-04T01:19:41.355+0200 I CONTROL [initandlisten] build environment:
2020-06-04T01:19:41.355+0200 I CONTROL [initandlisten] distarch: x86_64
2020-06-04T01:19:41.355+0200 I CONTROL [initandlisten] target_arch: x86_64
2020-06-04T01:19:41.355+0200 I CONTROL [initandlisten] options: {}
2020-06-04T01:19:41.355+0200 E NETWORK [initandlisten] Failed to unlink socket file /tmp/mongodb-27017.sock Permission denied
2020-06-04T01:19:41.355+0200 F - [initandlisten] Fatal Assertion 40486 at src/mongo/transport/transport_layer_asio.cpp 684
2020-06-04T01:19:41.355+0200 F - [initandlisten]
***aborting after fassert() failure
and if I run directly command mongo I get:
MongoDB shell version v4.2.7
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
2020-06-04T01:21:20.317+0200 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect#src/mongo/shell/mongo.js:341:17
#(connect):2:6
2020-06-04T01:21:20.320+0200 F - [main] exception: connect failed
2020-06-04T01:21:20.320+0200 E - [main] exiting with code 1
SOLVED
I had to remove /usr/local/bin/brew-services.rb with the command
rm /usr/local/bin/brew-services.rb it could ask for permissions so add
sudo rm /usr/local/bin/brew-services.rb.
After that I tried running brew services start mongodb-community#4.2 and I got
Successfully started mongodb-community (label: homebrew.mxcl.mongodb-commu
but when I put mongo from different terminal to start the shell I got
Socket exception errorso I checked also the mongod.log file and I saw it was a socket issue so I tried
ls -ls /tmp/mongodb-27017.sock
and I got
0 srwx------ 1 root root 0 June 04 14:51 /tmp/mongodb-27017.sock
that means the owner is root and mongodb cant access it so I did
sudo rm -rf /tmp/mongodb-27017.sock
to delete the file and then start again mongodb with
brew services start mongodb-community#4.2 that created new .sock file whose owner is directly mongodb or the actual user whoami and when I checked again
ls -lsah /tmp/mongodb-27017.sock
I proved I am the owner and then I could open new terminal and run mongo and get in with enabled connection and use the shell!
Tested on macos Big Sur and mongodb-community#5.0.1
If you're using homebrew and upgraded to mongodb-community#5.0, you may encounter with error when starting the mongodb-community service.
Use rm -rf /usr/local/var/mongodb to remove previous dbpath folder if exists then create it again using cd /usr/local/var && mkdir mongodb.
Then brew services start mongodb-community should work fine.
On MacOS Big Sur (tested for mongodb-community#5.0), the following always returns an error (which means mongodb-community service will be loaded automatically) :
~ brew services start mongodb-community
mongodb-community error zaffer /Users/zaffer/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist
By default mongodb-community configuration is stored in /usr/local/etc/mongod.conf
By default the dbpath parameter is set as /usr/local/var/mongodb
On analyzing the logs, I found that the problem is mostly related to permissions of this folder /usr/local/var/mongodb
The following worked for me :
~ cd /usr/local/var/mongodb
~ sudo chown -R $(whoami) .
~ cd ..
~ sudo chown -R $(whoami) mongodb
~ brew services restart mongodb-community
If you are still facing problems, I suggest changing file permissions of all files of this folder (/usr/local/var/mongodb) :
~ chmod -R 777 /usr/local/var/mongodb
~ brew services restart mongodb-community
or use sudo if permission is denied
~ sudo chmod -R 777 /usr/local/var/mongodb
~ brew services restart mongodb-community
If you are still facing issues, observe the errors when running mongod as a background process using one of the following :
~ mongod
~ mongod --dbpath /usr/local/var/mongodb
~ mongod --config /usr/local/etc/mongod.conf
You may also encounter problems when upgrading from a lower version of mongodb-community, for eg. upgrading from 3.6 to 5.0, in my case, I was inclined towards saving the existing databases, otherwise I could have created a new folder for mongodb data, and updated the dbpath in /usr/local/etc/mongod.conf configuration file.
The recommended way to do this is to do an incremental upgrade, i.e. upgrade from 3.6 to 4.0, then 4.0 to 4.4, then 4.4 to 5.0. What this does is it sets the recommended compatibility versions for migrating the data from one version to another. You can set the compatibility versions manually from mongodb shell using (for this, you need a working mongodb server):
> db.adminCommand( { setFeatureCompatibilityVersion: <version> } )
link to doc : https://docs.mongodb.com/manual/reference/command/setFeatureCompatibilityVersion/
I just updated my mac to Catalina 10.15.2 and I can't running MongoDB.
When I send the command mongo I receive this message
Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
and the only way to make Mongo work is to restart the Mac.
If I check the process with the command ps I don't see the process already on and the port 27017 is available.
I already tried to run the follow command:
brew tap mongodb/brew
brew reinstall mongodb-community
brew services restart mongodb-community
and if I run the follow command:
ps aux | grep -v grep | grep mongod
no results.
I tried to run mongod before mongo as well and the result is:
2019-12-18T12:17:45.916+0100 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2019-12-18T12:17:45.920+0100 I CONTROL [initandlisten] MongoDB starting : pid=9375 port=27017 dbpath=/data/db 64-bit host=Marcos-MacBook-Pro.local
2019-12-18T12:17:45.920+0100 I CONTROL [initandlisten] db version v4.2.1
2019-12-18T12:17:45.920+0100 I CONTROL [initandlisten] git version: edf6d45851c0b9ee15548f0f847df141764a317e
2019-12-18T12:17:45.920+0100 I CONTROL [initandlisten] allocator: system
2019-12-18T12:17:45.920+0100 I CONTROL [initandlisten] modules: none
2019-12-18T12:17:45.920+0100 I CONTROL [initandlisten] build environment:
2019-12-18T12:17:45.920+0100 I CONTROL [initandlisten] distarch: x86_64
2019-12-18T12:17:45.920+0100 I CONTROL [initandlisten] target_arch: x86_64
2019-12-18T12:17:45.920+0100 I CONTROL [initandlisten] options: {}
2019-12-18T12:17:45.920+0100 E NETWORK [initandlisten] Failed to unlink socket file /tmp/mongodb-27017.sock Permission denied
2019-12-18T12:17:45.920+0100 F - [initandlisten] Fatal Assertion 40486 at src/mongo/transport/transport_layer_asio.cpp 693
2019-12-18T12:17:45.920+0100 F - [initandlisten]
***aborting after fassert() failure
Someone can help me please? I appreciate it
An alternative way to fix this Catalina Mac OS root & mongodb connection issue, do the following:
Install Homebrew, if you have it, reinstall it again
run the following commands in the terminal
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew untap mongodb/brew && brew tap mongodb/brew
brew install mongodb-community#4.2
The issue is mongo cannot find /db/data because there is no directory, so you have to create one:
cd ~ (this should take you to your Users folder)
from the Users folder make your own db/data folder by running the follow commands:
mkdir db & cd inside db folder
inside the db folder run: mkdir data & cd inside data folder
run this command: mongod --dbpath ~/data/db
(inside the Users/data/db/ folder you just created)
Now open a new terminal tab &
run: cd ~ (brings you back to Users) -> now run : cd .. & cd .. again (do this twice)
(now you should be in the folder before Users)
(now find tmp folder) cd into the /tmp folder
delete the sock file (this is giving you connection issues)
delete it by running: rm -rf mongodb-27017.sock
now run command: mongo (this should work now)
inside mongo shell run command: db.verion()
if you see a version, your connection works.
From now on to run mongodb database & connection you will have to have two separate tabs open at all times whenever you want to work on your projects
Example:
in one terminal tab run command -> mongod --dbpath ~/data/db
(this starts the connection)
in the other terminal tab run command: mongo
(this starts the shell)
These both have to be running..
Side Note:
you no longer need to start
the connection by running
brew services start mongo-community anymore.
remember mongod --dbpath ~/data/db is basically -> mongod command now.. The Mac OS Catalina Update created root permission problems, that is why mongod command alone never worked before.
Hope this helped you. Goodluck.
Faced a similar issue with macOS Big Sur. After trying all the approaches mentioned above including
updating homebrew
reinstalling MongoDB, MongoDB community and setting up a /System/Volumes/Data/data/dbfolder
This command worked for me mongod --dbpath=/System/Volumes/Data/data/db
reference: https://medium.com/codespace69/mongodb-troubleshooting-errors-for-beginners-and-macos-catalina-31befd99f6c8
This error is caused due to ownership issues.
Here we are changing the ownership to 'mongodb' user.
Command 1: deletes the /tmp/mongodb-27017.sock file
$sudo rm -rf /tmp/mongodb-27017.sock
Command 2: starts mongod service
$sudo service mongod start
Command 3: shows the file with its ownership details
ls -lsah /tmp/mongodb-27017.sock
output
0 srwx------ 1 mongodb mongodb 0 Aug 24 04:01 /tmp/mongodb-27017.sock
Got the same issue after upgrading to Catalina. Tried lots of ways to solve the issue, what eventually helped was reinstalling brew, and then following steps listed on official mongodb site.
So:
Uninstall brew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)
Install it again:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
Follow steps to install and run monbo service:
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/
After starting a Microsoft SQL Server (on Linux) container from scratch...
$ docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=Pa$$word' -p 1433:1433 \
-d --name mssql microsoft/mssql-server-linux
... creating a Docker checkpoint ...
$ docker checkpoint create mssql cp1
... fails:
Error response from daemon: Cannot checkpoint container mssql:
failed to read checkpoint reader:
open /var/lib/docker/containers/f2eb8d17e95630332bbeab887b9e03a1b91efcd8907f69b82805a788331316e2/checkpoints/cp1/cgroup.img:
no such file or directory
This is on Ubuntu 18.04, with CRIU installed and experimental mode enabled:
$ docker version
Client:
Version: 18.09.6
API version: 1.39
Go version: go1.10.8
Git commit: 481bc77
Built: Sat May 4 02:35:57 2019
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 18.09.6
API version: 1.39 (minimum version 1.12)
Go version: go1.10.8
Git commit: 481bc77
Built: Sat May 4 01:59:36 2019
OS/Arch: linux/amd64
Experimental: true
Checkpointing other containers works fine, only running into this with the SQL image.
Am I missing anything, or is this likely just a bug with docker checkpoint (which is currently an experimental feature)?
As of Docker 19.03.1, this no longer appears to be a problem.
I am using mongodb 3.6.3 on a centos 7 aws ec2 instance.
2 Questions (only one needs to be answered):
Why is the --logpath preventing the mongod command if done manually through the cli with sudo mongod --storageEngine etc
Why is sudo service mongod status showing the failure that it is?
When I run the below command, (since currently, sudo service mongod start isn't working but the below works) it fails when I specify the --logpath but will run without it. Unfortunately, when I run it without it, all of my logs end up in the / which is absolutely the wrong location.
sudo mongod --storageEngine wiredTiger --dbpath /data --bind_ip 127.0.0.1,apiIP --logpath /var/log/mongodb/mongod.log --auth --fork
Below is what happens when I try to run that above line as is.
I CONTROL [main] log file "/var/log/mongodb/mongod.log" exists; moved to "/var/log/mongodb/mongod.log.2018-03-16T15-16-01".
From what I can tell, it is conflicting with the currently existent
Just for reference, sudo service mongod status returns:
mongod.service - mongodb database
Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2018-03-16 15:11:53 UTC; 9min ago
Process: 26620 ExecStart=/usr/bin/mongod $OPTIONS run (code=exited, status=2)
Main PID: 26620 (code=exited, status=2)
Mar 16 15:11:53 ip-* systemd[1]: Started mongodb database.
Mar 16 15:11:53 ip-* systemd[1]: Starting mongodb database...
Mar 16 15:11:53 ip-* mongod[26620]: F CONTROL [main] Failed global initialization: FileNotOpen: Failed to open "/var/log/mongodb/mongod.log"
Mar 16 15:11:53 ip-* systemd[1]: mongod.service: main process exited, code=exited, status=1/FAILURE
Mar 16 15:11:53 ip-* systemd[1]: Unit mongod.service entered failed state.
Mar 16 15:11:53 ip-* systemd[1]: mongod.service failed.
/etc/mongod.conf
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
# Where and how to store data.
storage:
dbPath: /data
# logpath: /log/mongod.log
journal:
enabled: true
engine: wiredTiger
# mmapv1:
# wiredTiger:
# how the process runs
processManagement:
# fork: true # fork and run in background
pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile
timeZoneInfo: /usr/share/zoneinfo
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1, apiIP
Thanks to #AlexBlex for noticing the spacing issue in the yaml file.
With that sorted, the status error has this line
Unrecognized option: storage.wiredTiger
cd /var/log
sudo mkdir -m 777 mongodb
sudo service mongod start
sudo service mongod status
Hopefully, that's will do!
sudo systemctl enable mongod
sudo systemctl restart mongod
sudo journalctl -u mongod.service
Hopefully, that will do!
Reference: https://stackoverflow.com/a/51286526/122441