วิธีติดตั้ง Sphinx

เกี่ยวกับ ปัญหาการใช้งาน การติดตั้ง ฐานข้อมูล MySql Oracle MSSQL ect...
การเขียน คำสั่ง SQL เพื่อดึกข้อมูล บอร์ดนี้ควรระบุโครงสร้างตารางของท่านในคำถามด้วยนะ

Moderator: mindphp

offing
PHP VIP Members
PHP VIP Members
โพสต์: 1527
ลงทะเบียนเมื่อ: 18/08/2014 10:01 am

วิธีติดตั้ง Sphinx

โพสต์ที่ยังไม่ได้อ่าน โดย offing »

SphinxSearch คือ SearchEngine มีความเร็วในการค้นหามากกว่าmy sql 10-1000เท่า
ลักษณะของsyntax จะคล้ายๆกับmysql แต่แตกต่างกันนิดหน่อย
โปรแกรมที่ยกตัวอย่าง เป็นตัว beta

วิธีติดตั้ง
- download Sphinx http://sphinxsearch.com/downloads/beta/
เลือกดาวโหลดตัวที่os ตรงกับเครื่องเราส่วนการเลือกbit ถ้าเครื่อง64bit สามารถใช้ได้ทั้ง32,64
ถ้าเครื่อง32 bit ต้องโหลด32bitเท่านั้น เลือกดาวโหลดตัวที่ซัพพอตได้หลายอย่าง
-แตกซิบไฟล์ที่โหลดไว้ไดร์ c
-สร้างฐานข้อมูลใน mysql ชื่อ test
-ทำการอิมพอตฐานข้อมูลที่อยู่ในโฟลเดอลงฐานข้อมูล test ใน mysql
-เปิดไฟล์ sphinx-min.confแล้วเปลี่ยนชื่อไฟล์เป็นsphinx.conf.in แล้วsave as ไว้ใน โฟลเดอ bin

command
-search ชุดคำสั่ง
-searchd ชุดคำสั่ง
--config (file) ใช้คอนฟิกแทบที่ค่าเดิม
--help เรียกหน้าต่างช่วยเหลือ
--stop ส่ง SIGTERM ไปให้ searchd ที่รันอยู่ปัจจุบัน
--install ติดตั้งใน windows service
--delete unistall windows service
--servicename ตั้งชื่อservice ใน windows servicename
--ntservice เรียกตัวเลือกในwindows service
--port กำหนดport
--all ........
--quiet เรียกดูเฉพาะเออเร่อ
--rotate .........
--dump ย้ายindexed rows เข้าไปในไฟล์
indextool ชุดคำสั่งสำหรับการโยกย้ายไฟล์
-c ใช้กรณีที่แปลงไฟล์และกำหนดในไฟล์

วิธีติดตั้ง
1.นำไฟล์ sphinx.conf.in save As ไว้ใน bin/sphinx.conf
2.แก้ไขcodeตามนี้

โค้ด: เลือกทั้งหมด

source testsrc1
{
   type         = mysql

   sql_host      = localhost
   sql_user      = root
   sql_pass      =
   sql_db         = test
   sql_port      = 3306   # optional, default is 3306

   sql_query      = \
      SELECT id, group_id, UNIX_TIMESTAMP(date_added) AS date_added, title, content \
      FROM documents

   sql_attr_uint      = group_id
   sql_attr_timestamp   = date_added
}


index test1
{
   source         = testsrc1
   path         = c:/sphinx/data/phpbb3
}





indexer
{
   mem_limit      = 128M
}


searchd
{
   listen         = 9312
   listen         = 9306:mysql41
   log         = c:/sphinx/log/searchd.log
   query_log      = c:/sphinx/log/query.log
   read_timeout      = 5
   max_children      = 30
   pid_file      = c:/sphinx/log/searchd.pid
   max_matches      = 1000
   seamless_rotate      = 1
   preopen_indexes      = 1
   unlink_old      = 1
   workers         = threads # for RT to work
   binlog_path      = c:/sphinx/data
}
3.เปิดstart-> run พิมพ์ cmd
4.cd c:/sphinx/bin <<ทำการเข้าโฟลเดิ้ล bin ใน sphinx
5.searchd --install --config c:/sphinx/bin/sphinx.conf --servicename SphinxSearch <<ทำการติดตั้ง service ชื่อ SphinxSearch
6.เข้า service คลิกขวา SphinxSearch เข้า properties
7.ปรับstartup type เป็น Manual แล้ว apply
8.start SphinxSearch
9.พิม indexer --rotate --all
10.ข้อมูลเข้า โฟลเดอร์
2.jpg
2.jpg (31.98 KiB) Viewed 155 times
11.ทำการคอนฟิก search --config c:/sphinx/bin/sphinx.conf test
12.
3.jpg
3.jpg (91.9 KiB) Viewed 155 times
13.
4.jpg
4.jpg (126.3 KiB) Viewed 155 times
14.
5.jpg
5.jpg (91.9 KiB) Viewed 155 times
15.
6.jpg
6.jpg (126.3 KiB) Viewed 155 times
16.
7.jpg
7.jpg (62.64 KiB) Viewed 155 times
17.
8.jpg
8.jpg (76.46 KiB) Viewed 155 times
18.
9.jpg
9.jpg (87.12 KiB) Viewed 155 times
  • Similar Topics
    ตอบกลับ
    แสดง
    โพสต์ล่าสุด

ผู้ใช้งานขณะนี้

สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 61