SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused : connect@src/mongo/shell/mongo.js:341:17 @(connect):2:6
This method only works if you want to repair your data files without preserving the original files
To find where you dbpath resides- vim /etc/mongodb.conf
check for option dbpath=
(I have dbpath=/var/lib/mongodb)
Default: /data/db/
Typical locations include: /srv/mongodb, /var/lib/mongodb or /opt/mongodb .
Replace the /var/lib/mongodb with your dbpath
sudo rm /var/lib/mongodb/mongod.lock
sudo mongod --dbpath /var/lib/mongodb/ --repair
sudo mongod --dbpath /var/lib/mongodb/ --journal
(Make sure that you leave you terminal running in which you have run above lines, dont press 'Ctrl+c' or quit it.) Type the command to start mongo now in another window.
Hope this works for you ! for those who want to repair your data files while preserving the original files mongo recoversudo rm /var/lib/mongodb/mongod.lock
Also in Shell:
- how to revoke permissions from group and others
- delete branch git
- install macos on vmware ubuntu
- hyper-v powershell add scsi DVD
- git pull a new branch froma remote repo
- ubuntu chmod codes
- linux start mongodb
- how to set up git ssh creds to push
- centos 7 install iptables
- to see all after commit in local repository in git
- react-devtools agent got no connection
- SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused : connect@src/mongo/shell/mongo.js:341:17 @(connect):2:6
- how to install node dependencies
- git reset specific file
- list of files in git commit
- remove the last commit git without losing changes
- how to move file in directory in linux
- no module named typedefs pyinstaller
- linux ssh keygen
- .gitignore
- git delete branch
- crop video from specific time to specific time ffmpeg
- unir arquivos linux
- How to find your ip on debian linux wsl