Sphinx Full-Text search case for 600 multi-G databases

Source: Internet
Author: User

The scale of the social work pool is getting bigger, the query speed of MSSQL is not enough, instead of full-text search, the effect is good, the whole library is around 650G, index 160G, full-text search response time within 5 seconds.

The main reference to the Web of answers a build post, the specific link can not find, made a lot of modifications and improvements, easy to add a new library.

Give some configuration information, interested students can message exchange.

Index configuration information:

Several issues encountered during the construction:

Do index times "out of Memory" error: Many people think it is not large enough, more than 4G index is not, really too young, not good looking manual, see how I Solve: Coreseek "out of memory" solution.

When you search for a keyword, the @ automatically breaks as a delimiter: that is, you search [email protected] This mailbox, it automatically divides you into helloyouyou and 163.com to search and give results ~ See what I can do: the search for a special character in the social work pool built by Coreseek. (In fact, it didn't work out??) )

Setup Process Memo:

Creating database
Create TABLE ' Shegongku ' (
' id ' int (ten) not NULL auto_increment,
' name ' varchar (255) COLLATE utf8_ Unicode_ci DEFAULT NULL,
' description ' text COLLATE utf8_unicode_ci,
' entry ' varchar (+) COLLATE Utf8_unicode_ CI default null COMMENT ' Primary stored table ',
' hits ' int (ten) ' Default ' 0 ',
' date_created ' int (ten) default null,
' Date_ Updated ' int (ten) default NULL,
PRIMARY KEY (' id ')
) engine=myisam auto_increment=1 default Charset=utf8 collate= Utf8_unicode_ci;
CREATE TABLE ' shegongku_0001 ' (
' id ' int (ten) not NULL auto_increment,
' db_id ' int (ten) ' DEFAULT null,//here db_ The ID is set according to the ID of the Shekongku table above, and you can set the default value after a row is created.
' line ' text,
PRIMARY key (' id '),
Key ' db_id ' (' db_id ')
) Engine=myisam auto_increment=1 DEFAULT charset= UTF8;
CREATE TABLE ' shegongku_0002 ' (
' id ' int () NOT NULL auto_increment,
' db_id ' int (ten) DEFAULT NULL,
' line ' t EXT,
PRIMARY key (' id '),
Key ' db_id ' (' db_id ')
) Engine=myisam auto_increment=1 DEFAULT Charset=utf8;

Import data
Load data local infile "c:/test.txt" ignore into table shegongku_0001 character set UTF8 fields terminated by ' | | | ' lines Terminated by ' \ n ' (line);
Note the TXT document must be in UTF8 format
Load data local infile "c:/aipai.com/1-20w.txt" ignore into table shegongku_0001 character set UTF8 fields terminated by ' | | | ' lines terminated by ' \ n ' (line);

Go to Coreseek root directory set the path set path=%cd%\bin;%path%
Built index bin\indexer-c etc\csft_shegongku.conf--all (bin\indexer-c etc\csft_shegongku.conf sgk_twshegongku_0001_ Index individual indexes)
Search Bin\search-c etc\csft_shegongku.conf-a Venus
Create a temporary service bin\searchd-c etc\csft_shegongku.conf--console
Create service Bin\searchd--install--config f:/coreseek/etc/csft_shegongku.conf--servicename Coreseek
PHP call API, using PHP search
Delete Service Bin\searchd--delete--servicename Coreseek

Each time you add a database, first add a row to the Shegongku table, record the ID number, and then create a table that DB_ID set the default value by ID number. Modify search.php line 63rd.

Insert into Xunlei (' realname ', ' tips ', ' shenfenzheng ', ' QQ ', ' site ', ' username ', ' email ', ' password ') select ' Realname ', ' Tips ', ' shenfenzheng ', ' QQ ', ' site ', ' username ', ' email ', ' password ' from Xunlei_bak

Improve the database structure and the way to build tables, add a new library directly, and then add the corresponding library name in search.php and csft_shegongku.conf OK.

Sphinx Full-Text search case for 600 multi-G databases

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.