coreseek服务一直提示连接失败

dudochen 发布于 2014/10/27 11:06
阅读 943
收藏 0

php 连接 coreseek服务一直提示连接失败,提示没有权限,一直不知道是哪的权限出了问题。

$s = new SphinxClient();  

$server='192.168.211.130';
$port=9312;
$sp->SetServer($server,$port) or die("can't connect to sphinx");//建立
//$sp->setServer('192.168.211.130', '9312') or die("can't connect to sphinx");    //选择服务器
$sp->open();
var_dump($sp);
打印的信息:
object(SphinxClient)#1 (2) { ["error"]=> string(35) "connect() failed: Permission denied" ["warning"]=> string(0) "" }


直接在客户端下mysql -h localhost -P
Access denied for user 'root'@'localhost' (using password: NO)


直接在客户端下mysql -h localhost -P9312 -p123456( 这样是能直接连接数据库的)


后台服务:
/usr/local/coreseek/bin/indexer --all --rotate
total 3 docs, 7578 bytes
total 0.069 sec, 109518 bytes/sec, 43.35 docs/sec
total 2 reads, 0.000 sec, 4.9 kb/call avg, 0.0 msec/call avg
total 6 writes, 0.001 sec, 4.4 kb/call avg, 0.2 msec/call avg
rotating indices: succesfully sent SIGHUP to searchd (pid=3060).


/usr/local/coreseek/bin/search -a google  
1. 'google': 2 documents, 6 hits


telnet 192.168.211.130 9312
Trying 192.168.211.130...
Connected to 192.168.211.130.
Escape character is '^]'.
Connection closed by foreign host.


用的是centos6.4  PHP Version 5.3.3 mysql 5.1.73  
sphinx 1.3.0

#79 | 发表时间: 2014 10 26 10:30
回复  引用  修改

同时:网上所说的:fsockopen 问题我也大概测试了一下。
$fp = fsockopen("www.baidu.com", 80, $errno, $errstr, 30);
if (!$fp) {
    echo "$errstr ($errno)<br />\n";
} else {
    $out = "GET / HTTP/1.1\r\n";
    $out .= "Host: www.baidu.com\r\n";
    $out .= "Connection: Close\r\n\r\n";
    fwrite($fp, $out);
    while (!feof($fp)) {
        echo fgets($fp, 128);
    }
    fclose($fp);
}


返回结果是正确的。所以我自己认为不是fsockopen函数的问题。
HTTP/1.1 200 OK Date: Mon, 27 Oct 2014 02:32:34 GMT Content-Type: text/html Content-Length: 14613 Last-Modified: Mon, 01 Sep 2014 09:37:40 GMT Connection: Close Vary: Accept-Encoding Set-Cookie: BAIDUID=0203068533CD2A2D07DA347FB4404BD7:FG=1; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2147483647; path=/; domain=.baidu.com Set-Cookie: BAIDUPSID=0203068533CD2A2D07DA347FB4404BD7; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2147483647; path=/; domain=.baidu.com Set-Cookie: BDSVRTM=0; path=/ P3P: CP=" OTI DSP COR IVA OUR IND COM " Server: BWS/1.1 Pragma: no-cache Cache-control: no-cache BDPAGETYPE: 1 BDQID: 0x96dda8f50000d0dc BDUSERID: 0 Accept-Ranges: bytes
新闻hao123地图视频贴吧登录设置更多产品




加载中
返回顶部
顶部