这几天在部署sphinx,但是遇到了意外的问题,希.望有类似经验.的给点提示~ 电子
基本状况:
1.A主机:www服务器(apach.e),B主机:数据服务器(mys.ql+sphinx);<性病>
2.mysql.的数据连接,以及取sphinx相关索引都能.连接成功; 电子
3.当.A主机上面的页面连接请求B主机上面的sp.hinx的索引数据的时候,出错率在20%左右(我用有无返回数据来判断,详细见.代码)。服务器
. 为了说明是不是数据源的问题(mysql+sphinx),我还在c主机上放了同样的代码,获取数据无错误。.电影
4.考虑到数据获取.端口因素, 我在A主机.上做了一个简单测试:让A主机的一个页面通过url去读取B主机上面的一个页面,看返回值的情况。这个测试同样也.出错,错误率也在20%左右。 女人
. 域名
期间我曾怀疑过服务器的处理能力,导致处理数据超时,然后数.据包被扔掉等等。但是cpu的使用率是很低的,内存使用率在90%左右(为了减少磁盘.IO).,服务器A的下行流量也只有2.4Mb/s。 鲜花
没有数据能直接说明是内存和下行流量的原因,看起来似.乎是这两个主机的网络连接有问题,但是很.快就被下面的测试否定了.
. .
. 5.刚才还做了一个A主机取B主机mysql数据的测试,这个没任何问题。同时A ping B,B ping A 都没lo.ss.
到目前为止没找到原因,.感觉要失去方向了,请大家帮帮.忙~给点启发什么的(广告)
如果我没说清楚的.或者不专业的地方请见谅,.今天一直在线。投资
<?php
//A主机上请求B主机s.phinx索引数据测试代码.
e.rror_reporting(E_ALL); 外汇
ini_se.t("display_errors",.1);--- 印刷
inc.lude_once("inc/sphinx.api.php"); 女人
$cl .= new Sph.inxClient (); 外汇
$cl.->.SetServer('B-host',3312);投资
$cl->SetMatchMode(SPH_MA.TCH._ALL); 美容
$cl->SetLim.its(0,50); 建材
$res = $cl->Query ( "Ge.tting Bigger and Bett.er", "main" );虚拟主机
if(is_arra.y($res)){.
 .; $out="O.K"; 建材
}else{
&.nbsp;  .;$out="Error";.
}
$handl.e = fopen('_manage_/.orders/sphinx_log.html','a'); 乙肝
$now = date("h.:i:s");
fwrite($handle,"<br><br>".$now."---------.------------".$o.ut);服务器
fclose($ha.ndle); 鲜花
echo '<html><head><meta http-equiv="refresh" c.ontent="10;URL=/test..php></head></html>'.; 健康
?>
<?php
//A主机上通过url读取B主机一个页面的测.试代码 建材
error_report.ing(E_ALL);服务器
i.ni_set("display._errors",1); 电子
$a = file_get_contents("http://www.****.com/test/postinfo.html");服务器
if(strpos($a,"The HTML co.mments in this page contain. the configurat.ioninformation")){ 鲜花
$ou.t="OK".; .
}else{
&.nbsp; $o.ut="Error";( 游戏 )
}
$handle = fopen('_.manage_/orders/13.112_log.html','a'); 鲜花
$now = date("h:i:s."); 美容
fwrite($handle,"<br><br>"..$now."--------------.-------".$out); 建材
fclose($handl.e);.
echo '<html><head><meta http-eq.uiv="refresh" content="5;URL=tes.t44.php></head></ht.ml>';.
?>
<?php
//放在A主.机上的请求B主机mysql数.据的测试代码电脑
error._reporting(E_ALL);虚拟主机
ini_.set("displa.y_errors",1); 健康
 .; $d.b_user="";虚拟主机
&.nb.sp; $db_pass="";服务器
&nbs.p; $d.b_name="";电脑
&.nbsp; &nbs.p;$db_host=""; 健康
&nb.sp;mysql_connect($db_host,$db_user,.$db_pass);域名
&nbs..p; mysql_select_db($db_name);域名
$query = "SE.LECT * FROM table li.mit 10"; 鲜花
$result = m.ysql_q.uery($query);--- 印刷
while($array.=my.sql_fetch_array($result)){域名
$o.ut_array[]=$array.; &nb.sp; 虚拟主机
 .; } 女人
if(.count($out_array)>5){ 鲜花
&nb.sp; $out="OK"; . 女人
}else{
&n.bsp;$ou.t="Error";外贸
}
$handle = fopen('_manage_./orders/db_log.html','a.');
$now = date("h:i:s".); 建材
fwrite($hand.le,"<br><br>".$no.w."---------------------".$out); 杀毒
fclose($.handle);.
echo '<html><head><meta http-equiv="refresh" c.ontent="5;URL=test.77.php>.</head></html>'; 乙肝
?>
[ 本帖.最后由 alexyandy_unix 于 2009-5-15 .11:02 编辑 ] 女人