Can't connect to Mongo Cloud mongodb Database in Golang on Ubuntu

后端 未结 3 1175
庸人自扰
庸人自扰 2020-12-19 20:35

I have this Go Code to connect to my Mongo Cloud Database:

func connectToDataBase() {
    ctx, cancel := context.WithTimeout(context.Background(), 20*time.Se         


        
3条回答
  •  忘掉有多难
    2020-12-19 21:36

    Another option, found here suggests installing resolvconf (for Ubuntu apt install resolvconf), add the line nameserver 8.8.8.8 to /etc/resolvconf/resolv.conf.d/base, then run sudo resolvconf -u and to be sure service resolvconf restart. To verify run systemd-resolve --status.

    You should see on the first line your DNS server like here:

             DNS Servers: 8.8.8.8
              DNS Domain: sa-east-1.compute.internal
              DNSSEC NTA: 10.in-addr.arpa
                          16.172.in-addr.arpa
    

提交回复
热议问题