search
HomeDatabaseMysql Tutorialcoreseek sphinx mmseg mysql 全文检索 安装 配置

上次搞全文检索的东西 ,还要追溯到2010了,当时个人觉得coreseek还不成熟,就用了原始的sphinx,请参考: sphinx mmseg mysql 中文分词 ,这次呢,决定用一下coreseek,看看有什么区别。 一,安装环境和工具 服务器用的是centos6.5 x86 coreseek 4.0.1下载

上次搞全文检索的东西 ,还要追溯到2010了,当时个人觉得coreseek还不成熟,就用了原始的sphinx,请参考:sphinx mmseg mysql 中文分词,这次呢,决定用一下coreseek,看看有什么区别。

一,安装环境和工具

服务器用的是centos6.5 x86

coreseek 4.0.1下载地址:http://www.coreseek.cn/uploads/csft/4.0/coreseek-4.0.1-beta.tar.gz

mysql 5.5.8下载地址:http://downloads.mysql.com/archives/community/

二,mmseg中文分词安装

1,旧版本安装方法

# tar zxvf coreseek-4.0.1-beta
# cd coreseek-4.0.1-beta/mmseg-3.2.14/
# aclocal
# libtoolize --force
# automake --add-missing
# autoconf
# autoheader
# make clean
# ./configure --prefix=/usr/local/mmseg3
# make
# make install

2,新版本安装方法

# ./bootstrap
# ./configure --prefix=/usr/local/mmseg3
# make
# make install

mmseg-3.2.14,二种方法都可以安装成功,在编译时有报warning,但不影响安装。

3,新版本mmseg安装后,分词的东西就好了,不要用mmseg去生成了

[root@localhost mmseg-3.2.14]# ll /usr/local/mmseg3/etc/
总用量 5432
-rwxr-xr-x 1 root root 229 7月 31 01:44 mmseg.ini
-rwxr-xr-x 1 root root 1826251 7月 31 01:44 unigram.txt
-rwxr-xr-x 1 root root 3729280 7月 31 01:44 uni.lib

4,mmseg.ini配置的官方说明

[mmseg]
merge_number_and_ascii=0; #合并英文和数字 abc123/x
number_and_ascii_joint=-; #定义可以连接英文和数字的字符
compress_space=1;         #暂不支持
seperate_number_ascii=0; #就是将字母和数字打散

三,csft(sphinx)安装

1,旧版安装

# cp /coreseek的解压目录/mmseg-3.2.14/src/*/*.h /usr/local/mmseg3/include/mmseg/
# cd /home/tank/download/coreseek-4.0.1-beta
# aclocal
# libtoolize --force
# automake --add-missing
# autoconf
# autoheader
# perl -pi -e 's/lpthread/lpthread -liconv/g' src/Makefile*
# make clean
# ./configure --prefix=/usr/local/sphinx --enable-id64 \
--with-mysql=/usr/local/mysql2 --with-mmseg \
--with-mmseg-includes=/usr/local/mmseg3/include/mmseg/ \
--with-mmseg-libs=/usr/local/mmseg3/lib/
# make && make install

2,新版安装

# cd /home/tank/download/coreseek-4.0.1-beta
# ./buildconf.sh
# ./configure --prefix=/usr/local/sphinx --enable-id64 \
--with-mysql=/usr/local/mysql2 --with-mmseg \
--with-mmseg-includes=/usr/local/mmseg3/include/mmseg/ \
--with-mmseg-libs=/usr/local/mmseg3/lib/
# make && make install

coreseek-4.0.1,二种安装方式都是可以的,但是安装时,还是会报错。

四,mysql插件 sphinxse的安装

1,将mysqlse复制到mysql程序目录storage

# cp -R coreseek-4.0.1-beta/csft-4.0.1-beta/mysqlse /home/tank/download/mysql-5.5.8/storage/sphinx

2,cmake安装mysql 5.5.8

#cd /home/tank/download/mysql-5.5.8
# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql2 \
 -DMYSQL_UNIX_ADDR=/usr/local/mysql2/mysql.sock \
 -DCMAKE_BUILD_TYPE=Release -DWITH_SPHINX_STORAGE_ENGINE=1 \
 -DDEFAULT_CHARSET=utf8 \
 -DDEFAULT_COLLATION=utf8_general_ci \
 -DWITH_MYISAM_STORAGE_ENGINE=1 \
 -DWITH_INNOBASE_STORAGE_ENGINE=1 \
 -DWITH_MEMORY_STORAGE_ENGINE=1 \
 -DWITH_READLINE=1 \
 -DENABLED_LOCAL_INFILE=1 \
 -DMYSQL_DATADIR=/usr/local/mysql2/data \
 -DMYSQL_USER=mysql
# make && make install

cmake安装mysql高版本,请参考:linux cmake 安装mysql5.5.11,以及更高版本

3,configure安装mysql5.5.8

# cd /home/tank/download/mysql-5.5.8
# sh BUILD/autorun.sh
# ./configure --prefix=/usr/local/mysql2 \
--with-plugins=partition,innobase,myisam,sphinx \
--with-charset=utf8
# make && make install

4,初始化数据库

# cd /home/tank/download/mysql-5.5.8
# chmod +x scripts/mysql_install_db
# scripts/mysql_install_db --basedir=/usr/local/mysql2 \ #初始化数据
--datadir=/usr/local/mysql2/data --user=mysql
# cp support-files/my-medium.cnf /etc/my.cnf #copy配置文件
# chown -R mysql:mysql /usr/local/mysql2 #更改权限 
# vim /etc/my.cnf      #加上以下内容
[mysqld]
basedir = /usr/local/mysql2
datadir = /usr/local/mysql2/data
log-error = /usr/local/mysql2/mysql_error.log
pid-file = /usr/local/mysql2/mysql.pid
user = mysql
tmpdir = /tmp

5,启动并登录mysql

# cd /usr/local/mysql2/support-files/
# cp ./mysql.server /etc/init.d/mysql5
# /etc/init.d/mysql5 start              #启动服务端
# /usr/local/mysql2/bin/mysql           #客户端连接

6,启用sphinxse

sphinxse

sphinxse

在这里和以前安装sphinxse,有一点不同的是,以前mysql编译安装好了以后,就会有,不用在用root登录去install了。

五,配置sphinx.conf

# cd /usr/local/mysql2/support-files/
# cp ./mysql.server /etc/init.d/mysql5
# /etc/init.d/mysql5 start
# cd /usr/local/sphinx/etc
# cp sphinx.conf.dist sphinx.conf
# vim sphinx.conf 
source src1
{
 type = mysql
 sql_host = localhost
 sql_user = root //用名改一下
 sql_pass = 111111 //密码改一下,无密码,留空
 sql_db = test
 sql_query_pre = SET NAMES utf8 //这行注释去掉
 。。。。。。。。。。。省略。。。。。。。。。。。。。。
}
。。。。。。。。。。。省略。。。。。。。。。。。。。。
index rt //在index里面添加以下三行,加入中文分词功能
{
 type = rt
 path = /usr/local/sphinx/var/data/rt
 charset_dictpath = /usr/local/mmseg3/etc/ //添加
 charset_type = zh_cn.utf-8 //添加
 ngram_len = 0 //添加
 rt_field = title
 rt_field = content
 rt_attr_uint = gid
}
。。。。。。。。。。。省略。。。。。。。。。。。。。。

六,启动sphinx

//启动indexer
[root@localhost etc]# /usr/local/sphinx/bin/indexer --config /usr/local/sphinx/etc/sphinx.conf --all
Coreseek Fulltext 4.0 [ Sphinx 1.11-id64-dev (r2540)]
Copyright (c) 2007-2011,
Beijing Choice Software Technologies Inc (http://www.coreseek.com)
 using config file '/usr/local/sphinx/etc/sphinx.conf'...
indexing index 'test1'...
collected 4 docs, 0.0 MB
sorted 0.0 Mhits, 100.0% done
total 4 docs, 193 bytes
total 0.012 sec, 15540 bytes/sec, 322.08 docs/sec
indexing index 'test1stemmed'...
collected 4 docs, 0.0 MB
sorted 0.0 Mhits, 100.0% done
total 4 docs, 193 bytes
total 0.002 sec, 75097 bytes/sec, 1556.42 docs/sec
skipping non-plain index 'dist1'...
skipping non-plain index 'rt'...
total 6 reads, 0.000 sec, 0.1 kb/call avg, 0.0 msec/call avg
total 18 writes, 0.000 sec, 0.1 kb/call avg, 0.0 msec/call avg
//启动searchd
[root@localhost etc]# /usr/local/sphinx/bin/searchd --config /usr/local/sphinx/etc/sphinx.conf
Coreseek Fulltext 4.0 [ Sphinx 1.11-id64-dev (r2540)]
Copyright (c) 2007-2011,
Beijing Choice Software Technologies Inc (http://www.coreseek.com)
using config file '/usr/local/sphinx/etc/sphinx.conf'...
listening on all interfaces, port=9312
listening on all interfaces, port=9306
 precaching index 'test1'
precaching index 'test1stemmed'
WARNING: multiple addresses found for 'localhost', using the first one (ip=127.0.0.1)
precaching index 'rt'
precached 3 indexes in 0.001 sec
coreseek sphinx mmseg mysql 全文检索 安装 配置 上次搞全文检索的东西 ,还要追溯到2010了,当时个人觉得coreseek还不成熟,就用了原始的sphinx,请参考:sphinx mmseg mysql 中文分词,这次呢,决定用一下coreseek,看看有什么区别。 一,安装环境和工具 服务器用的是centos6.5 x86 coreseek 4.0.1下载地址:http://www.coreseek.cn/uploads/csft/4.0/coreseek-4.0.1-beta.tar.gz mysql 5.5.8下载地址:http://downloads.mysql.com/archives/community/ 二,mmseg中文分词安装 1,旧版本安装方法 # tar zxvf coreseek-4.0.1-beta # cd coreseek-4.0.1-beta/mmseg-3.2.14/ # aclocal # libtoolize --force # automake --add-missing # autoconf # autoheader # make clean # ./configure --prefix=/usr/local/mmseg3 # make # make install 2,新版本安装方法 # ./bootstrap # ./configure --prefix=/usr/local/mmseg3 # make # make install mmseg-3.2.14,二种方法都可以安装成功,在编译时有报warning,但不影响安装。 3,新版本mmseg安装后,分词的东西就好了,不要用mmseg去生成了 [root@localhost mmseg-3.2.14]# ll /usr/local/mmseg3/etc/ 总用量 5432 -rwxr-xr-x 1 root root 229 7月 31 01:44 mmseg.ini -rwxr-xr-x 1 root root 1826251 7月 31 01:44 unigram.txt -rwxr-xr-x 1 [...]coreseek sphinx mmseg mysql 全文检索 安装 配置
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
MySQL String Types: Storage, Performance, and Best PracticesMySQL String Types: Storage, Performance, and Best PracticesMay 10, 2025 am 12:02 AM

MySQLstringtypesimpactstorageandperformanceasfollows:1)CHARisfixed-length,alwaysusingthesamestoragespace,whichcanbefasterbutlessspace-efficient.2)VARCHARisvariable-length,morespace-efficientbutpotentiallyslower.3)TEXTisforlargetext,storedoutsiderows,

Understanding MySQL String Types: VARCHAR, TEXT, CHAR, and MoreUnderstanding MySQL String Types: VARCHAR, TEXT, CHAR, and MoreMay 10, 2025 am 12:02 AM

MySQLstringtypesincludeVARCHAR,TEXT,CHAR,ENUM,andSET.1)VARCHARisversatileforvariable-lengthstringsuptoaspecifiedlimit.2)TEXTisidealforlargetextstoragewithoutadefinedlength.3)CHARisfixed-length,suitableforconsistentdatalikecodes.4)ENUMenforcesdatainte

What are the String Data Types in MySQL?What are the String Data Types in MySQL?May 10, 2025 am 12:01 AM

MySQLoffersvariousstringdatatypes:1)CHARforfixed-lengthstrings,2)VARCHARforvariable-lengthtext,3)BINARYandVARBINARYforbinarydata,4)BLOBandTEXTforlargedata,and5)ENUMandSETforcontrolledinput.Eachtypehasspecificusesandperformancecharacteristics,sochoose

How to Grant Permissions to New MySQL UsersHow to Grant Permissions to New MySQL UsersMay 09, 2025 am 12:16 AM

TograntpermissionstonewMySQLusers,followthesesteps:1)AccessMySQLasauserwithsufficientprivileges,2)CreateanewuserwiththeCREATEUSERcommand,3)UsetheGRANTcommandtospecifypermissionslikeSELECT,INSERT,UPDATE,orALLPRIVILEGESonspecificdatabasesortables,and4)

How to Add Users in MySQL: A Step-by-Step GuideHow to Add Users in MySQL: A Step-by-Step GuideMay 09, 2025 am 12:14 AM

ToaddusersinMySQLeffectivelyandsecurely,followthesesteps:1)UsetheCREATEUSERstatementtoaddanewuser,specifyingthehostandastrongpassword.2)GrantnecessaryprivilegesusingtheGRANTstatement,adheringtotheprincipleofleastprivilege.3)Implementsecuritymeasuresl

MySQL: Adding a new user with complex permissionsMySQL: Adding a new user with complex permissionsMay 09, 2025 am 12:09 AM

ToaddanewuserwithcomplexpermissionsinMySQL,followthesesteps:1)CreatetheuserwithCREATEUSER'newuser'@'localhost'IDENTIFIEDBY'password';.2)Grantreadaccesstoalltablesin'mydatabase'withGRANTSELECTONmydatabase.TO'newuser'@'localhost';.3)Grantwriteaccessto'

MySQL: String Data Types and CollationsMySQL: String Data Types and CollationsMay 09, 2025 am 12:08 AM

The string data types in MySQL include CHAR, VARCHAR, BINARY, VARBINARY, BLOB, and TEXT. The collations determine the comparison and sorting of strings. 1.CHAR is suitable for fixed-length strings, VARCHAR is suitable for variable-length strings. 2.BINARY and VARBINARY are used for binary data, and BLOB and TEXT are used for large object data. 3. Sorting rules such as utf8mb4_unicode_ci ignores upper and lower case and is suitable for user names; utf8mb4_bin is case sensitive and is suitable for fields that require precise comparison.

MySQL: What length should I use for VARCHARs?MySQL: What length should I use for VARCHARs?May 09, 2025 am 12:06 AM

The best MySQLVARCHAR column length selection should be based on data analysis, consider future growth, evaluate performance impacts, and character set requirements. 1) Analyze the data to determine typical lengths; 2) Reserve future expansion space; 3) Pay attention to the impact of large lengths on performance; 4) Consider the impact of character sets on storage. Through these steps, the efficiency and scalability of the database can be optimized.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools