A
A
Alexander Globov2014-06-16 08:29:29
PHP
Alexander Globov, 2014-06-16 08:29:29

How to track why curl connects to the server every other time?

Hello. There are 2 servers. One in Germany, one in Kazakhstan. Both are running Debian 7. Once every 10 minutes, the German server runs to Kazakhstan for data and saves it in Redis. The data is collected via php + curl.
Everything has been set up and working for a long time, but recently a problem has appeared: about one time out of three, curl cannot connect to the server. The response comes back: "curl: (7) couldn't connect to host". At the same time, the Kazakhstani server pings perfectly both from the home machine and from the German server. No work was done on the servers before the error appeared and no new packages were installed, except for updates.
Both providers claim that there are no problems with the network on their part.
Tell me, in which direction to dig to find the cause?
nginx config

upstream backend {
  server 127.0.0.1:88;
}

##
# Virtual Host Configs
##

server {
  listen    ipaddress:80;
  server_name domain.kz; 
  access_log  /var/log/nginx/domain.access.log;
  server_name_in_redirect off;
  
  location ~ /\.ht {
    deny  all;
  }

  location / {
    proxy_pass      http://backend/;
    proxy_redirect    off;
    proxy_set_header  Host $host;
    proxy_set_header  X-Real-IP $remote_addr;
    proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
    client_max_body_size 10m;
    proxy_connect_timeout 120;
    proxy_send_timeout 120;
    proxy_read_timeout 180;
  }

  location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|js)$ {
    root /var/www/domain.kz/www/;
  }
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Globov, 2014-07-11
@sanekglobov

The problem was with the route of the packets. Sometimes the route changed to a non-working one and packets were lost. It turned out to find the reason with the help of the wonderful utility mtr. Changing the announcement of ip-addresses could help, but the provider said that he could not do this. Apparently, at the same time, on the problematic route, the knot was repaired and the problem was solved by itself.

M
Maxim Barulin, 2014-06-16
@Slavenin999

let traffic through a proxy and watch the logs

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question