mongodb 로컬 서버를 시작할 수 없습니다
mongodb를 처음 사용합니다.. mongodb 로컬 서버를 mongod
명령으로 실행하려고 시도 하면 실행에 실패 하고이 오류가 발생했습니다.
/usr/lib/mongodb/mongod --help for help and startup options
Sat Jun 25 09:38:51 MongoDB starting : pid=1782 port=27017 dbpath=/data/db/ 32-bit
** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data
** see http://blog.mongodb.org/post/137788967/32-bit-limitations
Sat Jun 25 09:38:51 db version v1.6.3, pdfile version 4.5
Sat Jun 25 09:38:51 git version: nogitversion
Sat Jun 25 09:38:51 sys info: Linux vernadsky 2.6.24-27-server #1 SMP Fri Mar 12 01:45:06 UTC 2010 i686 BOOST_LIB_VERSION=1_42
Sat Jun 25 09:38:51 [initandlisten] *** warning: spider monkey build without utf8 support. consider rebuilding with utf8 support
Sat Jun 25 09:38:51 [initandlisten] waiting for connections on port 27017
Sat Jun 25 09:38:51 [initandlisten] listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017
Sat Jun 25 09:38:51 [initandlisten] addr already in use
Sat Jun 25 09:38:51 [initandlisten] now exiting
Sat Jun 25 09:38:51 dbexit:
Sat Jun 25 09:38:51 [initandlisten] shutdown: going to close listening sockets...
Sat Jun 25 09:38:51 [initandlisten] shutdown: going to flush oplog...
Sat Jun 25 09:38:51 [initandlisten] shutdown: going to close sockets...
Sat Jun 25 09:38:51 [initandlisten] shutdown: waiting for fs preallocator...
Sat Jun 25 09:38:51 [initandlisten] shutdown: closing all files...
Sat Jun 25 09:38:51 closeAllFiles() finished
Sat Jun 25 09:38:51 [initandlisten] shutdown: removing fs lock...
Sat Jun 25 09:38:51 dbexit: really exiting now
mongod.lock
파일 삭제를 시도했습니다 ... 실행했습니다 mongod --repair
.. mongod.lock
파일에 대한 권한도 변경했습니다 .
그러나 아무것도 작동하지 않는 것 같습니다. 같은 오류가 계속 나타납니다. 어떻게해야합니까?
또한 git 버전 1.7.4.1을 설치했지만 오류에 nogitversion이 표시됩니다.
시험:
sudo service mongod stop
sudo mongod
현재 활성 mongodb 서비스를 중지하여 새 서비스를 시작할 수 있도록
손상을 일으킬 수 있으므로 -9 신호를 사용하여 프로세스를 종료하지 마십시오. http://www.mongodb.org/display/DOCS/Starting+and+Stopping+Mongo#StartingandStoppingMongo-SendingaUnixINTorTERMsignal
사용 sudo killall -15 mongod
하는 대신
안드레아스 정 :
"6 월 25 일 토요일 09:38:51 [initandlisten] listen () : bind () 실패 errno : 98 소켓에 이미 사용중인 주소 : 0.0.0.0:27017
자기 말하기입니다.
mongod의 다른 인스턴스가 이미 실행 중이며 MongoDB 기본 포트 인 27017을 할당 중입니다.
다른 프로세스를 종료하거나 다른 포트를 사용하십시오. "
이 경우 다음 명령을 입력하십시오
ps wuax | grep mongo
다음과 같은 것이 보일 것입니다
User 31936 0.5 0.4 2719784 35624 ?? S 7:34pm 0:09.98 mongod
User 31945 0.0 0.0 2423368 184 s000 R+ 8:24pm 0:00.00 grep mongo
이제 mongod 인스턴스에 대해 kill 명령을 입력하십시오 (이 경우 31936).
kill 31936
6 월 25 일 토요일 09:38:51 [initandlisten] listen () : bind () 실패 errno : 98 소켓에 이미 사용중인 주소 : 0.0.0.0:27017
자기 말하기입니다.
mongod의 다른 인스턴스가 이미 실행 중이며 MongoDB 기본 포트 인 27017을 할당 중입니다.
다른 프로세스를 종료하거나 다른 포트를 사용하십시오.
mongodb 포트를 실행중인 프로세스를 netstat에서 찾으십시오 (27017).
명령:
sudo netstat -tulpn | grep :27017
출력은 다음과 같습니다.
tcp 0 0 0.0.0.0:27017 0.0.0.0:*
LISTEN 6432/mongod
제 경우에는 "6432"가 pid이므로 귀하의 경우와 다를 수 있습니다. 그런 다음 다음 명령을 사용하여 해당 프로세스를 종료하십시오.
sudo kill <pid>
그게 다야!
사용하다:
sudo killall mongod
It will stop the server.
Then restart mongod
by:
sudo service mongod restart
it should work.
You already have a process running. You can kill it with the command :
killall mongod
You want to do killall -15 mongod
because it is still running: Address already in use for socket: 0.0.0.0:27017
.
Then you can run mongod
again.
Try a different port if you can't find any current running processes or killing them doesn't work. For example, try 27018 because the default is 27017.
mongod --port 27018
I found this out with the command, mongod --help
I suggest use instead:
$sudo service mongodb stop
That could work.
Try either killall -15 mongod/ killall mongod Even after this if this doesnt work then remove the db storage folder by typing the following commands sudo rm -rf /data/db sudo mkdir /data/db sudo chmod 777 /data/db
OS X. Activity Monitor, look for mongod, cross it . then run again mongod. problem Solved.
Open the terminal and type:
mkdir -p /data/db
Then enter:
mongod
I had the same problem were I tried to open a new instance of mongod and it said it was already running.
I checked the docs and it said to type
mongo
use admin
db.shutdownServer()
MongoDB unable to start is mainly due to unclean shutdown. To remedy, delete the mongod.lock file. This file is located in the data folder.
Find out where your data folder is by looking in the mongodb.conf or mongod.conf file. (Conf file under /etc on Linux systems.)
# Where and how to store data.
storage:
dbPath: /var/lib/mongodb
For example using the above configuration, the file is at /var/lib/mongodb/mongod.lock. Simply remove it and restart mongodb.
I've faced the same issue. Though the mongodb
service is not running, the log showed address already in use
message.
$netstat -tulpn | grep :27017
returns nothing
On further analysis found that the issue was due to lock file. The service is running fine, after deleting the lock file and restarting it.
$grep "dbpath" /etc/mongodb.conf
dbpath =/var/lib/mongodb
$ls /var/lib/mongodb/mongod.lock
$service mongod start
Check for logs at /var/log/mongodb/mongod.log and try to deduce the error. In my case it was
Failed to unlink socket file /tmp/mongodb-27017.sock errno:1 Operation not permitted
Deleted /tmp/mongodb-27017.sock and it worked.
try
/usr/lib/mongodb/mongod.exe --dbpath c:data\db
--dbpath (should be followed by the path of your db)
It may be possible that the server is already running. Please check it by the command mongo is working or not.
It shows error listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017 i.e. 27017 address is already in used by some other service. please check this by "netstat -apt| grep "27017"" command
(If your're using linux,) if
mongod --shutdown --config=path/to/your/configFile.conf
or
mongod --repair --config=path/to/your/configFile.conf
didn't fix the issue, logout and re-login. That solved my problem.
Or you can kill the process manually from terminal, I guess.
It looks like the same error is showed in logs when you're missing LC_ALL environment setting. It's confusing, but you may execute mongo
client to see that it's a problem.
if you are running mongo for first time you might wanna set the path first
mongod --dbpath <path to the directory>
To complement in Windows:
For example mongoDB version 3.6 is installed, and the install path of MongoDB is "D:\Program Files\MongoDB".
Create folder D:\mongodb\logs, then create file mongodb.log inside this folder.
Run cmd.exe as administrator,
D:\Program Files\MongoDB\Server\3.6\bin>taskkill /F /IM mongod.exe
D:\Program Files\MongoDB\Server\3.6\bin>mongod.exe --logpath D:\mongodb\logs\mongodb.log --logappend --dbpath D:\mongodb\data --directoryperdb --serviceName MongoDB --remove
D:\Program Files\MongoDB\Server\3.6\bin>mongod --logpath "D:\mongodb\logs\mongodb.log" --logappend --dbpath "D:\mongodb\data" --directoryperdb --serviceName "MongoDB" --serviceDisplayName "MongoDB" --install
Remove these two files mongod.lock
and storage.bson
under the folder "D:\mongodb\data".
Then type net start MongoDB
in the cmd using administrator privilege, the issue will be solved.
Killing process did not solve my issue. My mac had crashed and on restart some of lock files (mongod.lock, WiredTiger.lock) were present in mongo dbPath. I moved these files to different folder (I did not delete to avoid more issues) and then it worked. On successul star, I deleted the moved lock files.
참고URL : https://stackoverflow.com/questions/6478113/unable-to-start-mongodb-local-server
'Programing' 카테고리의 다른 글
NumberPicker에서 소프트 키보드 비활성화 (0) | 2020.05.30 |
---|---|
팬더 NaN을 공백 / 빈 문자열로 바꿉니다. (0) | 2020.05.30 |
프래그먼트와 컨테이너 활동간에 데이터 전달 (0) | 2020.05.30 |
변경시 어떻게 구현합니까 (0) | 2020.05.29 |
매일 봄 크론 표현 1 : 01 : am (0) | 2020.05.29 |