Folks,
I am setting up a MongoDB Cluster. The problem is when I am starting up 'mongos' it fails to conn开发者_运维技巧ect to Mongod Config Server. If I start 'mongos' from localhost with same server as Mongod Config Server it connects & works.
localhost-$ mongos --port 30000 --configdb server-02:20000 [Works]
server-01-$ mongos --port 30000 --configdb server-02:20000 [Does Not Work]
Since from localhost I am able to start mongos by connecting to mongo config server & execute queries, it appears that config server is running fine.
Not able to understand what prevents servers to connect to one of their peers. When I attemped to connect first time from localhost, I got a prompt from OS asking whether process 'mongos' should be allowed to accept incoming connections for which I clicked allow. Perhaps if server fails silently because of this permission issue, with no way to prompt.
Error I recieve:
Sun May 8 01:14:46 ./mongos db version v1.8.1, pdfile version 4.5 starting (--help for usage) Sun May 8 01:14:46 git version: a429cd4f535b2499cc4130b06ff7c26f41c00f04 Sun May 8 01:14:46 build sys info: Linux bs-linux64.10gen.cc 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_41 uncaught exception in mongos main: 11002 socket exception [6] server [server-02:20000] mongos connectionpool error: couldn't connect to server server-02:20000
Well I did try clean install yet the problem persisted, so I moved my mongos to a different server with new install & it appears to connect to config server without any issue. Apparently there is some sort of socket contention issue with first server I tried to run mongos.
In all the directories of your mongodb's datas, you have a mongo.lock file. If this file is not empty, it seems to mean that one instance of mongodb executable (config, shard data server) is already running. Just delete this file in each directory if not empty.
Check your bindip
value, which is used by your mongo service. Take out the bindip
flag. It works perfectly.
精彩评论