Пользователь 44828
Эксперт
Сообщений: 1132
Баллов: 198
Авторитет:
0
Рейтинг пользователя:
2
Регистрация: 01.07.2009
два сайта на одном сервере(лицензии разные)
сфикс установлен — на одном сайте подключен, работает
для вторго создаю 2 индекс в конфиге
в настройках модуля выбираю использовать сфинкс, указываю новый индекс и получаю ошибку
Код |
---|
Ошибка подключения к серверу Sphinx: Указанный индекс не найден. |
вот полный конфиг
Код |
---|
indexer { mem_limit = 32M } searchd { listen = 127.0.0.1:9312 listen = 9306:mysql41 log = /var/log/sphinx/searchd.log query_log = /var/log/sphinx/query.log read_timeout = 5 max_children = 30 pid_file = /var/run/sphinx/searchd.pid max_matches = 1000 seamless_rotate = 1 preopen_indexes = 1 unlink_old = 1 workers = threads # for RT to work binlog_path = /var/lib/sphinx } source art { type = mysql sql_host = localhost sql_user = ****** sql_pass = ******* sql_db = ****** sql_port = 3306 # optional, default is 3306 sql_query_pre = SET NAMES utf8 sql_query_pre = SET CHARACTER SET utf8 sql_query = SELECT id, group_id, UNIX_TIMESTAMP(date_added) AS date_added, title, content FROM documents sql_attr_uint = group_id sql_attr_timestamp = date_added sql_ranged_throttle = 0 sql_query_info = SELECT * FROM documents WHERE id=$id } source trv { type = mysql sql_host = localhost sql_user = **** sql_pass = **** sql_db = **** sql_port = 3306 # optional, default is 3306 sql_query_pre = SET NAMES utf8 sql_query_pre = SET CHARACTER SET utf8 sql_query = SELECT id, group_id, UNIX_TIMESTAMP(date_added) AS date_added, title, content FROM documents sql_attr_uint = group_id sql_attr_timestamp = date_added sql_ranged_throttle = 0 sql_query_info = SELECT * FROM documents WHERE id=$id } index bitrix_art { #main settings source = art type = rt path = /var/lib/sphinx/bitrix_art docinfo = inline morphology = stem_enru, soundex dict = keywords prefix_fields = title infix_fields= min_prefix_len = 2 enable_star = 1 rt_field = title rt_field = body rt_attr_uint = module_id rt_attr_string = module rt_attr_uint = item_id rt_attr_string = item rt_attr_uint = param1_id rt_attr_string = param1 rt_attr_uint = param2_id rt_attr_string = param2 rt_attr_timestamp = date_change rt_attr_timestamp = date_to rt_attr_timestamp = date_from rt_attr_uint = custom_rank rt_attr_multi = tags rt_attr_multi = right rt_attr_multi = site rt_attr_multi = param charset_type = sbcs } index bitrix_trv { #main settings source = trv type = rt path = /var/lib/sphinx/bitrix_trv docinfo = inline morphology = stem_enru, soundex dict = keywords prefix_fields = title infix_fields= min_prefix_len = 2 enable_star = 1 rt_field = title rt_field = body rt_attr_uint = module_id rt_attr_string = module rt_attr_uint = item_id rt_attr_string = item rt_attr_uint = param1_id rt_attr_string = param1 rt_attr_uint = param2_id rt_attr_string = param2 rt_attr_timestamp = date_change rt_attr_timestamp = date_to rt_attr_timestamp = date_from rt_attr_uint = custom_rank rt_attr_multi = tags rt_attr_multi = right rt_attr_multi = site rt_attr_multi = param charset_type = sbcs } |
в чем может быть проблема
при запуске из консоли выдает
Код |
---|
indexer --all --rotate Sphinx 2.0.8-id64-release (r3831) Copyright (c) 2001-2012, Andrew Aksyonoff Copyright (c) 2008-2012, Sphinx Technologies Inc (http://sphinxsearch.com) using config file '/etc/sphinx/sphinx.conf'... skipping non-plain index 'bitrix_art'... skipping non-plain index 'bitrix_trv'... total 0 reads, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg total 0 writes, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg |
I have a RoR app with Posgresql as database. I’m trying to setup search functionality by using Sphinx as search engine and Thinking Sphinx gem. I’ve installed sphinx with mysql and postgresql support, thinking sphinx v3 gem and it’s dependencies.
The command
rake ts:index
performs without errors. Log says that I have 20 docs indexed (all my records of Post model).
Then I’ve tried to create controller and view for search results page. Here’s the Controller’s search action
def search
@query = Riddle::Query.escape(params[:q])
@posts = Post.search(@query)
end
And when I try to use @posts variable in search view
localhost:3000/search?q=hello
I have following error.
ThinkingSphinx::ConnectionError in Main#search
Error connecting to Sphinx via the MySQL protocol. Error connecting to Sphinx via the MySQL protocol. Can’t connect to MySQL server on ‘127.0.0.1’ (61) — SELECT * FROM
post_core
WHERE MATCH(‘hello’) ANDsphinx_deleted
= 0 LIMIT 0, 20; SHOW META
asked Nov 27, 2014 at 18:37
The ts:index
task just stores the Sphinx data, it doesn’t start the daemon which responds to search requests. You need to run ts:start
rake task for this to happen.
Also: ts:rebuild
does all of this at once: stops Sphinx (if it’s running), indexes data, starts Sphinx.
answered Nov 28, 2014 at 3:43
patpat
16k4 gold badges40 silver badges46 bronze badges
0
Thinking Sphinx uses mysql for its internal purposes and you have to add mysql2
gem to your stack, e.g:
gem 'mysql2', '~> 0.3.13'
gem 'thinking-sphinx', '~> 3.1.1'
answered Nov 27, 2014 at 18:52
blelumpblelump
3,2231 gold badge15 silver badges20 bronze badges
I was stuck at all and facing the same error, Finally I found that I have not installed «Sphinx» on my local system with this command,
sudo apt-get update
sudo apt-get install sphinxsearch
More detail regarding installation you can find here
https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-sphinx-on-ubuntu-14-04
Make sure you should also have installed «mysql-server» on your system to create connection.
Also I looked @blelump’s answer was my second step. You should include those gems too in order to run with sphinx.
Then move to @pat’s answer was my final step to go, When you installed sphinx it will start service but you need to stop service to run,
rake ts:index
rake ts:rebuild
Here to go with SPHINX.
answered Oct 9, 2015 at 4:44
SSRSSR
6,3784 gold badges33 silver badges50 bronze badges
I have a RoR app with Posgresql as database. I’m trying to setup search functionality by using Sphinx as search engine and Thinking Sphinx gem. I’ve installed sphinx with mysql and postgresql support, thinking sphinx v3 gem and it’s dependencies.
The command
rake ts:index
performs without errors. Log says that I have 20 docs indexed (all my records of Post model).
Then I’ve tried to create controller and view for search results page. Here’s the Controller’s search action
def search
@query = Riddle::Query.escape(params[:q])
@posts = Post.search(@query)
end
And when I try to use @posts variable in search view
localhost:3000/search?q=hello
I have following error.
ThinkingSphinx::ConnectionError in Main#search
Error connecting to Sphinx via the MySQL protocol. Error connecting to Sphinx via the MySQL protocol. Can’t connect to MySQL server on ‘127.0.0.1’ (61) — SELECT * FROM
post_core
WHERE MATCH(‘hello’) ANDsphinx_deleted
= 0 LIMIT 0, 20; SHOW META
asked Nov 27, 2014 at 18:37
The ts:index
task just stores the Sphinx data, it doesn’t start the daemon which responds to search requests. You need to run ts:start
rake task for this to happen.
Also: ts:rebuild
does all of this at once: stops Sphinx (if it’s running), indexes data, starts Sphinx.
answered Nov 28, 2014 at 3:43
patpat
16k4 gold badges40 silver badges46 bronze badges
0
Thinking Sphinx uses mysql for its internal purposes and you have to add mysql2
gem to your stack, e.g:
gem 'mysql2', '~> 0.3.13'
gem 'thinking-sphinx', '~> 3.1.1'
answered Nov 27, 2014 at 18:52
blelumpblelump
3,2231 gold badge15 silver badges20 bronze badges
I was stuck at all and facing the same error, Finally I found that I have not installed «Sphinx» on my local system with this command,
sudo apt-get update
sudo apt-get install sphinxsearch
More detail regarding installation you can find here
https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-sphinx-on-ubuntu-14-04
Make sure you should also have installed «mysql-server» on your system to create connection.
Also I looked @blelump’s answer was my second step. You should include those gems too in order to run with sphinx.
Then move to @pat’s answer was my final step to go, When you installed sphinx it will start service but you need to stop service to run,
rake ts:index
rake ts:rebuild
Here to go with SPHINX.
answered Oct 9, 2015 at 4:44
SSRSSR
6,3784 gold badges33 silver badges50 bronze badges
I have a problem starting and working with sphinx.
I was able to run indexer --all
, but now I want to search it, and I keep getting this error when I run searchd --status
.
WARNING: failed to connect to 127.0.0.1:9312: Connection refused
WARNING: failed to connect to 0.0.0.0:9306: Connection refused
FATAL: failed to connect to daemon: please specify listen with sphinx protocol in your config file
sphinx query() returns false, and I guess that’s related to connection problem.
Here’s the part of my .conf file.
searchd
{
listen = 127.0.0.1:9312
listen = 9306:sphinx
listen = 2471:mysql41
log = /var/log/sphinx/searchd.log
query_log = /var/log/sphinx/query.log
max_matches = 1000
read_timeout = 5
max_children = 30
pid_file = /var/run/sphinx/searchd.pid
seamless_rotate = 1
preopen_indexes = 1
unlink_old = 1
workers = threads # for RT to work
binlog_path = /var/lib/sphinx
}
What am I missing in configuration of listening ports?
asked Sep 17, 2014 at 17:24
6
As noted in comments, indicates searchd
daemon not actully running.
Can try using searchd
to start the daemon (and later searchd --stop
), which can show errors you might not see with using service/init.d starting.
(because if the log file itself is not functional, there is nowhere for errors to go
answered Sep 17, 2014 at 18:19
barryhunterbarryhunter
20.9k3 gold badges29 silver badges43 bronze badges
У меня проблема с запуском и работой с sphinx. Мне удалось запустить indexer --all
, но теперь я хочу выполнить поиск, и у меня постоянно появляется эта ошибка при запуске searchd --status
.
WARNING: failed to connect to 127.0.0.1:9312: Connection refused
WARNING: failed to connect to 0.0.0.0:9306: Connection refused
FATAL: failed to connect to daemon: please specify listen with sphinx protocol in your config file
Sphinx query () возвращает false, и я предполагаю, что это связано с проблемой подключения.
Вот часть моего файла .conf.
searchd
{
listen = 127.0.0.1:9312
listen = 9306:sphinx
listen = 2471:mysql41
log = /var/log/sphinx/searchd.log
query_log = /var/log/sphinx/query.log
max_matches = 1000
read_timeout = 5
max_children = 30
pid_file = /var/run/sphinx/searchd.pid
seamless_rotate = 1
preopen_indexes = 1
unlink_old = 1
workers = threads # for RT to work
binlog_path = /var/lib/sphinx
}
Что мне не хватает в настройке портов прослушивания?
1 ответ
Лучший ответ
Как отмечено в комментариях, означает, что демон searchd
не работает на самом деле.
Можно попробовать использовать searchd
для запуска демона (и более позднего searchd --stop
), который может показывать ошибки, которые вы могли не увидеть при запуске service / init.d.
(потому что, если сам файл журнала не работает, ошибкам некуда идти
2
barryhunter
17 Сен 2014 в 22:19
I have sphinx setup to run in config files on port 3312. I can use the indexer, and create the index. I can search.
I can’t run searchd to return queries. I tried telnet 127.0.0.1 3312. My connection is refused.
Whats my next step? I am not very good with Iptables.
Wesley
32.4k9 gold badges80 silver badges116 bronze badges
asked Sep 1, 2011 at 19:58
You should start searchd first, something like /usr/local/bin/searchd
(you should use actual path to searchd, try locate searchd
to get it)
Okay, it looks like you have two listen
directives in your config:
listen = {port}
listen = {sql_host}:{sql_port}:mysql41
and the second one is obviously not right
answered Sep 1, 2011 at 20:01
AlexAlex
7,8695 gold badges36 silver badges52 bronze badges
13
It may be because the port is already hold by some else daemon. If the ‘127.0.0.1:3306’ is failed — it is nothing surprising, since 3306 is the port for mysqld.
You can try the 9312 (sphinx api) and 9306 (sphinxql) as official IANA assigned ports for sphinx.
answered Oct 30, 2011 at 8:44
Sphinx (англ. SQL Phrase Index) — система полнотекстового поиска, разработанная Андреем Аксеновым и распространяемая по лицензии GNU GPL. Отличительной особенностью этого поискового движка является высокая скорость индексации и поиска, возможность использовать морфологический и полнотекстовый поиск.
SphinxSE уже обрел популярность среди разработчиков: именно с его помощью осуществляется поиск на популярном Хабрахабре, проекте Викимапия, сайтах популярного книжного интернет-магазина Буквоед и «Санкт-Петербургского Дома Книги», BitTorrent-трекере The Pirate Bay (небезызвестная «Пиратская бухта») и других высоконагруженных проектах.
Полнотекстовый поиск Sphinx доступен в продуктах «1С-Битрикс» с версии 14.0.0. Он позволяет сделать быстрым и качественным поиск на вашем сайте, снизить нагрузку на сервер, а также он полностью интегрирован с компонентами модуля Поиск.
Внимание!
Начиная с версии Sphinx 2.2.1 опция charset_type объявлена как устаревшая:
In 2.2.1-beta version we decided to start removing some old features. All of them was ‘unofficially’ deprecated for some time. And we’re informing you now about it. charset_type=sbcs is now deprecated, we’re slowly switching to UTF-only. Even if your database is SBCS (likely for legacy reasons too, eh?), this should be absolutely trivial to workaround, just add a pre-query to fetch your data in UTF-8 and you’re all set. Also, in fact, our current UTF-8 tokenizer is even faster than the SBCS one.
Несмотря на то, что в документации к модулю «Поиск» начиная с версии v16.5.0 заявляется о поддержке Sphinx 2.2.10 — она работает исключительно для сайтов в кодировке UTF-8.
Настройка Sphinx
Для настройки необходимо зайти в административную панель сайта, затем перейти в меню «Настройки» -> «Настройки продукта» -> «Настройки модулей» -> «Поиск».
Затем перейти во вкладку «Морфология» и в выпадающем списке меню «Полнотекстовый поиск с помощью» выбрать «Sphinx».
Для своей работы Bitrix использует RT индексы, то есть, фактически, запись осуществляется в два места одновременно — в базу данных и сервер полнотекстового поиска Sphinx, при этом сам Indexer (программа индексации из набора Sphinx) не обновляет индексы. Этот подход позволяет всегда осуществлять поиск по актуальной информации.
Далее необходимо скопировать конфигурационный файл, представленный на странице настройки:
#sphinx.conf
index bitrix
{
#main settings
type = rt
path = /var/lib/sphinxsearch/data/bitrix
docinfo = inline
#choose appropriate type of morphology to use
#morphology = lemmatize_ru_all, lemmatize_en_all, lemmatize_de_all, stem_enru
morphology = stem_enru, soundex
#these settings are used by bitrix:search.title component
dict = keywords
prefix_fields = title
infix_fields=
min_prefix_len = 2
enable_star = 1
#all fields must be defined exactly as followed
rt_field = title
rt_field = body
rt_attr_uint = module_id
rt_attr_string = module
rt_attr_uint = item_id
rt_attr_string = item
rt_attr_uint = param1_id
rt_attr_string = param1
rt_attr_uint = param2_id
rt_attr_string = param2
rt_attr_timestamp = date_change
rt_attr_timestamp = date_to
rt_attr_timestamp = date_from
rt_attr_uint = custom_rank
rt_attr_multi = tags
rt_attr_multi = right
rt_attr_multi = site
rt_attr_multi = param
#depends on settings of your site
# uncomment for single byte character set
charset_type = sbcs
# uncomment for UTF character set
#charset_type = utf-8
}
удалив из него строку «infix_fields=». Затем нажать «Применить» сохранив настройки.
На этом первая часть настройки CMS Bitrix для работы с сервером полнотекстового поиска закончена, далее необходимо настроить сам сервер.
Настройка параметров Sphinx происходит в панели управления хостингом — для этого нужно зайти в раздел «Сервисы» -> «Sphinx» или перейти по ссылке https://cp.beget.com/cloudservices/sphinx/. Выбираем необходимый тариф и включаем демон полнотекстового поиска:
Далее переходим на вкладку «Индексация» -> «Редактор конфигурации», вставляем скопированное ранее содержимое конфигурационного файла (с удалением строки «infix_fields=»), и нажимаем «Сохранить»:
Переходим на вкладку «Поисковый сервер» и включаем его.
Так как используются индексы реального времени, необходимо полностью проиндексировать сайт, для этого снова переходим во вкладку «Морфология» панели управления сайтом, в выпадающем списке меню «Полнотекстовый поиск с помощью» выбираем «Sphinx» и нажимаем «Применить».
После применения изменений появится сообщение о необходимости полностью проиндексировать сайт, нажимаем на «Переиндексировать сайт»:
Попав на страницу индексации снимаем галочку «Проиндексировать только измененные» и нажимаем «Переиндексировать»:
Настройка полнотекстового поиска закончена! Проверить работу поиска можно на Вашем сайте.
Если при установке или настройке возникли проблемы, Вы можете обратиться в нашу техническую поддержку — мы с радостью поможем и ответим на все Ваши вопросы.
Я пытаюсь настроить поисковик sphinx на сервере.
На сервере уже есть другой демон поиска sphinx, который запускается от другого пользователя для другого сайта с другим файлом конфигурации (порт 3312).
Вот мой конфигурационный файл sphinx /opt/sphinx/etc/site-sphinx.conf
source site_source
{
type = mysql
sql_host = localhost
sql_user = username
sql_pass = password
sql_db = dbname
sql_port = 3306
sql_sock = /var/run/mysqld/mysqld.sock
mysql_connect_flags = 32
sql_query_pre = SET NAMES utf8
sql_query_pre = SET SESSION query_cache_type=ON
sql_query = SELECT id, title, description, is_deleted, created_at, updated_at FROM table WHERE is_deleted = 0
sql_attr_bool = is_deleted
sql_attr_timestamp = created_at
sql_attr_timestamp = updated_at
sql_ranged_throttle = 0
}
index sitename
{
type = plain
source = site_source
path = /opt/sphinx/var/data/site_index/site
docinfo = extern
dict = keywords
mlock = 0
morphology = stem_en, stem_ru, soundex, metaphone
enable_star = 1
min_stemming_len = 1
min_word_len = 1
min_infix_len = 3
html_strip = 1
html_remove_elements = style, script
}
indexer
{
mem_limit = 1024M
}
searchd
{
listen = 127.0.0.1:3313
log = /opt/sphinx/var/log/site/search.log
query_log = /opt/sphinx/var/log/site/query.log
binlog_path = /opt/sphinx/var/data/site_binlog
read_timeout = 5
max_children = 30
pid_file = /opt/sphinx/var/run/searchd-site.pid
}
Я должен начать sphinxd
site@servername:~$ /opt/sphinx/bin/searchd --config /opt/sphinx/etc/site-sphinx.conf
Sphinx 2.2.9-id64-release (rel22-r5006)
Copyright (c) 2001-2015, Andrew Aksyonoff
Copyright (c) 2008-2015, Sphinx Technologies Inc (http://sphinxsearch.com)
using config file '/opt/sphinx/etc/site-sphinx.conf'...
WARNING: key 'enable_star' was permanently removed from Sphinx configuration. Refer to documentation for details.
listening on 127.0.0.1:3313
precaching index 'site'
precached 1 indexes in 0.051 sec
shapoval@sitename$ netstat -nlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:3313 0.0.0.0:* LISTEN 21225/searchd
tcp 0 0 127.0.0.1:3312 0.0.0.0:* LISTEN 26694/searchd
tcp6 0 0 :::3306 :::* LISTEN 16998/mysqld
И я должен начать индексирование
site@servername:~$ /opt/sphinx/bin/indexer --all --rotate --config /opt/sphinx/etc/site-sphinx.conf delta
using config file '/opt/sphinx/etc/site-sphinx.conf'...
WARNING: key 'enable_star' was permanently removed from Sphinx configuration. Refer to documentation for details.
indexing index 'site'...
WARNING: index 'site': dict=keywords and prefixes and morphology enabled, forcing index_exact_words=1
collected 1660326 docs, 674.2 MB
sorted 231.9 Mhits, 100.0% done
total 1660326 docs, 674237370 bytes
total 155.531 sec, 4335045 bytes/sec, 10675.15 docs/sec
total 16 reads, 15.074 sec, 61858.4 kb/call avg, 942.1 msec/call avg
total 1950 writes, 1.040 sec, 998.5 kb/call avg, 0.5 msec/call avg
rotating indices: successfully sent SIGHUP to searchd (pid=25377).
Но я не могу подключиться к базе данных, ни из командной строки, ни из php (я использую yii2, для подключения к sphinx используйте yii2-sphinx).
Когда я пытаюсь подключиться к mysql из командной строки, возникает ошибка:
shapoval@servername$ mysql -h0 -P3313 -u username -p
Enter password:
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0 "Internal error/check (Not system error)"
При попытке запустить запрос с сайта возникает несколько ошибок:
2015-12-22 10:03:08 [10.10.10.10][][-][error][yiidbException] exception 'yiibaseErrorException' with message 'Packets out of order. Expected 0 received 1. Packet size=0' in /var/www/sitename/vendor/yiisoft/yii2/db/Connection.php:558
Stack trace:
#0 /var/www/sitename/common/extensions/rollbar/RollbarErrorHandlerTrait.php(35): yiibaseErrorHandler->handleError(2, 'Packets out of ...', '/var/www/sitename...', 558)
#1 [internal function]: commonextensionsrollbarRollbarErrorHandler->handleError(2, 'Packets out of ...', '/var/www/sitename...', 558, Array)
#2 /var/www/sitename/vendor/yiisoft/yii2/db/Connection.php(558): PDO->__construct('mysql:host=127....', 'username', 'password', NULL)
#3 /var/www/sitename/vendor/yiisoft/yii2/db/Connection.php(508): yiidbConnection->createPdoInstance()
#4 /var/www/sitename/vendor/yiisoft/yii2-sphinx/Connection.php(112): yiidbConnection->open()
#5 /var/www/sitename/vendor/yiisoft/yii2-sphinx/Schema.php(255): yiisphinxConnection->createCommand('SHOW TABLES')
#6 /var/www/sitename/vendor/yiisoft/yii2-sphinx/Schema.php(239): yiisphinxSchema->findIndexes()
#7 /var/www/sitename/vendor/yiisoft/yii2-sphinx/Schema.php(226): yiisphinxSchema->initIndexesInfo()
#8 /var/www/sitename/vendor/yiisoft/yii2-sphinx/Schema.php(113): yiisphinxSchema->getIndexTypes()
#9 /var/www/sitename/vendor/yiisoft/yii2-sphinx/Schema.php(88): yiisphinxSchema->resolveIndexType(Object(yiisphinxIndexSchema))
#10 /var/www/sitename/vendor/yiisoft/yii2-sphinx/Schema.php(151): yiisphinxSchema->loadIndexSchema('sitename')
#11 /var/www/sitename/vendor/yiisoft/yii2-sphinx/Connection.php(78): yiisphinxSchema->getIndexSchema('sitename', false)
#12 /var/www/sitename/html/vendor/yiisoft/yii2-sphinx/QueryBuilder.php(494): yiisphinxConnection->getIndexSchema('sitename')
#13 /var/www/sitename/vendor/yiisoft/yii2-sphinx/QueryBuilder.php(81): yiisphinxQueryBuilder->buildWhere(Array, 'MATCH(:qp0)', Array)
#14 /var/www/sitename/vendor/yiisoft/yii2-sphinx/Query.php(171): yiisphinxQueryBuilder->build(Object(yiisphinxQuery))
#15 /var/www/sitename/vendor/yiisoft/yii2-sphinx/Query.php(184): yiisphinxQuery->createCommand(NULL)
#16 /var/www/sitename/common/actions/SphinxSearchAction.php(78): yiisphinxQuery->all()
#17 [internal function]: commonactionsSphinxSearchAction->run()
#18 /var/www/sitename/vendor/yiisoft/yii2/base/Action.php(91): call_user_func_array(Array, Array)
#19 /var/www/sitename/vendor/yiisoft/yii2/base/Controller.php(147): yiibaseAction->runWithParams(Array)
#20 /var/www/sitename/vendor/yiisoft/yii2/base/Module.php(460): yiibaseController->runAction('search', Array)
#21 /var/www/sitename/vendor/yiisoft/yii2/web/Application.php(82): yiibaseModule->runAction('site/search', Array)
#22 /var/www/sitename/vendor/yiisoft/yii2/base/Application.php(369): yiiwebApplication->handleRequest(Object(yiiwebRequest))
#23 /var/www/sitename/frontend/web/index.php(18): yiibaseApplication->run()
#24 {main}
Next exception 'PDOException' with message 'SQLSTATE[HY000] [2006] MySQL server has gone away' in /var/www/sitename/vendor/yiisoft/yii2/db/Connection.php:558
Stack trace:
#0 /var/www/sitename/vendor/yiisoft/yii2/db/Connection.php(0): PDO->__construct()
#1 /var/www/sitename/vendor/yiisoft/yii2/db/Connection.php(508): yiidbConnection->createPdoInstance()
#2 /var/www/sitename/yiisoft/yii2-sphinx/Connection.php(112): yiidbConnection->open()
#3 /var/www/sitename/yiisoft/yii2-sphinx/Schema.php(255): yiisphinxConnection->createCommand('SHOW TABLES')
#4 /var/www/sitename/vendor/yiisoft/yii2-sphinx/Schema.php(239): yiisphinxSchema->findIndexes()
#5 /var/www/sitename/vendor/yiisoft/yii2-sphinx/Schema.php(226): yiisphinxSchema->initIndexesInfo()
#6 /var/www/sitename/vendor/yiisoft/yii2-sphinx/Schema.php(113): yiisphinxSchema->getIndexTypes()
#7 /var/www/sitename/vendor/yiisoft/yii2-sphinx/Schema.php(88): yiisphinxSchema->resolveIndexType(Object(yiisphinxIndexSchema))
#8 /var/www/sitename/vendor/yiisoft/yii2-sphinx/Schema.php(151): yiisphinxSchema->loadIndexSchema('sitename')
#9 /var/www/sitename/vendor/yiisoft/yii2-sphinx/Connection.php(78): yiisphinxSchema->getIndexSchema('sitename', false)
#10 /var/www/sitename/vendor/yiisoft/yii2-sphinx/QueryBuilder.php(494): yiisphinxConnection->getIndexSchema('sitename')
#11 /var/www/sitename/vendor/yiisoft/yii2-sphinx/QueryBuilder.php(81): yiisphinxQueryBuilder->buildWhere(Array, 'MATCH(:qp0)', Array)
#12 /var/www/sitename/vendor/yiisoft/yii2-sphinx/Query.php(171): yiisphinxQueryBuilder->build(Object(yiisphinxQuery))
#13 /var/www/sitename/vendor/yiisoft/yii2-sphinx/Query.php(184): yiisphinxQuery->createCommand(NULL)
#14 /var/www/sitename/common/actions/SphinxSearchAction.php(78): yiisphinxQuery->all()
#15 [internal function]: commonactionsSphinxSearchAction->run()
#16 /var/www/sitename/vendor/yiisoft/yii2/base/Action.php(91): call_user_func_array(Array, Array)
#17 /var/www/sitename/vendor/yiisoft/yii2/base/Controller.php(147): yiibaseAction->runWithParams(Array)
#18 /var/www/sitename/vendor/yiisoft/yii2/base/Module.php(460): yiibaseController->runAction('search', Array)
#19 /var/www/sitename/vendor/yiisoft/yii2/web/Application.php(82): yiibaseModule->runAction('site/search', Array)
#20 /var/www/sitename/vendor/yiisoft/yii2/base/Application.php(369): yiiwebApplication->handleRequest(Object(yiiwebRequest))
#21 /var/www/sitename/frontend/web/index.php(18): yiibaseApplication->run()
#22 {main}
Next exception 'yiidbException' with message 'SQLSTATE[HY000] [2006] MySQL server has gone away' in /var/www/sitename/vendor/yiisoft/yii2/db/Connection.php:513
Stack trace:
#0 /var/www/sitename/vendor/yiisoft/yii2-sphinx/Connection.php(112): yiidbConnection->open()
#1 /var/www/sitename/vendor/yiisoft/yii2-sphinx/Schema.php(255): yiisphinxConnection->createCommand('SHOW TABLES')
#2 /var/www/sitename/vendor/yiisoft/yii2-sphinx/Schema.php(239): yiisphinxSchema->findIndexes()
#3 /var/www/sitename/vendor/yiisoft/yii2-sphinx/Schema.php(226): yiisphinxSchema->initIndexesInfo()
#4 /var/www/sitename/vendor/yiisoft/yii2-sphinx/Schema.php(113): yiisphinxSchema->getIndexTypes()
#5 /var/www/sitename/vendor/yiisoft/yii2-sphinx/Schema.php(88): yiisphinxSchema->resolveIndexType(Object(yiisphinxIndexSchema))
#6 /var/www/sitename/vendor/yiisoft/yii2-sphinx/Schema.php(151): yiisphinxSchema->loadIndexSchema('sitename')
#7 /var/www/sitename/vendor/yiisoft/yii2-sphinx/Connection.php(78): yiisphinxSchema->getIndexSchema('sitename', false)
#8 /var/www/sitename/vendor/yiisoft/yii2-sphinx/QueryBuilder.php(494): yiisphinxConnection->getIndexSchema('sitename')
#9 /var/www/sitename/vendor/yiisoft/yii2-sphinx/QueryBuilder.php(81): yiisphinxQueryBuilder->buildWhere(Array, 'MATCH(:qp0)', Array)
#10 /var/www/sitename/vendor/yiisoft/yii2-sphinx/Query.php(171): yiisphinxQueryBuilder->build(Object(yiisphinxQuery))
#11 /var/www/sitename/vendor/yiisoft/yii2-sphinx/Query.php(184): yiisphinxQuery->createCommand(NULL)
#12 /var/www/sitename/common/actions/SphinxSearchAction.php(78): yiisphinxQuery->all()
#13 [internal function]: commonactionsSphinxSearchAction->run()
#14 /var/www/sitename/vendor/yiisoft/yii2/base/Action.php(91): call_user_func_array(Array, Array)
#15 /var/www/sitename/vendor/yiisoft/yii2/base/Controller.php(147): yiibaseAction->runWithParams(Array)
#16 /var/www/sitename/vendor/yiisoft/yii2/base/Module.php(460): yiibaseController->runAction('search', Array)
#17 /var/www/sitename/vendor/yiisoft/yii2/web/Application.php(82): yiibaseModule->runAction('site/search', Array)
#18 /var/www/sitename/vendor/yiisoft/yii2/base/Application.php(369): yiiwebApplication->handleRequest(Object(yiiwebRequest))
#19 /var/www/sitename/frontend/web/index.php(18): yiibaseApplication->run()
#20 {main}
Настройки подключения Sphinx в yii2
<?php
return [
'dsn' => 'mysql:host=127.0.0.1;port=3313;',
'username' => 'username',
'password' => 'password',
];
Код в yii2 для выполнения запроса
$query = (new Query())
->from('sourceName')
->match('*'.Yii::$app->request->get('q').'*');
$rows = $query->all();
Дополнительная информация о сервере:
- Ubuntu 15.04
- Linux 3.19.0-21-generic x86_64
- Sphinx 2.2.9-id64-release (rel22-r5006)
- MySQL 10.0.20-MariaDB-1 ~ vivid-log
В чем может быть проблема?
Буду рад любой помощи. Спасибо!
2
- Главная
- Новые
Не делает индексацию..
/usr/local/sphinx/bin/indexer —all
Sphinx 2.0.9-release (rel20-r4115)
Copyright (c) 2001-2013, Andrew Aksyonoff
Copyright (c) 2008-2013, Sphinx Technologies Inc (http://sphinxsearch.com)
using config file ‘/usr/local/sphinx/etc/sphinx.conf’…
indexing index ‘nameuser_prefix_topicsIndex’…
ERROR: index ‘nameuser_prefix_topicsIndex’: sql_connect: Lost connection to MySQL server at ‘reading initial communication packet’, system error: 0 (DSN=mysql://nameuser:***@ip.ip.ip.ip:port/nameuser).
total 0 docs, 0 bytes
total 60.058 sec, 0 bytes/sec, 0.00 docs/sec
indexing index ‘nameuser_prefix_commentsIndex’…
FATAL: failed to lock /var/lib/sphinxsearch/data/nameuser_prefix_data/commentsIndex.spl: Resource temporarily unavailable, will not index. Try —rotate option.
Система Debian 6.0 squeeze
Делал по инструкции http://ls.vaktive.ru/setup-server/1/ustanovka-i-nastroyka-sphinx-205-debian-60-squeeze.html
Похожие статьи
- Ошибка в плагине «Гостевые комментарии»
Устанавливаю плагин «Гостевые комментарии», побывал разные версии: из каталога 1.1.9 и с гитхаба 1.1.10 на AltoCMS 1.1.29
В настройках указываю обязательный email адрес, нажимаю сохранить и вылетает такая ошибка…
- Настройка страниц
Как настроить созданные страницы, чтобы были доступны: имясайт.ru/page/about.html а не имясайт.ru/page/about/
Меняю в админке URL, выдает ошибку:
И как можно вообще убрать слово «page». Чтобы адрес был как в…
- Importer
Добрый день.
1) нет темы данного плагина
2) нет описания как его настроить под Alto, кто разобрался поделитесь своим опытом пожалуйста. Лично я вам буду благодарен.
3) может вы что-то добавили, или переделали в… - Про секретную админку, поддомены и прочие тонкости маршрутизации в Alto CMS
Довольно часто встречаются такие вопросы:
А как сделать, чтобы админка работала не по адресу site.com/admin, а по секретному адресу, который знаю только я? Или вопрос из этой же серии: как сделать, чтоб блоги…
I have installed Sphinx on my server and everything seems to working, except that when I run the test.php from web browser, I am getting this error:
Query failed: connection to localhost:9312 failed (errno=111, msg=Connection refused).
I have searched online, including stack overflow, almost all suggestions were make sure the searchd service is running, and it’s listening on the right port. I can say yes to both questions because if run the same test program directly in command line, everything works. I understand that the hosting provider may not have opened the port, but the port should be listening with the server, right? The fact that it works under command line should confirm that the service is listening on that port and the php program is able to get through to it. So I don’t understand why the same program run from the web browser rejects the connection.
I have also enabled fsockopen in php.ini.
Any suggestion to help understand why the connection is rejected or even better how to solve it is very welcome!
Thanks
I have sphinx setup to run in config files on port 3312. I can use the indexer, and create the index. I can search.
I can’t run searchd to return queries. I tried telnet 127.0.0.1 3312. My connection is refused.
Whats my next step? I am not very good with Iptables.
Wesley
32.6k9 gold badges81 silver badges117 bronze badges
asked Sep 1, 2011 at 19:58
You should start searchd first, something like /usr/local/bin/searchd
(you should use actual path to searchd, try locate searchd
to get it)
Okay, it looks like you have two listen
directives in your config:
listen = {port}
listen = {sql_host}:{sql_port}:mysql41
and the second one is obviously not right
answered Sep 1, 2011 at 20:01
AlexAlex
7,9195 gold badges37 silver badges52 bronze badges
13
It may be because the port is already hold by some else daemon. If the ‘127.0.0.1:3306’ is failed — it is nothing surprising, since 3306 is the port for mysqld.
You can try the 9312 (sphinx api) and 9306 (sphinxql) as official IANA assigned ports for sphinx.
answered Oct 30, 2011 at 8:44
Здравствуйте! На хостинге обновили php до 7 версии и что-то случилось с системой поиска sphinx. Помогите пожалуйста. Уже 3 дня копаю файлы, и ничего не могу найти. Как это можно исправить??
[BitrixMainDBConnectionException] Sphinx connect error: Ошибка подключения (Connection refused). (400)
/var/www/—/bitrix/modules/search/tools/sphinx.php:73
#0: CSearchSphinx->connect(string, string)
/var/www/—/bitrix/modules/search/classes/general/full_text.php:24
#1: CSearchFullText::getInstance()
/var/www/—/bitrix/modules/search/classes/general/search.php:106
#2: CAllSearch->Search(array, array, array)
/var/www/—/bitrix/components/bitrix/search.page/component.php:317
#3: include(string)
/var/www/—/bitrix/modules/main/classes/general/component.php:548
#4: CBitrixComponent->__includeComponent()
/var/www/—/bitrix/modules/main/classes/general/component.php:600
#5: CBitrixComponent->includeComponent(string, array, boolean)
/var/www/—/bitrix/modules/main/classes/general/main.php:1035
#6: CAllMain->IncludeComponent(string, string, array, boolean)
/var/www/—/search/index.php:35
Группы на сайте создаются не только сотрудниками «1С-Битрикс», но и партнерами компании. Поэтому мнения участников групп могут не совпадать с позицией компании «1С-Битрикс».
You should start searchd first, something like /usr/local/bin/searchd
(you should use actual path to searchd, try locate searchd
to get it)
Okay, it looks like you have two listen
directives in your config:
listen = {port}
listen = {sql_host}:{sql_port}:mysql41
and the second one is obviously not right
Related videos on Youtube
02 : 10
Localhost refused to Connect | This Site Can’t be reached | Wamp Server
07 : 35
2 Raspberry Pi host Doesnot Exist,Connection refuse, timeout (SOLVED)
02 : 51
Fixing — connection to the server localhost:8080 was refused-did you specify the right host or port?
07 : 01
SSH localhost refused problem in ubantu
01 : 35
DevOps & SysAdmins: Sphinx searchd connection refused by local host (2 Solutions!!)
Comments
-
I have sphinx setup to run in config files on port 3312. I can use the indexer, and create the index. I can search.
I can’t run searchd to return queries. I tried telnet 127.0.0.1 3312. My connection is refused.
Whats my next step? I am not very good with Iptables.
-
I have tried. My result is this: using config file ‘/usr/local/etc/sphinx.conf’… WARNING: compat_sphinxql_magics=1 is deprecated; please update your application and config listening on all interfaces, port=3306 bind() failed on 0.0.0.0, retrying… bind() failed on 0.0.0.0, retrying…
-
Please double check your configuration file, it tries to bind to port 3306 which is not right, 3306 is a MySQL port.
-
Sorry I forgot to specify the config file. This is my result: listening on all interfaces, port=3312 listening on 127.0.0.1:3306 bind() failed on 127.0.0.1, retrying… bind() failed on 127.0.0.1, retrying… bind() failed on 127.0.0.1, retrying… bind() failed on 127.0.0.1, retrying… bind() failed on 127.0.0.1, retrying…
-
You should set
listen = 3312
in thesearchd
section of your Sphinx config file. -
Yes it was previously set as that. but as you can see from the previous post something else is causing issues.
-
Could you please post your full config somewhere (say, to pastebin.com) and post a link here?
-
I am however missing the .pid file. Am I supposed to create that, or is it created when the service is ran.
-
I edited my answer, I think the problem is that you generate the config with two
listen
lines, you should just delete or comment out the second one. -
Yes, I commented that second directive out. Although it is still having issues with the .pid. I manually created the .pid file with proper permission, but it doesnt seem to like it very much. Thank you for your help
-
Well, your pid path is set to
pid_file = {root}/searchd.pid
androot
resolves to''
according to your config, you should use/var/run/searchd.pid
,/searchd.pid
is not writable I guess. -
Actually its only an issue when I try to stop the service. Removing the directive you pointed out now fixes the search.