Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
632 views
in Technique[技术] by (71.8m points)

macos - SocketException: Address already in use MONGODB

i found this error when trying to run mongodb. I install it via homebrew. Please assist

Agungs-MacBook-Pro:~ agungmahaputra$ mongod
2017-12-26T15:31:15.911+0700 I CONTROL  [initandlisten] MongoDB starting : pid=5189 port=27017 dbpath=/data/db 64-bit host=Agungs-MacBook-Pro.local
2017-12-26T15:31:15.911+0700 I CONTROL  [initandlisten] db version v3.6.0
2017-12-26T15:31:15.911+0700 I CONTROL  [initandlisten] git version: a57d8e71e6998a2d0afde7edc11bd23e5661c915
2017-12-26T15:31:15.911+0700 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2n  7 Dec 2017
2017-12-26T15:31:15.911+0700 I CONTROL  [initandlisten] allocator: system
2017-12-26T15:31:15.911+0700 I CONTROL  [initandlisten] modules: none
2017-12-26T15:31:15.911+0700 I CONTROL  [initandlisten] build environment:
2017-12-26T15:31:15.911+0700 I CONTROL  [initandlisten]     distarch: x86_64
2017-12-26T15:31:15.911+0700 I CONTROL  [initandlisten]     target_arch: x86_64
2017-12-26T15:31:15.911+0700 I CONTROL  [initandlisten] options: {}
2017-12-26T15:31:15.911+0700 E STORAGE  [initandlisten] Failed to set up listener: SocketException: Address already in use
2017-12-26T15:31:15.911+0700 I CONTROL  [initandlisten] now exiting
2017-12-26T15:31:15.911+0700 I CONTROL  [initandlisten] shutting down with code:48
Agungs-MacBook-Pro:~ agungmahaputra$
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can kill the previous mongod instance and start the new one.

To kill the previous mongod instance, first search for a list of tasks running on your machine by typing,

sudo lsof -iTCP -sTCP:LISTEN -n -P

Search for mongod COMMAND and its PID and type,

sudo kill <mongo_command_pid>

Now start your mongod instance by typing,

mongod

You can see MongoDB running successfully.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...