gpt4 book ai didi

php - Sphinx 从 linux 控制台运行正常,但不是从 php api

转载 作者:可可西里 更新时间:2023-10-31 23:40:12 24 4
gpt4 key购买 nike

我的 sphinx 从 linux 控制台运行正常

This program (CLI search) is for testing and debugging purposes only;
it is NOT intended for production use.
[root@coinsaver sphinx]# search -i product -q iphone
Sphinx 2.1.8-id64-release (rel21-r4675)
Copyright (c) 2001-2014, Andrew Aksyonoff
Copyright (c) 2008-2014, Sphinx Technologies Inc (http://sphinxsearch.com)

using config file '/etc/sphinx/sphinx.conf'...
index 'product': query 'iphone ': returned 88 matches of 88 total in 0.014 sec

displaying matches:
1. document=205267, weight=2773
2. document=470963, weight=2696
3. document=432191, weight=1696
4. document=125460, weight=1642
5. document=186938, weight=1642
6. document=199461, weight=1642
7. document=222081, weight=1642
8. document=249572, weight=1642
9. document=310231, weight=1642
10. document=395051, weight=1642
11. document=395052, weight=1642
12. document=430649, weight=1642
13. document=438066, weight=1642
14. document=468067, weight=1642
15. document=470947, weight=1642
16. document=470961, weight=1642
17. document=471161, weight=1642
18. document=482581, weight=1642
19. document=484640, weight=1642
20. document=490590, weight=1642

words:
1. 'iphon': 88 documents, 97 hits

但在重新启动后,它无法从 PHP API 运行

$sphinx = new SphinxClient();
// options....
$result = $sphinx->Query("$string*", '*');

它返回错误。它在我重新启动我的服务器之前工作,看起来 Nginx 和 Sphinx 不再相处了,我什至不知道从哪里开始寻找......

结果searchd --status

searchd status
--------------
uptime: 361
connections: 1
maxed_out: 0
command_search: 0
command_excerpt: 0
command_update: 0
command_keywords: 0
command_persist: 0
command_status: 1
command_flushattrs: 0
agent_connect: 0
agent_retry: 0
queries: 0
dist_queries: 0
query_wall: 0.000
query_cpu: OFF
dist_wall: 0.000
dist_local: 0.000
dist_wait: 0.000
query_reads: OFF
query_readkb: OFF
query_readtime: OFF
avg_query_wall: 0.000
avg_query_cpu: OFF
avg_dist_wall: 0.000
avg_dist_local: 0.000
avg_dist_wait: 0.000
avg_query_reads: OFF
avg_query_readkb: OFF
avg_query_readtime: OFF

此外,自重启以来,sphinx 查询日志中没有任何条目。

最佳答案

啊哈!重新启动后,我的服务器决定将 Sphinx 的端口从 9312 更改为 3312 不要问我怎么做,我只是做了一个简单的重新启动。

我运行此命令以查看打开的端口 (CENTOS) $ netstat -tulpn |少

tcp        0      0 127.0.0.1:9000              0.0.0.0:*                   LISTEN      4928/php-fpm
tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN 1166/mongod
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 4645/mysqld
tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN 1565/svnserve
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 3428/nginx
-----------------------------------------------------------------------------------------
tcp 0 0 127.0.0.1:3312 0.0.0.0:* LISTEN 3278/searchd
-----------------------------------------------------------------------------------------
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 529/sshd
tcp 0 0 :::22 :::* LISTEN 529/sshd

所以通过改变这个

$sphinx->SetServer('localhost', 9312);

对此

$sphinx->SetServer('localhost', 3312);

我的噩梦结束了。因此,即使您有充分的理由重启您的生产服务器,您也应该三思而行并非常小心,特别是如果您不是 Linux 专家。

关于php - Sphinx 从 linux 控制台运行正常,但不是从 php api,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26564155/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com