This topic provides a solution for you solve the following network connectivity issues.

  • After you create security domains, a direct connection cannot be established between a DBGateway and the endpoint of DAS.
  • A DBGateway is connected to the DAS endpoint over the Internet, and the network connection is intermittent and even interrupted. You want to use an internal channel to connect the DBGateway to the NGINX server. The NGINX server then forwards data to the DAS endpoint.

NGINX solution

wget http://nginx.org/download/nginx-1.17.4.tar.gz
tar -zxvf nginx-1.17.4.tar.gz
cd nginx-1.17.4
# Compile and install the NGINX server. Specify the corresponding configuration parameter to support the stream module.
./configure --with-http_ssl_module --with-http_v2_module  --with-stream
make
sudo make install
# By default, the NGINX server is installed in the /usr/local/nginx/ directory. Specify the configurations.
sudo sh -c bash
cat << EOF >  /usr/local/nginx/conf/hdm-master.conf
worker_processes auto;
events {
    worker_connections  1024;
}
stream {
    upstream backend {
        #  DAS endpoint
        server master-hdm-cn-shenzhen.aliyuncs.com:80            max_fails=3 fail_timeout=30s;
        hash $remote_addr consistent;
    }
    server {
        listen 80;
        # Specify a timeout value of over seven seconds to prevent connection timeout errors for the DBGateway.
        proxy_connect_timeout 10s;
        proxy_timeout 10s;
        proxy_pass backend;
    }
}
EOF
# Run NGINX.
sudo /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/hdm-master.conf