当前位置: 代码迷 >> 综合 >> centOS6.5安装coreseek,php+mysql+coreseek调试测试,亲测管用
  详细解决方案

centOS6.5安装coreseek,php+mysql+coreseek调试测试,亲测管用

热度:73   发布时间:2023-09-22 09:20:26.0

安装参考官方教程(http://www.coreseek.cn/products/products-install/install_on_bsd_linux/)
CoreSeek快速安装:

coreseek安装需要预装的软件:yum install make gcc g++ gcc-c++ libtool autoconf automake imake MySQL-devel libxml2-devel expat-devel

cd /usr/local/src
wget http://www.coreseek.cn/uploads/csft/3.2/coreseek-3.2.14.tar.gz(如果不能下载可以用迅雷下载后传到服务器解压)
tar -xzvf coreseek-3.2.14.tar.gz
cd coreseek-3.2.14

##安装mmseg
cd mmseg-3.2.14
./bootstrap #输出的warning信息可以忽略,如果出现error则需要解决,,如果出现permission denied是权限问题 chmod -R 777 ./bootstrap,其他地方出现相同问题也这样处理就行
./configure --prefix=/usr/local/mmseg3
make && make install
cd …

安装完成后,mmseg使用的词典和配置文件将自动安装到/usr/local/mmseg3/etc中

##安装coreseek
cd csft-3.2.14
sh buildconf.sh #输出的warning信息可以忽略,如果出现error则需要解决
./configure --prefix=/usr/local/coreseek --without-unixodbc --with-mmseg --with-mmseg-includes=/usr/local/mmseg3/include/mmseg/ --with-mmseg-libs=/usr/local/mmseg3/lib/ --with-mysql ##如果提示mysql问题,可以查看MySQL数据源安装说明
make && make install
cd …

cd /usr/local/coreseek/etc
cp sphinx-min.conf.dist sphinx.conf
vi sphinx.conf
内容示例如下(localhost,DB_USER,DB_PASSWORD,DB_NAME自行修改)
以下是我的数据
source main
{type                                    = mysqlsql_host                                = localhostsql_user                                = rootsql_pass                                =kobebryant24sql_db                                  = dgshopsql_port                                = 3306  # optional, default is 3306sql_query_pre                           = SET NAMES utf8sql_query                               = \SELECT id,cat_id,add_time,goods_name \FROM cms_goodssql_attr_uint                   = cat_idsql_attr_timestamp              = add_timesql_query_info                  = SELECT * FROM cms_goods WHERE id=$id
}index main
{source                                  = mainpath                                    = /usr/local/coreseek/var/data/maindocinfo                                 = externcharset_dictpath                        = /usr/local/mmseg3/etc/charset_type                            = zh_cn.utf-8ngram_len                               = 0
}indexer
{mem_limit                               = 32M
}searchd
{port                                    = 9312log                                             = /usr/local/coreseek/var/log/searchd.logquery_log                               = /usr/local/coreseek/var/log/query.logread_timeout                            = 5max_children                            = 30pid_file                                = /usr/local/coreseek/var/log/searchd.pidmax_matches                             = 1000seamless_rotate                         = 1preopen_indexes                         = 1unlink_old                              = 1
}
然后根据以上配置建立索引文件/usr/local/coreseek/bin/indexer -c /usr/local/coreseek/etc/sphinx.conf --all --rotate启动命令 /usr/local/coreseek/bin/searchd -c /usr/local/coreseek/etc/sphinx.conf至此就可以通过php  api调试测试了
![这里写图片描述](https://img-blog.csdn.net/20170422155535349?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcXFfMzQ0MzIzNDg=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
我这里是在本地windows下调试的,具体方法可自行百度另外,远程连接MYSQL提示Host is not allowed to connect to this MySQL server时
解决方法:
Centos7 开放3306端口:
打开防火墙:     systemctl start firewalld
永久开放3306端口:   firewall-cmd --zone=public --add-port=3306/tcp --permanent
重新载入:   firewall-cmd --reload
1。 改表法。可能是你的帐号不允许从远程登陆,只能在localhost。这个时候只要在localhost的那台电脑,登入mysql后,更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改称"%"mysql -u root -pvmwaremysql>use mysql;mysql>update user set host = '%' where user = 'root';mysql>flush privileges;mysql>select host, user from user;mysql>quit2. 授权法。例如,你想myuser使用mypassword从任何主机连接到mysql服务器的话。GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;FLUSH PRIVILEGES;如果你想允许用户myuser从ip为192.168.1.6的主机连接到mysql服务器,并使用mypassword作为密码GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;FLUSH PRIVILEGES;如果你想允许用户myuser从ip为192.168.1.6的主机连接到mysql服务器的dk数据库,并使用mypassword作为密码GRANT ALL PRIVILEGES ON dk.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;FLUSH PRIVILEGES;

这里参考http://joinyo.iteye.com/blog/1489380
博主用的第一个方法,刚开始发现不行,在网上查了一下,少执行一个语句 mysql>FLUSH RIVILEGES 使修改生效.就可以了
我这里用的第二种方法,简单粗暴

注:参考博文http://blog.csdn.net/keyunq/article/details/45129867

  相关解决方案