%E2%80%9D.png)
幾週前,我將 MacBook Pro 13" 更新為 Lion。我剛剛發現 Apache Bench (apache2.2.19) 無法運作。無論如何,它總是顯示這個錯誤:
apr_socket_recv:連線被對等方重設 (54)
我還在我的 Mac Mini 上進行了全新安裝,但也出現了同樣的錯誤。
我怎樣才能解決這個問題?
答案1
答案2
這是由於與 Lion 捆綁在一起的 Apache 軟體中的錯誤造成的。更新版本的 Apache(測試版)修復了這個問題。若要修復 ab,請執行以下步驟:
下載最新版本的 Apache
$ wget http://apache.mirrors.pair.com//httpd/httpd-2.3.16-beta.tar.bz2
如果 2.3.16 不可用,請轉至http://apache.mirrors.pair.com/httpd並獲取最新的
安裝 PCRE(為此需要brew)
$ brew install pcre
建構阿帕契
$ tar xzvf httpd-2.3.16-beta.tar.bz2 $ cd httpd-2.3.16-beta $ ./configure $ make
用新建的 ab 覆蓋現有的 ab
$ sudo cp support/ab /usr/sbin
答案3
您是否嘗試使用:127.0.0.1
而不是 localhost?
如果我不在http://
前面寫 url,我的 ab 也會失敗。
答案4
我在 Mountain Lion ab v2.3 上遇到了同樣的錯誤,並且幾乎準備好按照上述答案之一的指示安裝brew和最新版本的ab了。在最終走那條路之前我嘗試過添加尾部斜杠。
user$ ab http://dl.cubrid.org
ab: invalid URL
Usage: ab [options] [http[s]://]hostname[:port]/path
在上面的訊息中,請注意輸入 URL 的所需格式。可選組件以方括號標記,但請注意/小路部分似乎是不是選修的。所以我假設如果我正在測試根域,我至少應該添加尾部斜杠,這確實起到了作用!我希望這對你也有幫助。
user$ ab dl.cubrid.org/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking dl.cubrid.org (be patient).....done
Server Software:
Server Hostname: dl.cubrid.org
Server Port: 80
Document Path: /
Document Length: 13437 bytes
Concurrency Level: 1
Time taken for tests: 0.863 seconds
Complete requests: 1
Failed requests: 0
Write errors: 0
Total transferred: 13606 bytes
HTML transferred: 13437 bytes
Requests per second: 1.16 [#/sec] (mean)
Time per request: 862.778 [ms] (mean)
Time per request: 862.778 [ms] (mean, across all concurrent requests)
Transfer rate: 15.40 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 207 207 0.0 207 207
Processing: 655 655 0.0 655 655
Waiting: 234 234 0.0 234 234
Total: 862 862 0.0 862 862