Connect with Sphinx Engine installed on other server
For make extension work with Sphinx Engine installed on other server or installed on Windows based server, follow these steps:
[magento_root]/app/etc/
and edit local.xml file.
In the line <host>
set IP address of the database server:
<default_setup>
<connection>
<host>85.75.44.153</host>
~! Don't use localhost or 127.0.0.1 as server IP address. You need to change host IP address even if your Magento and database are placed on the same server.
- Go to System > Configuration > Mirasvit Extensions > Sphinx Search.
- Fill in following fields:
- Base Path - any folder on sphinx server, where you would like to store sphinx configuration and indexes (ex. /var/sphinx/)
- Sphinx Host - sphinx daemon host
- Sphinx Port - sphinx daemon port
- Press button Save Config.
- Press button Generate Config file.
- Copy generated config file to the Base Path on sphinx server.
- On sphinx server, run following commands:
indexer --config <base_path>/sphinx.conf --rotate mage_catalog_product
. Wheremage_catalog_product
code of index. If you use few indexes (products, categories, cms pages etc), you need do this command for each index.searchd --config <base_path>/sphinx.conf
- If configuration is correct and store server can connect to sphinx daemon, you will see search queries in sphinx log file (
<base_path>/searchd_query.log
) -
After done key configuration, you should configure cronjob for automatically update sphinx indexes.
-
Full reindex
indexer --config <base_path>/sphinx.conf --rotate mage_catalog_product
-
Delta reindex
indexer --config <base_path>/sphinx.conf --rotate delta_mage_catalog_product
indexer --config <base_path>/sphinx.conf --merge mage_catalog_product delta_mage_catalog_product --merge-dst-range deleted 0 0 --rotate
-
Start sphinx daemon
searchd --config <base_path>/sphinx.conf
-
Stop sphinx daemon
killall -9 searchd
-
Restart sphinx daemon
killall -9 searchd; searchd --config <base_path>/sphinx.conf;
Full example of crontab
30 * * * * indexer --config sphinx.conf --rotate delta_mage_catalog_product; indexer --config sphinx.conf --merge mage_catalog_product delta_mage_catalog_product --merge-dst-range deleted 0 0 --rotate;killall -9 searchd;searchd --config sphinx.conf; 0 2 * * * indexer --config sphinx.conf --rotate mage_catalog_product;killall -9 searchd; searchd --config sphinx.conf;
First job run delta reindex each hour (00:30, 01:30, 02:30 etc) and restart sphinx after delta reindex.
Second job run full reindex every day at 02:00 and restart sphinx daemon.
If you have few search indexes, you shoud run
indexer
command for each search index. -
Additional Information
Your feedback about this content is important.
Let us know what you think.