VPS server: Ubuntu 18.04, LAMP, Nginx, firewall turned off. Installed Sphinx, with grief in half, set up the indexing of one database, everything is fine (indexed), then remade it for a new database (the old one was not needed, and its index, respectively, too).

Configured the sphinx config:

source table_sourse { # Π’ΠΈΠΏ Π΄Π°Π½Π½Ρ‹Ρ… (mysql, pgsql, mssql, xmlpipe, xmlpipe2, odbc) type = mysql # НСобходимыС ΠΏΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€Ρ‹ для ΠΏΠΎΠ΄ΠΊΠ»ΡŽΡ‡Π΅Π½ΠΈΡ ΠΊ Π±Π°Π·Π΅ Π΄Π°Π½Π½Ρ‹Ρ… sql_host = localhost sql_user = User sql_pass = Pass sql_db = table sql_port = 3306 # ΠΏΡ€Π΅Π΄-запрос, выполняСтся ΠΏΠ΅Ρ€Π΅Π΄ Π²Ρ‹ΠΏΠΎΠ»Π½Π΅Π½ΠΈΠ΅ΠΌ основного запроса Π½Π° ΠΏΠΎΠ»ΡƒΡ‡Π΅Π½ΠΈΠ΅ Π΄Π°Π½Π½Ρ‹Ρ… ΠΈΠ· Π±Π°Π·Ρ‹ (ΠΊΠΎΠ΄ΠΈΡ€ΠΎΠ²ΠΊΠ° UTF-8) sql_query_pre = SET NAMES utf8 # запрос, ΠΊΠΎΡ‚ΠΎΡ€Ρ‹ΠΉ ΠΏΠΎΠ»ΡƒΡ‡Π°Π΅Ρ‚ Π΄Π°Π½Π½Ρ‹Π΅ Π΄ΠΎΠΊΡƒΠΌΠ΅Π½Ρ‚ΠΎΠ² для поиска (ΠΏΠ΅Ρ€Π²ΠΎΠ΅ ΠΏΠΎΠ»Π΅ ΠΎΠ±ΡΠ·Π°Ρ‚Π΅Π»ΡŒΠ½ΠΎ ΡƒΠ½ΠΈΠΊΠ°Π»ΡŒΠ½Ρ‹ΠΉ ΠΏΠΎΠ»ΠΎΠΆΠΈΡ‚Π΅Π»ΡŒΠ½Ρ‹ΠΉ ID Π΄ΠΎΠΊΡƒΠΌΠ΅Π½Ρ‚Π°) sql_query = SELECT code, name, nds, posh FROM table sql_attr_bigint = code sql_attr_string = name } # индСкс для поиска index table { # Π˜ΡΡ‚ΠΎΡ‡Π½ΠΈΠΊ Π΄Π°Π½Π½Ρ‹Ρ… (Ρ‚Π°Π±Π»ΠΈΡ†Π° Π² Π‘Π”) для индСксирования source = table # АдрСс, Π³Π΄Π΅ Π±ΡƒΠ΄ΡƒΡ‚ хранится Π΄Π°Π½Π½Ρ‹Π΅ индСкса path = /home/user/data # ИндСкс с ΡƒΡ‡Π΅Ρ‚ΠΎΠΌ ΠΌΠΎΡ€Ρ„ΠΎΠ»ΠΎΠ³ΠΈΠΈ morphology = stem_ru # Минимальная Π΄Π»ΠΈΠ½Π° слова для индСксации min_word_len = 1 # ΠšΠΎΠ΄ΠΈΡ€ΠΎΠ²ΠΊΠ° charset_type = utf-8 # Π’Π°ΠΊ ΠΈ Π½Π΅ понял, Ρ‡Ρ‚ΠΎ это, поэтому Π·Π°ΠΊΠΎΠΌΠΌΠ΅Π½Ρ‚ΠΈΡ€ΠΎΠ²Π°Π» # docinfo = extern } indexer { mem_limit = 1024M # Π»ΠΈΠΌΠΈΡ‚ памяти для Ρ€Π°Π±ΠΎΡ‚Ρ‹ индСксатора } # Поисковая слуТба searchd { # ΠΊΠ°ΠΊΠΎΠΉ ΠΏΠΎΡ€Ρ‚ ΠΈ ΠΊΠ°ΠΊΠΎΠΉ ΠΏΡ€ΠΎΡ‚ΠΎΠΊΠΎΠ» "ΡΠ»ΡƒΡˆΠ°Π΅Ρ‚" слуТба listen = 9306:mysql41 # Ρ„Π°ΠΉΠ» с Π»ΠΎΠ³Π°ΠΌΠΈ log = /var/log/sphinxsearch/searchd.log # Ρ„Π°ΠΉΠ» с Π»ΠΎΠ³Π°ΠΌΠΈ поисковых запросов query_log = /var/log/sphinxsearch/query.log read_timeout = 60 max_children = 30 # PID file, searchd process ID file name pid_file = /var/run/sphinxsearch/searchd.pid seamless_rotate = 0 preopen_indexes = 1 unlink_old = 1 binlog_path = /var/lib/sphinxsearch/data } 

Reboot the server. Logged in as root, I launch the Sphinx with the command:

 searchd 

I get an error (below screen). I check the running processes, there is no sphinx there. I try to start indexing:

 sudo indexer --all 

The same mistake (screen with two teams). Swears on the config file Screen with error, next to the config file with line numbers

Before that, they recommended that I delete the PID file (I did, but I can recover) the old index. He did everything, but little has changed.

After corrections, when indexing is: Screenshot with an error

As if he was doing this indexing, but there are no index files in the / var / lib / sphinxsearch / folder (there are no files at all).

Yes, another clarification: in this database, the column with a unique number of terms is the name column. Sphinx swears at him too (see second screen)

What is the error and how to fix it?

  • Attach the problematic config with the text (the config that is attached now is clearly different from the config in the screenshot) (I, of course, not about passwords, if that :) - andmal
  • And if sql_query in line to write down without slashes? - nobody
  • searchd launched, just not visible on the screen. At first I thought that indexing should be done with the Sphinx turned off, but it turns out that it is necessary with it turned on? The query was written and in the string without a slash, nothing changed. The first jamb found: the string type = mysql was repeated twice. The second jamb - there is no column in the table with a unique id and the query does not refer to it. In another table that was indexed, it was. How to make a SQL query correctly in order to add a column with id to the top of the table, which will automatically add values ​​and will add them itself as values ​​are added? - Nikolay
  • New screen and fixed config added - Nikolay
  • /var/lib/sphinxsearch/data even exist? - andreymal

1 answer 1

The screenshot does not show the searchd launch. Only a stop attempt is visible (searchd --stop). Try just searchd (without --stop).

--rotate in indexer makes sense only when searchd is already running. But in this case, it would also work if you, after the indexer - rotate, performed just searchd, and not searchd --stop.

  • searchd launched, just not visible on the screen. At first I thought that indexing should be done with the Sphinx turned off, but it turns out that it is necessary with it turned on? - Nikolay
  • With searchd enabled, you cannot do an indexer without --rotate. With it turned off, you can and so and so, simply - rotate will not work if searchd is not running, but indexing will take place. Regarding the binlog error: make sure that the users under which you run indexer and searcd have access to the directory and file that the indexer swears at. If there is no directory, create one. If you want to store the binlog in a different place - write another directory in the binlog_path in the searchd section of the config file. - Manticore Search
  • Thanks for the info about rotate The rest is already corrected, still nothing works. I am writing that entering under the root, can it be that the root has no rights? - Nikolai