代码之家  ›  专栏  ›  技术社区  ›  VinnyG

在Windows Server 2008上安装MongoDB

  •  9
  • VinnyG  · 技术社区  · 15 年前

    我是MongoDB的新手,到目前为止,我在本地为我的开发人员工作,在那里我让Mongo作为Win7上的服务运行。我把它作为一个服务运行在WinServer2008上的VPS上。当我在服务器上时,它工作正常,但我不知道hos设置它以便我可以从服务器外部访问它?找不到任何好的文档。另外,我很难从本地计算机在服务器上进行备份/还原,因为我在服务器外部看不到它。

    我还想了解更多有关主/从和主机的信息,以便正确设置。

    当我运行netstat-anb时,我得到

      TCP    127.0.0.1:27017        0.0.0.0:0              LISTENING
     [mongod.exe]
      TCP    127.0.0.1:27017        127.0.0.1:62990        ESTABLISHED
     [mongod.exe]
      TCP    127.0.0.1:28017        0.0.0.0:0              LISTENING
    

    这就是Mongod.exe的全部功能

    [编辑]

    我尝试用--bind iu ip x x x.x.x.x x重新安装,现在x x x.x.x.x x:27017可以工作,但仅在远程服务器上,如果我尝试从任何失败的地方进行访问。

    另外,我关闭了防火墙,它不会改变任何东西。

    谢谢!

    6 回复  |  直到 6 年前
        1
  •  12
  •   Charles Ouellet    14 年前

    dbpath = d:\mongo\data
    logpath = d:\mongo\logs
    noauth = true # use 'true' for options that don't take an argument
    

    mongod --config d:\mongo\mongos.conf --reinstall
    

    http://localhost:27017

    You are trying to access MongoDB on the native driver port. For http diagnostic access, add 1000 to the port number
    

    http://192.168.x.x:27017

        2
  •  3
  •   Chris Fulstow    14 年前

    C:\> netsh.exe advfirewall firewall add rule name="MongoDB (port 27017)"
            dir=in action=allow protocol=TCP localport=27017
    
        5
  •  0
  •   Maytham Fahmi    6 年前

    1. C:\Program Files\MongoDB\Server\4.0\bin mongod.cfg

      • bindIp: 127.0.0.1 bindIp: 127.0.0.1, 192.168.1.xxx
    2. 192.168.1.xxx:27017

        6
  •  0
  •   sandyiit    6 年前

    # network interfaces
    net:
      port: 27017
    #  bindIp: 127.0.0.1
      bindIp: 0.0.0.0