S
S
Sergei Tolkachev2021-10-20 15:48:27
linux
Sergei Tolkachev, 2021-10-20 15:48:27

How to normally run spinx on the server?

I'm doing a search on the site. Windows locale. On it with dancing and a tambourine, but it was possible to launch the sphinx and it was possible to make modules / plugins for it. It's time to move to prod and adventure.
Given:
Sphinx 3.4.1 - located in /root/sphinx-3.4.1
File sphinx.conf - located in /etc/sphinxsearch/sphinx.conf

Content of sphinx.conf

#
# Minimal Sphinx configuration sample (clean, simple, functional)
#

source virt
{
    type            = mysql

    sql_host        = 127.0.0.1
    sql_user        = тут юзер
    sql_pass        = тут пароль
    sql_db          = тут имя базы
    sql_port        = 3306  # optional, default is 3306
  sql_query_pre	= SET NAMES utf8

    sql_query       = \
       SELECT ru.virtuemart_product_id as id,  ru.product_s_desc, ru.product_desc, ru.product_name, prod.product_sku \
        FROM e0bu9_virtuemart_products_ru_ru AS ru INNER JOIN e0bu9_virtuemart_products AS prod ON ru.virtuemart_product_id = prod.virtuemart_product_id 

}

index virtuemart
{
    source          = virt
    path            = /var/www/ЧАСТЬ_ПУТИ/data/sphinx/data/virt
  morphology      = stem_enru
  charset_table	= 0..9, A..Z->a..z, _, a..z, \
          U+410..U+42F->U+430..U+44F, U+430..U+44F, U+401->U+0435, U+451->U+0435
  blend_chars 	= +, U+23
  ignore_chars 	= U+AD
  min_word_len 	= 2
  html_strip 		= 1
}


indexer
{
    mem_limit       = 128M
}


searchd
{
    listen          = 9312
    log             = /var/log/sphinxsearch/searchd.log
    query_log       = /var/log/sphinxsearch/query.log
    read_timeout    = 5
    max_children    = 30
    pid_file        = /var/run/sphinxsearch/searchd.pid
    seamless_rotate = 1
    preopen_indexes = 1
    unlink_old      = 1
    workers         = threads # for RT to work
    binlog_path     = /var/www/ЧАСТЬ_ПУТИ/data/sphinx/data
}

Start indexing from /root/sphinx-3.4.1/bin/
indexer --all --config /etc/sphinxsearch/sphinx.conf
Indexing is working fine. Indexes lay down where it is necessary.

Run ./searchd --config /etc/sphinxsearch/sphinx.conf and the adventure begins.
Errors occur in a variety of ways. Most common:
1. Local index virtuemart not found.
I read that for this you need to restart the sphinx. Stopped, started with the indication of the config. We get:
~/sphinx-3.4.1/bin# ./searchd --config /etc/sphinxsearch/sphinx.conf
Sphinx 3.4.1 (commit efbcc65)
Copyright (c) 2001-2021, Andrew Aksyonoff
Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com)

using config file '/etc/sphinxsearch/sphinx.conf'...
listening on all interfaces, port=9312
precaching index 'virtuemart'
precached 1 indexes using 1 threads in 0.0 sec

However, the process may not start. It may not be in the ISP in network services, nor can it be seen by pgrep PID. If it starts, then the local index does not see. On the LAN, the same config (the paths are different, of course), works.
2. Problems when restarting: suddenly finds sphinxdata and my config at the same time, uses sphinxdata and does not find the config there.
It is treated by deleting once again sphinxdata, restarting. But this is very strange, since I specify the path to the config at startup.

I re-read a lot of almost non-existent Russian-language documentation and more abundant English-language documentation. But things are still there.
Tell me, please, how to run this CREATIVE!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Tolkachev, 2021-10-25
@sergeytolkachyov

So, the problem was solved by correcting the config. For some reason, the sphinx didn't like the paths I had previously provided for index folding. Decided to follow this answer on the sphinx forum .
Path for indexes /usr/local/sphinx/var/data
Path for logs /usr/local/sphinx/
var / log installation directory).

./indexer --all --config /etc/sphinxsearch/sphinx.conf

Then start of the sphinx
./searchd --config /etc/sphinxsearch/sphinx.conf
Indexes were picked up, results in php are received.

A
Alexander Chernykh, 2021-10-21
@sashkets

Strange
Being in the /root/sphinx-3.4.1/bin/ folder, you had to start indexer with './' but you started without it, and start searchd with './'
if it doesn't help, then try with the full path
/ root/sphinx-3.4.1/bin/searchd etc
/root/sphinx-3.4.1/bin/indexer etc

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question