从 mongos 连接到 Mongo Config Server 时出现问题
各位,
我正在设置一个 MongoDB 集群。问题是当我启动“mongos”时,它无法连接到 Mongod 配置服务器。如果我使用与 Mongod 配置服务器相同的服务器从本地主机启动“mongos”,它会连接&作品。
localhost-$ mongos --port 30000 --configdb server-02:20000 [工作]
server-01-$ mongos --port 30000 --configdb server-02:20000 [不工作工作]
由于从本地主机我可以通过连接到 mongo 配置服务器来启动 mongos执行查询,配置服务器似乎运行良好。
无法理解是什么阻止服务器连接到其对等方之一。当我第一次尝试从本地主机连接时,我收到操作系统的提示,询问是否应该允许进程“mongos”接受我单击“允许”的传入连接。也许如果服务器因为这个权限问题而无提示地失败,并且没有办法提示。
我收到的错误:
Sun May 8 01:14:46 ./mongos db 版本 v1.8.1,pdffile 版本 4.5 开始(--使用帮助) 5 月 8 日星期日 01:14:46 git 版本:a429cd4f535b2499cc4130b06ff7c26f41c00f04 5 月 8 日星期日 01:14:46 构建系统信息:Linux bs-linux64.10gen.cc 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP 11 月 20 日星期五 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_41 mongos main 中未捕获的异常: 11002 套接字异常 [6] 服务器 [server-02:20000] mongos 连接池错误:无法连接到服务器 server-02:20000
好吧,我确实尝试了全新安装,但问题仍然存在,所以我将 mongos 移动到另一台服务器新安装&它似乎可以毫无问题地连接到配置服务器。显然,我尝试运行 mongos 的第一台服务器存在某种套接字争用问题。
Folks,
I am setting up a MongoDB Cluster. The problem is when I am starting up 'mongos' it fails to connect 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 mongodb 数据的所有目录中,都有一个 mongo.lock 文件。如果该文件不为空,则似乎意味着 mongodb 可执行文件(配置、分片数据服务器)的一个实例已经在运行。
如果不为空,则删除每个目录中的此文件即可。
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.
检查您的 mongo 服务使用的
bindip
值。取出bindip
标志。它工作完美。Check your
bindip
value, which is used by your mongo service. Take out thebindip
flag. It works perfectly.