V
V
Vitaly2021-02-02 15:09:48
linux
Vitaly, 2021-02-02 15:09:48

How to proxy requests to mongodb+srv in nginx?

Tell me how to configure request proxying in nginx to MongoDB Altas, which is connected via mongodb+ srv://cluster1.abcde.mongodb.net/

stream {
    server {
        listen  50002 so_keepalive=on;
        proxy_connect_timeout 2s;
        proxy_pass    stream_mongo_backend;
        proxy_timeout 10m;
    }

    upstream stream_mongo_backend {
         server cluster1.abcde.mongodb.net:27017;
    }
}


The problem is that "cluster1.abcde.mongodb.net" is not being pinged due to mongodb+srv i.e. its ip is taken from the SRV record in DNS.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly Karasik, 2021-02-02
@vitaly_il1

Ask Altas support. I'm not sure if we can correctly proxy, because if we specify three servers, the application will not know which of them is the master.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question