Форум программистов, компьютерный форум, киберфорум
Ruby
Войти
Регистрация
Восстановить пароль
Карта форума Темы раздела Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 4.94/18: Рейтинг темы: голосов - 18, средняя оценка - 4.94
0 / 0 / 0
Регистрация: 26.11.2016
Сообщений: 2
1

Unicorn.sock failed 111 connection refused

26.11.2016, 12:08. Показов 3342. Ответов 1
Метки нет (Все метки)

Author24 — интернет-сервис помощи студентам
Приветствую!
ОЧЕНЬ прошу помощи. Я в ruby не силён и мне сложно понять, где ошибка.
Мы в процессе переноса серверов на другой VDS + недавно слетели все А-записи на домене
Есть сервер, имеющий внешний IP адрес и внутренний 10.1.1.12. на нём находятся домены api.server.info и server.info
error.log nginx с внешнего сервера
Код
2016/11/26 11:27:25 [error] 24345#0: *2913 connect() to unix:/home/deployer/api/shared/tmp/sockets/unicorn.sock failed (111: Connection refused) while connecting to upstream, client: 66.249.64.76, server: api.server.info, request: "GET /companies/7815020097/claims/5822/solutions HTTP/1.1", upstream: "http://unix:/home/deployer/api/shared/tmp/sockets/unicorn.sock:/companies/7815020097/claims/5822/solutions", host: "api.server.info"
2016/11/26 11:27:25 [error] 24345#0: *2914 connect() to unix:/home/deployer/api/shared/tmp/sockets/unicorn.sock failed (111: Connection refused) while connecting to upstream, client: 66.249.64.81, server: api.server.info, request: "GET /robots.txt HTTP/1.1", upstream: "http://unix:/home/deployer/api/shared/tmp/sockets/unicorn.sock:/robots.txt", host: "api.server.info"
2016/11/26 11:29:55 [error] 24345#0: *2920 connect() to unix:/home/deployer/api/shared/tmp/sockets/unicorn.sock failed (111: Connection refused) while connecting to upstream, client: 66.249.76.78, server: api.server.info, request: "GET /companies/7703270067-135ce8fc-278c-4213-ace1-61ad80b0f092/claims?show_only=solved HTTP/1.1", upstream: "http://unix:/home/deployer/api/shared/tmp/sockets/unicorn.sock:/companies/7703270067-135ce8fc-278c-4213-ace1-61ad80b0f092/claims?show_only=solved", host: "api.server.info"
2016/11/26 11:32:25 [error] 24343#0: *2924 connect() to unix:/home/deployer/api/shared/tmp/sockets/unicorn.sock failed (111: Connection refused) while connecting to upstream, client: 66.249.76.120, server: server.info, request: "GET /robots.txt HTTP/1.1", upstream: "http://unix:/home/deployer/api/shared/tmp/sockets/unicorn.sock:/robots.txt", host: "server.info"
2016/11/26 11:32:25 [error] 24343#0: *2926 connect() to unix:/home/deployer/api/shared/tmp/sockets/unicorn.sock failed (111: Connection refused) while connecting to upstream, client: 66.249.64.27, server: server.info, request: "GET /companies/7724261610-181a0690-4d45-454a-b9f6-a038cf4dc29d/certificates HTTP/1.1", upstream: "http://unix:/home/deployer/api/shared/tmp/sockets/unicorn.sock:/companies/7724261610-181a0690-4d45-454a-b9f6-a038cf4dc29d/certificates", host: "server.info"
2016/11/26 11:33:17 [error] 24343#0: *2928 connect() to unix:/home/deployer/api/shared/tmp/sockets/unicorn.sock failed (111: Connection refused) while connecting to upstream, client: 66.249.76.118, server: server.info, request: "GET /companies/2310031475-5dc7ac1b-4723-438a-b795-4ee219637197 HTTP/1.1", upstream: "http://unix:/home/deployer/api/shared/tmp/sockets/unicorn.sock:/companies/2310031475-5dc7ac1b-4723-438a-b795-4ee219637197", host: "server.info"
2016/11/26 11:33:56 [error] 24343#0: *2930 connect() to unix:/home/deployer/api/shared/tmp/sockets/unicorn.sock failed (111: Connection refused) while connecting to upstream, client: 157.55.39.174, server: server.info, request: "GET /companies/2310031475-05c0ae62-b441-42df-873d-9b301fd3fb48/contacts HTTP/1.1", upstream: "http://unix:/home/deployer/api/shared/tmp/sockets/unicorn.sock:/companies/2310031475-05c0ae62-b441-42df-873d-9b301fd3fb48/contacts", host: "server.info"
2016/11/26 11:34:17 [error] 24342#0: *2932 connect() to unix:/home/deployer/api/shared/tmp/sockets/unicorn.sock failed (111: Connection refused) while connecting to upstream, client: 157.55.39.174, server: server.info, request: "GET /companies/5036045205-91472316-e872-4b1c-bc84-f11581310120/claims/328 HTTP/1.1", upstream: "http://unix:/home/deployer/api/shared/tmp/sockets/unicorn.sock:/companies/5036045205-91472316-e872-4b1c-bc84-f11581310120/claims/328", host: "server.info"
2016/11/26 11:34:55 [error] 24342#0: *2934 connect() to unix:/home/deployer/api/shared/tmp/sockets/unicorn.sock failed (111: Connection refused) while connecting to upstream, client: 66.249.76.118, server: server.info, request: "GET /companies/164705052790/certificates HTTP/1.1", upstream: "http://unix:/home/deployer/api/shared/tmp/sockets/unicorn.sock:/companies/164705052790/certificates", host: "server.info"
2016/11/26 11:37:04 [error] 24342#0: *2938 connect() to unix:/home/deployer/api/shared/tmp/sockets/unicorn.sock failed (111: Connection refused) while connecting to upstream, client: 157.55.39.88, server: server.info, request: "GET /companies/2310031475-8c540868-cd78-4063-a867-d690ea80eab0/employees HTTP/1.1", upstream: "http://unix:/home/deployer/api/shared/tmp/sockets/unicorn.sock:/companies/2310031475-8c540868-cd78-4063-a867-d690ea80eab0/employees", host: "server.info"
error.log nginx на внутреннем сервере
Код
2016/11/26 11:37:02 [warn] 1105#0: *746 an upstream response is buffered to a temporary file /var/cache/nginx/proxy_temp/5/13/0000000135 while reading upstream, client: 10.1.1.12, server: _, request: "GET / HTTP/1.0", upstream: "http://unix:/home/deployer/shared/tmp/sockets/unicorn.sock:/", host: "server.info"
2016/11/26 11:41:29 [warn] 1105#0: *750 an upstream response is buffered to a temporary file /var/cache/nginx/proxy_temp/6/13/0000000136 while reading upstream, client: 10.1.1.12, server: _, request: "GET / HTTP/1.0", upstream: "http://unix:/home/deployer/shared/tmp/sockets/unicorn.sock:/", host: "www.server.info", referrer: "http://www.server.info"
2016/11/26 11:41:30 [warn] 1105#0: *752 an upstream response is buffered to a temporary file /var/cache/nginx/proxy_temp/7/13/0000000137 while reading upstream, client: 10.1.1.12, server: _, request: "GET / HTTP/1.0", upstream: "http://unix:/home/deployer/shared/tmp/sockets/unicorn.sock:/", host: "www.server.info"
2016/11/26 11:41:36 [warn] 1104#0: *794 an upstream response is buffered to a temporary file /var/cache/nginx/proxy_temp/8/13/0000000138 while reading upstream, client: 10.1.1.12, server: _, request: "GET /companies HTTP/1.0", upstream: "http://unix:/home/deployer/shared/tmp/sockets/unicorn.sock:/companies", host: "www.server.info", referrer: "http://www.server.info/companies"
2016/11/26 11:41:36 [warn] 1104#0: *800 an upstream response is buffered to a temporary file /var/cache/nginx/proxy_temp/9/13/0000000139 while reading upstream, client: 10.1.1.12, server: _, request: "GET /companies HTTP/1.0", upstream: "http://unix:/home/deployer/shared/tmp/sockets/unicorn.sock:/companies", host: "www.server.info"
2016/11/26 11:41:38 [warn] 1104#0: *824 an upstream response is buffered to a temporary file /var/cache/nginx/proxy_temp/0/14/0000000140 while reading upstream, client: 10.1.1.12, server: _, request: "GET / HTTP/1.0", upstream: "http://unix:/home/deployer/shared/tmp/sockets/unicorn.sock:/", host: "www.server.info", referrer: "http://www.server.info/"
2016/11/26 11:41:39 [warn] 1104#0: *828 an upstream response is buffered to a temporary file /var/cache/nginx/proxy_temp/1/14/0000000141 while reading upstream, client: 10.1.1.12, server: _, request: "GET / HTTP/1.0", upstream: "http://unix:/home/deployer/shared/tmp/sockets/unicorn.sock:/", host: "www.server.info"
2016/11/26 11:41:40 [warn] 1104#0: *834 an upstream response is buffered to a temporary file /var/cache/nginx/proxy_temp/2/14/0000000142 while reading upstream, client: 10.1.1.12, server: _, request: "GET /claims HTTP/1.0", upstream: "http://unix:/home/deployer/shared/tmp/sockets/unicorn.sock:/claims", host: "www.server.info", referrer: "http://www.server.info/claims"
2016/11/26 11:41:41 [warn] 1104#0: *840 an upstream response is buffered to a temporary file /var/cache/nginx/proxy_temp/3/14/0000000143 while reading upstream, client: 10.1.1.12, server: _, request: "GET /claims HTTP/1.0", upstream: "http://unix:/home/deployer/shared/tmp/sockets/unicorn.sock:/claims", host: "www.server.info"
/home/deployer/current/log/unicorn.stderr.log
Код
I, [2016-11-26T03:05:17.273717 #893]  INFO -- : unlinking existing socket=/home/deployer/shared/tmp/sockets/unicorn.sock
I, [2016-11-26T03:05:17.274281 #893]  INFO -- : listening on addr=/home/deployer/shared/tmp/sockets/unicorn.sock fd=14
I, [2016-11-26T03:05:17.274468 #893]  INFO -- : listening on addr=0.0.0.0:8087 fd=15
I, [2016-11-26T03:05:17.282013 #2005]  INFO -- : worker=0 ready
I, [2016-11-26T03:05:17.285332 #2008]  INFO -- : worker=1 ready
I, [2016-11-26T03:05:17.289500 #2011]  INFO -- : worker=2 ready
I, [2016-11-26T03:05:17.292579 #2014]  INFO -- : worker=3 ready
I, [2016-11-26T03:05:17.295932 #2017]  INFO -- : worker=4 ready
I, [2016-11-26T03:05:17.299011 #2020]  INFO -- : worker=5 ready
I, [2016-11-26T03:05:17.302195 #2023]  INFO -- : worker=6 ready
I, [2016-11-26T03:05:17.305498 #2026]  INFO -- : worker=7 ready
I, [2016-11-26T03:05:17.309347 #893]  INFO -- : master process ready
I, [2016-11-26T03:05:17.309675 #2029]  INFO -- : worker=8 ready
I, [2016-11-26T03:05:17.312576 #2032]  INFO -- : worker=9 ready
X-Accel-Mapping header missing
......
X-Accel-Mapping header missing
E, [2016-11-26T09:27:38.568021 #893] ERROR -- : worker=9 PID:2032 timeout (121s > 120s), killing
E, [2016-11-26T09:27:38.582953 #893] ERROR -- : reaped #<Process::Status: pid 2032 SIGKILL (signal 9)> worker=9
I, [2016-11-26T09:27:38.617721 #6779]  INFO -- : worker=9 ready
настройки nginx для домена api.server.info (10.1.1.12)
Код
upstream mainapp {
    server unix:/home/deployer/api/shared/tmp/sockets/unicorn.sock fail_timeout=0;
}
server {
    listen	 443 ssl;
    server_name  api.server.info;
    ssl on;
  ssl_certificate /etc/letsencrypt/live/api.server.info/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/api.server.info/privkey.pem;
    include             ssl_params;
    charset utf-8;
    client_max_body_size 0;
    set $app_root_path /home/deployer/api/;
    access_log  /var/log/nginx/api.access.log;
    root        $app_root_path/current/public;
    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        #pass to the upstream unicorn server mentioned above
        proxy_pass  [url]http://mainapp;[/url]
    }
    location ~ ^/uploads/  {
        root $app_root_path/current/public;
        gzip_static on;
        expires max;
        add_header Cache-Control public;
        # access_log /dev/null;
    }
}
server {
  listen 80;
  server_name api.server.info;
  rewrite ^ https://api.server.info$request_uri? permanent;
}
настройки nginx на внутреннем сервере (10.1.1.11), обрабатывающий запросы
Код
upstream mainapp {
    server unix:/home/deployer/shared/tmp/sockets/unicorn.sock;
}
server {
    listen	 80 default deferred;
    server_name  _;
    charset utf-8;
    client_max_body_size 0;
    set $app_root_path /home/deployer/;
    access_log  /var/log/nginx/mainapp.access.log;
    root        /home/deployer/current/public;
    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        #pass to the upstream unicorn server mentioned above
        proxy_pass  http://mainapp;
    }
    location ~ ^/assets/  {
        root $app_root_path/current/public;
        gzip_static on;
        expires max;
        add_header Cache-Control public;
        # access_log /dev/null;
    }
}
на внешнем сервере
ls -l /home/deployer/api/shared/tmp/sockets/unicorn.sock
srwxrwxrwx 1 deployer deployer 0 май 14 2016 /home/deployer/api/shared/tmp/sockets/unicorn.sock
на внутреннем сервере
ls -l /home/deployer/shared/tmp/sockets/unicorn.sock
srwxrwxrwx 1 deployer deployer 0 ноя 26 03:05 /home/deployer/shared/tmp/sockets/unicorn.sock
less /home/deployer/current/config/unicorn/production.rb
Код
worker_processes 10
working_directory "/home/deployer/current" # available in 0.94.0+
listen "/home/deployer/shared/tmp/sockets/unicorn.sock", :backlog => 64
listen 8087, :tcp_nopush => true
timeout 120
pid "/home/deployer/shared/tmp/pids/unicorn.pid"

stderr_path "/home/deployer/shared/log/unicorn.stderr.log"
stdout_path "/home/deployer/shared/log/unicorn.stdout.log"
preload_app true
GC.respond_to?(:copy_on_write_friendly=) and
  GC.copy_on_write_friendly = true

check_client_connection false
before_fork do |server, worker|
  # the following is highly recomended for Rails + "preload_app true"
  # as there's no need for the master process to hold a connection
  defined?(ActiveRecord::Base) and
    ActiveRecord::Base.connection.disconnect!
  old_pid = "#{server.config[:pid]}.oldbin"
  if old_pid != server.pid
    begin
      sig = (worker.nr + 1) >= server.worker_processes ? :QUIT : :TTOU
      Process.kill(sig, File.read(old_pid).to_i)
    rescue Errno::ENOENT, Errno::ESRCH
    end
  end
end
after_fork do |server, worker|
  # per-process listener ports for debugging/admin/migrations
  # addr = "127.0.0.1:#{9293 + worker.nr}"
  # server.listen(addr, :tries => -1, :delay => 5, :tcp_nopush => true)
  # the following is *required* for Rails + "preload_app true",
  defined?(ActiveRecord::Base) and
    ActiveRecord::Base.establish_connection
  # if preload_app is true, then you may also want to check and
  # restart any other shared sockets/descriptors such as Memcached,
  # and Redis.  TokyoCabinet file handles are safe to reuse
  # between any number of forked children (assuming your kernel
  # correctly implements pread()/pwrite() system calls)
end
0
Programming
Эксперт
94731 / 64177 / 26122
Регистрация: 12.04.2006
Сообщений: 116,782
26.11.2016, 12:08
Ответы с готовыми решениями:

SMTP yandex connection refused 111
Доброго дня, уважаемые формумчане. Столкнулся с проблемой отправки почты через PHP с помощью...

VK Oauth failed to open stream: Connection refused
Почему появляется такая ошибка? $params = array( 'uids' =&gt; $token, ...

Status : Failure -Test failed: Listener refused the connection with the following error: ORA-12505, TNS:listener does not currently know of SID given
listener.ora: SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) ...

Connection refused
Привет всем. Проблема в следующем. Создаю базу данных на бесплатном хостинге. Написано, что у...

1
0 / 0 / 0
Регистрация: 26.11.2016
Сообщений: 2
26.11.2016, 12:28  [ТС] 2
внутренний сервер примонтирован через NFS
Код
10.1.1.11:/home/deployer/shared on /home/deployer/shared type nfs (rw,relatime,vers=3,rsize=524288,wsize=524288,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=10.1.1.11,mountvers=3,mountport=20048,mountproto=tcp,local_lock=none,addr=10.1.1.11)
порты открыты. но как оценить работосопосбность скрипта не знаю
с внешнего сервера подключаюсь к порту 8087
Код
telnet 10.1.1.11 8087
Trying 10.1.1.11...
Connected to 10.1.1.11.
Escape character is '^]'.
sss
HTTP/1.1 400 Bad Request
сервисы на внутреннем сервере
Код
sudo netstat -tpln | grep "tcp"
tcp        0      0 0.0.0.0:2049            0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:10050           0.0.0.0:*               LISTEN      1084/zabbix_agentd  
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1082/rpcbind        
tcp        0      0 0.0.0.0:20048           0.0.0.0:*               LISTEN      2373/rpc.mountd     
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      1101/nginx: master  
tcp        0      0 0.0.0.0:37206           0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1065/sshd           
tcp        0      0 0.0.0.0:8087            0.0.0.0:*               LISTEN      893/unicorn master  
tcp6       0      0 :::51772                :::*                    LISTEN      -                   
tcp6       0      0 :::2049                 :::*                    LISTEN      -                   
tcp6       0      0 :::111                  :::*                    LISTEN      1082/rpcbind        
tcp6       0      0 :::20048                :::*                    LISTEN      2373/rpc.mountd     
tcp6       0      0 :::22                   :::*                    LISTEN      1065/sshd

ВОЗМОЖНО проблема с ipv6 адресами. при переносе отключил их так как ругались другие сервисы. НО это догадка
0
26.11.2016, 12:28
IT_Exp
Эксперт
87844 / 49110 / 22898
Регистрация: 17.06.2006
Сообщений: 92,604
26.11.2016, 12:28
Помогаю со студенческими работами здесь

Connection refused
Всем доброго дня. Ситуация следующая: перевел веб-сервер со связки openserver-windows server на...

PeriodicalUpdater!!!! Connection refused?
здрасте. Очень нужна помощь. Я использую prototype -&gt; PeriodicalUpdater но в случае сбоя связи с...

Ошибка: WebSocket connection to 'wss://localhost:8777/' failed: Error in connection establishment: net::ERR_CONNECTION_R
На локальном сервере работает, на нормальном нет. Без SSL не работало, подключил, тоже не...

Connection refused: connect в java.net.Socket
\о Работая над сокетным чатом, столкнулся с такой проблемой: при Socket ss = new Socket(host,...

java.net.ConnectException: Connection refused: connect
сервер-клиент,при запуске проги выдается ошибка в консоли приложения: java.net.ConnectException:...

Indy 10 TCPServer/TCPClient Error #10061 Connection refused
Я написал сервер и клиент на indy 10, при использовании в клиенте локального IP сервера всё...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
2
Ответ Создать тему
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2024, CyberForum.ru