Google Cloud Mongo DB: External IP not connecting

前端 未结 2 1972
迷失自我
迷失自我 2020-12-06 21:48

I have created a ready to go MongoDB server on Google Cloud using the default parameters. Everything is working fine between them (there is communication and I can add DBs a

相关标签:
2条回答
  • 2020-12-06 21:48

    Did you

    • configure the firewall rule in Google cloud console
    • provide a tag in your firewall rule
    • tag your instance with the same tag as the firewall rule

    ?

    I explained how to open a port to the outside world in detail over here. Replace with your own port number.

    0 讨论(0)
  • 2020-12-06 21:49

    I belive the issue here is that the ReplicaSetMonitorWatcher is changing hosts to rs0/mongo-db-jff3:27017, where mongo-db-jff3 is not reachable from your network. You need to configure the hosts in the replica set to something that you can reach (static IP or URL).

    https://docs.mongodb.com/manual/tutorial/change-hostnames-in-a-replica-set/

    Quick example, mongo into your PRIMARY (SECONDARY if you want to do it no downtime):

    cfg = rs.conf()
    cfg.members[0].host = "mongodb0.example.net:27017"
    cfg.members[1].host = "mongodb1.example.net:27017"
    rs.reconfig(cfg)
    
    0 讨论(0)
提交回复
热议问题