標籤:
Windows作業系統下 mysql資料來源配置:
主要步驟: 配置mysql資料來源設定檔->產生索引->開啟索引 (三步)
coreseek\etc\csft_mysql.conf (以下是我的設定檔)
#源定義
source mysql
{
type = mysql #表示mysql資料來源
sql_host = localhost #資料庫伺服器連結,127.0.0.1 也可以
sql_user = root #資料庫使用者名稱
sql_pass = root #資料庫密碼
sql_db = yii #資料庫 名
sql_port = 3306 #連接埠號碼
sql_query_pre = SET NAMES utf8 #
sql_query = SELECT id, name, aid FROM zzz
#sql_query第一列id需為整數
#title、content作為字串/文字欄位,被全文索引
#sql_attr_uint = group_id #從SQL讀取到的值必須為整數
#sql_attr_timestamp = date_added #從SQL讀取到的值必須為整數,作為時間屬性
sql_query_info_pre = SET NAMES utf8 #命令列查詢時,設定正確的字元集
sql_query_info = SELECT * FROM zzz WHERE id=$id #命令列查詢時,從資料庫讀取未經處理資料資訊
}
#index定義
index mysql
{
source = mysql #對應的source名稱
path = E:/WWW/coreseek/var/data/mysql #請修改為實際使用的絕對路徑,例如:/usr/local/coreseek/var/...
docinfo = extern
mlock = 0
morphology = none
min_word_len = 1
html_strip = 0
#中文分詞配置,詳情請查看:http://www.coreseek.cn/products-install/coreseek_mmseg/
#charset_dictpath = /usr/local/mmseg3/etc/ #BSD、Linux環境下設定,/符號結尾
charset_dictpath = E:/WWW/coreseek/etc/ #Windows環境下設定,/符號結尾,最好給出絕對路徑,例如:C:/usr/local/coreseek/etc/...
charset_type = zh_cn.utf-8
}
#全域index定義
indexer
{
mem_limit = 128M
}
#searchd服務定義
searchd
{
listen = 9312
read_timeout = 5
max_children = 30
max_matches = 1000
seamless_rotate = 0
preopen_indexes = 0
unlink_old = 1
pid_file = E:/WWW/coreseek/var/log/searchd_mysql.pid #請修改為實際使用的絕對路徑,例如:/usr/local/coreseek/var/...
log = E:/WWW/coreseek/var/log/searchd_mysql.log #請修改為實際使用的絕對路徑,例如:/usr/local/coreseek/var/...
query_log = E:/WWW/coreseek/var/log/query_mysql.log #請修改為實際使用的絕對路徑,例如:/usr/local/coreseek/var/...
}
配置完mysql資料來源後,保證你的環境是正常的(使用過程中,本人曾因為phpstudy忘記啟動,找錯找的天崩地裂)
接下來,在windows命令視窗運行(windows+r cmd 運行)
bin\indexer -c etc\csft_mysql.conf --all
(產生索引) 運行完此條命令,coreseek\var\data目錄下面多出7個mysql檔案,就對了
開啟sphinx 搜尋服務
bin\searchd -c etc\csft_mysql.conf
這樣就對了,,,這個就使mysql索引處於開啟狀態了,接下來
可以在項目裡面試試啦
這個要保持MySQL一直開啟索引,這個視窗不要關,
coreseek(sphinx)安裝2(mysql資料來源配置和測試)