首页 \ 问答 \ mongodb - 数据库没有连接(mongodb - database is not connecting)

mongodb - 数据库没有连接(mongodb - database is not connecting)

我完全遵循官方教程http://www.mongodb.org/display/DOCS/Quickstart+Windows中描述的步骤

但是当我运行需要mongodb的应用程序时,错误显示“无法连接到mongo”。

非常感谢如何在Windows中运行其中一个提到的应用程序的详细步骤。

到目前为止我得到了什么:

cygwin
node version 0.5 pre
npm version 3.2
mogoose installed
mongo-connect installed
jade installed
express installed
stylus installed

I follow exactly the steps described in official tutorial http://www.mongodb.org/display/DOCS/Quickstart+Windows

But when I run application requiring mongodb, the error says "can not connecting to mongo".

greatly appreciate detail steps of how to run one of those mentioned apps in windows.

What I've got so far:

cygwin
node version 0.5 pre
npm version 3.2
mogoose installed
mongo-connect installed
jade installed
express installed
stylus installed

原文:https://stackoverflow.com/questions/5653531
更新时间:2024-01-21 17:01

最满意答案

您遇到的问题是由于您将传输套接字放在错误的列表中。 select.select()有两个列表,一个接收列表和一个发送列表。 因此,您需要更新该行

    ready_socks,_,_ = select.select(socks, [], [])

publisher.py中改为阅读

    _,ready_socks,_ = select.select([], socks, [])

其中传输套接字作为第二个参数输入,套接字就绪在第二个返回值中。 如果你更新它,你的程序将工作。 但是,它会快速发送大量消息,因为您的程序没有延迟。 另外,如上所述,无法区分您的两个频道。 我想这是因为你减少了你的例子。


The issue you are facing is due to you putting the transmit sockets in the wrong list. select.select() has two lists, a receive list and a transmit list. Thus, you need to update the line

    ready_socks,_,_ = select.select(socks, [], [])

in publisher.py to instead read

    _,ready_socks,_ = select.select([], socks, [])

where the transmit sockets are entered as the second argument and the sockets ready are in the second return value. If you update this, your program will work. However, it will send a large number of messages quickly, as you have no delays in your program. Also, as written, there is no way to distinguish between your two channels. I guess that is due to you reducing your example, though.

相关问答

更多
  • 看看这里: Python中的异步编程 异步编程和扭曲简介 值得一看: asyncio(以前的Tulip)已经被检入Python的默认分支 Take a look here: Asynchronous Programming in Python An Introduction to Asynchronous Programming and Twisted Worth checking out: asyncio (previously Tulip) has been checked into the Pytho ...
  • 注意 以下答案不适用于请求v0.13.0 +。 在写入此问题后,异步功能被移动到grequests 。 但是,您可以使用下面的grequests替换requests ,它应该可以工作。 我已经离开这个答案是为了反映关于使用请求
  • 你不需要“异步httprequest”来使用twitter search api: import json import urllib import urllib2 # make query query = urllib.urlencode(dict(q="blue angel", rpp=5, include_entities=1, result_type="mixed")) # make request resp = urllib2.ur ...
  • 由于客户端使用与服务器相同的脚本实现,所以端口是已知的。 在真实情况下,您应该为守护程序指定一个端口。 除了让客户知道连接哪个端口之外,您还可能需要知道,以便您可以在客户端和服务器之间打开防火墙。 Since the client is implemented in the same script as the server, the port is known. In a real-world scenario, you should specify a port for your daemon. Bes ...
  • 您可以在不同的线程中调用python导入器作为函数,而不是使用import foo 。 由于这种导入的计算成本很高,python只允许一次运行一个线程(除非它像释放GIL的pandas东西),否则你可能会发现几乎没有什么好处。 仍然, import threading import time def begin_load_foo(): global foo_thread foo_thread = threading.Thread(target=load_foo_thread) fo ...
  • 您遇到的问题是由于您将传输套接字放在错误的列表中。 select.select()有两个列表,一个接收列表和一个发送列表。 因此,您需要更新该行 ready_socks,_,_ = select.select(socks, [], []) 在publisher.py中改为阅读 _,ready_socks,_ = select.select([], socks, []) 其中传输套接字作为第二个参数输入,套接字就绪在第二个返回值中。 如果你更新它,你的程序将工作。 但是,它会快速发送大量消 ...
  • 您不需要使用任何外部库或框架来完成这么简单的任务,将URL列表放入队列,启动4个线程,每个线程应该从队列中获取项目并下载它。 像这样的东西: import sys import os import urllib import threading from Queue import Queue class DownloadThread(threading.Thread): def __init__(self, queue, destfolder): super(DownloadThr ...
  • 这表现如预期。 问题在于这些形式的理解只允许在 async def函数内。 在外部(即在REPL中输入的顶级),它们会根据定义引发SyntaxError 。 这在PEP的规范部分有具体说明,具体来说就是异步理解 : 异步解析只能在async def函数中使用 。 同样,为了在理解中使用await : 这只在async def函数体中有效 。 对于async loops ,您需要一个符合必要接口的对象(定义__aiter__ )并放置在async def函数中。 同样,这在相应的PEP中指定: 将一个没有__ ...
  • 我发现我的主要问题是IP无法解决,因此套接字不遵守设置超时并在30秒后失败。 请参阅Python 2.6 urlib2超时问题 。 由于缺乏对IPv6的支持(没有补丁), adns-python是不可取的 。 搜索后我发现: 使用dnspython反向DNS查找并在我的代码中实现了类似的版本(他的代码也使用可选的线程池并实现超时)。 最后,我使用了带有concurrent.futures线程池的dnspython进行异步反向DNS查找(请参阅Python:共享主机中的反向DNS查找和Dnspython:设置 ...
  • 查看Task Queue API 。 任务或消息队列往往是进行某种由用户请求启动的工作的方式,但不一定在该请求的执行时间范围内完成。 Check out the Task Queue API. Task or message queues tend to be the way to go about doing some sort of work that is initiated by a user request, but not necessarily completed within the tim ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)