1

I build 2 searchd instance on different server(namely A and B) and build a distributed index on A. However, when I query A from client, I only got result from A's index. My problem is I cannot get result from B' index, I am pretty sure I configure correct.

I tried: * replace hostname with IP adresses * I am pretty sure that I have not get result from B's index

A's sphinx.conf

index distributed_index
{
    type = distributed
    local = A_index
    agent = 192.168.13.189:9312:B_index
    agent_connect_timeout = 1000
    agent_query_timeout = 3000
}

client query code(python)

import sphinxapi
sphinx_host = 'A'
sphinx_port = 9312
SphinxClient = sphinxapi.SphinxClient()
SphinxClient.SetServer(sphinx_host,sphinx_port)
SphinxClient.SetMatchMode(sphinxapi.SPH_MATCH_EXTENDED)
res = SphinxClient.Query("")

when I indexer --all --rotate, got a WARNING:skipping non-plain index 'distributed_index'

I expect results from both from A and B when I query from client.

Tianxu
  • 61
  • 5
  • Have you tried connecting **direct** to B and see if can run the query on its own? To Check if B is itself working. narrow down if issue is with B or with A :) – barryhunter Sep 17 '19 at 13:18
  • Yes, I did. I can get the result from B's index when I connect B directly. I am realy confused... – Tianxu Sep 18 '19 at 00:58

1 Answers1

1

I got it guys, I got it!

The problem is not on the server(A&B), I configured them correctly. It is becacuse I am not familiar with the API.Query() API need to specify the key words as well as the queried index.

res = SphinxClient.Query("","distributed_index_name") gives me the correct result!

If you encounter similar problems, be free to ask, I am happy to help.

Tianxu
  • 61
  • 5
  • Ah I see, checking the documentation *Default value for $index is `*` that means to query all local indexes.* - also never noticed it explicitly says **local** indexes, so wouldn't of included the distributed index, only queried `A_index` *directly*. To search a distributed index would have to name it! (also avoids searching, A_index twice ;P) – barryhunter Sep 18 '19 at 10:56