在Linux上获取MongoDB来侦听远程连接 [英] Getting MongoDB on Linux to listen to remote connections
问题描述
我已经成功地在Windows上(本地计算机上)将MongoDB安装为服务,但是现在我想将MongoDb移至单独的服务器上.因此,我将压缩包解压缩到网络上(运行linux)的虚拟服务器.
I've successfully installed MongoDB on Windows (on a local machine) as a service, but now I want to move MongoDb to a separate server. So I extracted the tarball to a virtual server on network (running linux).
当我从本地计算机使用PuTTY连接到服务器("testmongoserver")时,我启动了mongod服务器,它告诉我它正在侦听默认的28017端口. mongo控制台也正在运行,并允许我创建一个新数据库(testdb)并向其中添加用户.
When I connected to the server ("testmongoserver") using PuTTY from my local machine, I started the mongod server and it told me that it was listening to the default 28017 port. The mongo console is also working and allowed me to create a new database (testdb) and add users to it.
但是,我无法从远程访问服务器.当我键入testmongoserver:28017
时,它不会像在本地计算机上的localhost:28017
那样打开HTTP控制台.我也无法使用官方驱动程序进行连接并提供连接字符串.
However, I could not access the server from remote. When I type testmongoserver:28017
it doesn't open the HTTP console as localhost:28017
on my local machine does. I also can't connect using official drivers and providing a connectionstring.
在Linux上安装MongoDB的必要步骤是什么,以便我可以从带有连接字符串的远程计算机上访问它,并通过testmongoserver:28017
What are the neccesarry steps to install MongoDB on Linux, so that I could access it from a remote machine with a connectionstring and use its HTTP console via testmongoserver:28017
谢谢!
推荐答案
- 在mongo服务器上运行netstat -a并检查端口.
- 检查DNS设置,并检查linux服务器是否允许外部连接.
- 检查mongodb是否可以接受外部/远程连接.
mongo的默认端口为27017. 28017-webstats的端口.
Default port for mongo is 27017. 28017 - port for webstats.
请参见 http://www.mongodb.org/display /DOCS/Security + and + Authentication#SecurityandAuthentication-Ports
这篇关于在Linux上获取MongoDB来侦听远程连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!