いつもお世話になっております。
スクレイピングを使用したプログラムを作成しているのですが、突然下記のようなエラーログを出力され、動作が中断されるようになってしまいました。
/usr/local/rbenv/versions/2.3.1/lib/ruby/2.3.0/net/http.rb:882:in `rescue in block in connect': Failed to open TCP connection to 127.0.0.1:8910 (Connection refused - connect(2) for "127.0.0.1" port 8910) (Errno::ECONNREFUSED) from /usr/local/rbenv/versions/2.3.1/lib/ruby/2.3.0/net/http.rb:879:in `block in connect' from /usr/local/rbenv/versions/2.3.1/lib/ruby/2.3.0/timeout.rb:91:in `block in timeout' from /usr/local/rbenv/versions/2.3.1/lib/ruby/2.3.0/timeout.rb:101:in `timeout' from /usr/local/rbenv/versions/2.3.1/lib/ruby/2.3.0/net/http.rb:878:in `connect' from /usr/local/rbenv/versions/2.3.1/lib/ruby/2.3.0/net/http.rb:863:in `do_start' from /usr/local/rbenv/versions/2.3.1/lib/ruby/2.3.0/net/http.rb:852:in `start' from /usr/local/rbenv/versions/2.3.1/lib/ruby/2.3.0/net/http.rb:584:in `start' from /var/www/html/Ruby/Application/ReviewList/vendor/bundle/ruby/2.3.0/gems/selenium-webdriver-3.3.0/lib/selenium/webdriver/common/service.rb:93:in `connect_to_server' from /var/www/html/Ruby/Application/ReviewList/vendor/bundle/ruby/2.3.0/gems/selenium-webdriver-3.3.0/lib/selenium/webdriver/common/service.rb:116:in `stop_server' from /var/www/html/Ruby/Application/ReviewList/vendor/bundle/ruby/2.3.0/gems/selenium-webdriver-3.3.0/lib/selenium/webdriver/common/service.rb:79:in `stop' from /var/www/html/Ruby/Application/ReviewList/vendor/bundle/ruby/2.3.0/gems/selenium-webdriver-3.3.0/lib/selenium/webdriver/common/service.rb:69:in `block in start' from /var/www/html/Ruby/Application/ReviewList/vendor/bundle/ruby/2.3.0/gems/selenium-webdriver-3.3.0/lib/selenium/webdriver/common/platform.rb:138:in `block in exit_hook'
エラーログを見た感じ、接続先に接続を拒否されているように見えますが、対象サイトには問題なくアクセス出来ているようでスクリーンショットでページを確認する事が出来ました。
###試した事
別のサイトにも接続を試みたのですが、上記と同じログが出力されます
スクレイピングのプログラムを複数、crontabでスケジュール設定しているのですが全て同様のエラーで接続を断たれています。(接続先のサイトは、バラバラです。)
###最初にエラーが発生する前に行った事
サーバーへのログインを間違ってしまいFail2Banというソフトに自分のIPアドレスがブロックされてしまいました。
しかし、問題なくログイン出来ます。
プログラムを実行中のfail2banのログを確認する下記のようになっております。
2017-04-05 17:05:17,424 fail2ban.filter [17023]: WARNING Unable to find a corresponding IP address for : [Errno -2] Name or service not known 2017-04-05 17:09:25,138 fail2ban.filter [17023]: WARNING Unable to find a corresponding IP address for : [Errno -2] Name or service not known 2017-04-05 17:13:04,717 fail2ban.filter [17023]: WARNING Unable to find a corresponding IP address for : [Errno -2] Name or service not known 2017-04-05 17:17:06,986 fail2ban.filter [17023]: WARNING Unable to find a corresponding IP address for : [Errno -2] Name or service not known 2017-04-05 17:20:34,367 fail2ban.filter [17023]: WARNING Unable to find a corresponding IP address for : [Errno -2] Name or service not known 2017-04-05 17:23:19,781 fail2ban.filter [17023]: WARNING Unable to find a corresponding IP address for : [Errno -2] Name or service not known 2017-04-05 17:28:05,015 fail2ban.filter [17023]: WARNING Unable to find a corresponding IP address for : [Errno -2] Name or service not known 2017-04-05 17:32:38,703 fail2ban.filter [17023]: WARNING Unable to find a corresponding IP address for : [Errno -2] Name or service not known 2017-04-05 17:40:13,509 fail2ban.filter [17023]: WARNING Unable to find a corresponding IP address for : [Errno -2] Name or service not known 2017-04-05 17:43:24,615 fail2ban.filter [17023]: WARNING Unable to find a corresponding IP address for : [Errno -2] Name or service not known 2017-04-05 17:47:13,938 fail2ban.filter [17023]: WARNING Unable to find a corresponding IP address for : [Errno -2] Name or service not known 2017-04-05 17:47:27,579 fail2ban.filter [17023]: WARNING Unable to find a corresponding IP address for : [Errno -2] Name or service not known 2017-04-05 17:50:57,364 fail2ban.filter [17023]: WARNING Unable to find a corresponding IP address for : [Errno -2] Name or service not known
###追記 iptable
iptable -Lを打った結果が下記になります。
Chain INPUT (policy ACCEPT) target prot opt source destination f2b-dovecot-pop3imap tcp -- anywhere anywhere multiport dports pop3,imap f2b-SSH tcp -- anywhere anywhere tcp dpt:ssh RH-Firewall-1-INPUT all -- anywhere anywhere ACCEPT tcp -- anywhere anywhere tcp dpt:hbci ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:telnet Chain FORWARD (policy ACCEPT) target prot opt source destination RH-Firewall-1-INPUT all -- anywhere anywhere Chain OUTPUT (policy ACCEPT) target prot opt source destination Chain RH-Firewall-1-INPUT (2 references) target prot opt source destination ACCEPT all -- anywhere anywhere ACCEPT icmp -- anywhere anywhere icmp any ACCEPT esp -- anywhere anywhere ACCEPT ah -- anywhere anywhere ACCEPT udp -- anywhere 224.0.0.251 udp dpt:mdns ACCEPT udp -- anywhere anywhere udp dpt:ipp ACCEPT tcp -- anywhere anywhere tcp dpt:ipp ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:10022 ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:http ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:https ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:smtp ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:urd ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:submission ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:pop3 ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:pop3s ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:imap ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:imaps REJECT all -- anywhere anywhere reject-with icmp-host-prohibited Chain f2b-SSH (1 references) target prot opt source destination RETURN all -- anywhere anywhere Chain f2b-dovecot-pop3imap (1 references) target prot opt source destination RETURN all -- anywhere anywhere
###質問
書いたプログラムが全滅状態なので大変困っております。
何が原因なのか、どの辺りが怪しいのか調べていますが、未だ解決方法が見つかっております。
もし何か怪しい部分があればぜひ教えて下さい。
###環境
CentOS6
Ruby
Selenium
PhantomJS
回答1件
あなたの回答
tips
プレビュー