»ùÓÚSphinx+MySQLÈ«ÎļìË÷¼Ü¹¹Éè¼Æ
Ç°ÑÔ£º
±¾ÎIJûÊöµÄÊÇÒ»¿î¾¹ýÉú²ú»·¾³¼ìÑéµÄǧÍò¼¶Êý¾ÝÈ«ÎļìË÷£¨ËÑË÷ÒýÇ棩¼Ü¹¹¡£±¾ÎÄÖ»ÁгöÇ°¼¸ÕµÄÄÚÈݽÚÑ¡£¬²»ÌṩȫÎÄÄÚÈÝ¡£
ÔÚDELL PowerEdge 6850·þÎñÆ÷£¨ËÄ¿Å64 λInter Xeon MP 7110N´¦ÀíÆ÷ / 8GBÄڴ棩¡¢RedHat AS4 Linux²Ù×÷ϵͳ¡¢MySQL 5.1.26¡¢MyISAM´æ´¢ÒýÇæ¡¢key_buffer=1024M»·¾³ÏÂʵ²â£¬µ¥±í1000ÍòÌõ¼Ç¼µÄÊý¾ÝÁ¿£¨ÕâÕÅMySQL±íÓµÓÐint¡¢datetime¡¢varchar¡¢textµÈÀàÐ͵Ä10¶à¸ö×ֶΣ¬Ö»ÓÐÖ÷¼ü£¬ÎÞÆäËüË÷Òý£©£¬ÓÃÖ÷¼ü£¨PRIMARY KEY£©×÷ΪWHEREÌõ¼þ½øÐÐSQL²éѯ£¬Ëٶȷdz£Ö®¿ì£¬Ö»ºÄ·Ñ0.01Ãë¡£
³ö×Ô¶íÂÞ˹µÄ¿ªÔ´È«ÎÄËÑË÷ÒýÇæÈí¼þ Sphinx £¬µ¥Ò»Ë÷Òý×î´ó¿É°üº¬1ÒÚÌõ¼Ç¼£¬ÔÚ1ǧÍòÌõ¼Ç¼Çé¿öϵIJéѯËÙ¶ÈΪ0.xÃ루ºÁÃ뼶£©¡£Sphinx´´½¨Ë÷ÒýµÄËÙ¶ÈΪ£º´´½¨100ÍòÌõ¼Ç¼µÄË÷ÒýÖ»Ðè3¡«4·ÖÖÓ£¬´´½¨1000ÍòÌõ¼Ç¼µÄË÷Òý¿ÉÒÔÔÚ50·ÖÖÓÄÚÍê³É£¬¶øÖ»°üº¬×îÐÂ10ÍòÌõ¼Ç¼µÄÔöÁ¿Ë÷Òý£¬Öؽ¨Ò»´ÎÖ»Ð輸ʮÃë¡£
»ùÓÚÒÔÉϼ¸µã£¬ÎÒÉè¼Æ³öÁËÕâÌ×ËÑË÷ÒýÇæ¼Ü¹¹¡£ÔÚÉú²ú»·¾³ÔËÐÐÁËÒ»ÖÜ£¬Ð§¹û·Ç³£²»´í¡£ÓÐʱ¼äÎÒ»áרΪÅäºÏSphinxËÑË÷ÒýÇ棬¿ª·¢Ò»¸öÂß¼¼òµ¥¡¢Ëٶȿ졢ռÓÃÄÚ´æµÍ¡¢·Ç±íËøµÄMySQL´æ´¢ÒýÇæ²å¼þ£¬ÓÃÀ´´úÌæMyISAMÒýÇ棬ÒÔ½â¾öMyISAM´æ´¢ÒýÇæÔÚƵ·±¸üвÙ×÷ʱµÄËø±íÑÓ³ÙÎÊÌâ¡£ÁíÍ⣬·Ö²¼Ê½ËÑË÷¼¼ÊõÉÏÒÑÎÞÈκÎÎÊÌâ¡£
Ò»¡¢ËÑË÷ÒýÇæ¼Ü¹¹Éè¼Æ£º
1¡¢ËÑË÷ÒýÇæ¼Ü¹¹Í¼£º
2¡¢ËÑË÷ÒýÇæ¼Ü¹¹Éè¼Æ˼·£º
(1)¡¢µ÷Ó÷½Ê½×î¼ò»¯£º
¾¡Á¿·½±ãÇ°¶ËWeb¹¤³Ìʦ£¬Ö»ÐèÒªÒ»Ìõ¼òµ¥µÄSQLÓï¾ä“SELECT ... from myisam_table JOIN sphinx_table ON (sphinx_table.sphinx_id=myisam_table.id) WHERE query='...';”¼´¿ÉʵÏÖ¸ßЧËÑË÷¡£
(2)¡¢´´½¨Ë÷Òý¡¢²éѯËٶȿ죺
¢Ù¡¢Sphinx Search ÊÇÓɶíÂÞ˹ÈËAndrew Aksyonoff ¿ª·¢µÄ¸ßÐÔÄÜÈ«ÎÄËÑË÷Èí¼þ°ü£¬ÔÚGPLÓëÉÌÒµÐÒéË«Ðí¿ÉÐÒéÏ·¢ÐС£
SphinxµÄÌØÕ÷£º
SphinxÖ§³Ö¸ßËÙ½¨Á¢Ë÷Òý£¨¿É´ï10MB/Ã룬¶øLucene½¨Á¢Ë÷ÒýµÄËÙ¶ÈÊÇ1.8MB/Ã룩
¸ßÐÔÄÜËÑË÷£¨ÔÚ2-4 GBµÄÎı¾ÉÏËÑË÷£¬Æ½¾ù0.1ÃëÄÚ»ñµÃ½á¹û£©
¸ßÀ©Õ¹ÐÔ£¨Êµ²â×î¸ß¿É¶Ô100GBµÄÎı¾½¨Á¢Ë÷Òý£¬µ¥Ò»Ë÷Òý¿É°üº¬1ÒÚÌõ¼Ç¼£©
Ö§³Ö·Ö²¼Ê½¼ìË÷
Ö§³Ö»ùÓÚ¶ÌÓïºÍ»ùÓÚͳ¼ÆµÄ¸´ºÏ½á¹ûÅÅÐò»úÖÆ
Ö§³ÖÈÎÒâÊýÁ¿µÄÎļþ×ֶΣ¨ÊýÖµÊôÐÔ»òÈ«ÎļìË÷ÊôÐÔ£©
Ö§³Ö²»Í¬µÄËÑË÷ģʽ£¨“ÍêÈ«Æ¥Å䔣¬“¶ÌÓïÆ¥Å䔺͓ÈÎһƥÅ䔣©
Ö§³Ö×÷ΪMysqlµÄ´æ´¢ÒýÇæ
¢Ú¡¢Í¨¹ý¹úÍ⡶High Performance MySQL¡·×¨¼Ò×éµÄ²âÊÔ¿ÉÒÔ¿´³ö£¬¸ù¾ÝÖ÷¼ü½øÐвéѯµÄÀàËÆ&ldquo
Ïà¹ØÎĵµ£º
ÔÎÄÍøÖ·£ºhttp://knowhow.innovatedigital.com/mysql-monitoring.html
MySQLÊÇ×îÁ÷ÐеĿª·ÅÔ´´úÂë¹ØϵÊý¾Ý¿âϵͳ¡£ÆäÐÔÄܺÍÒ×ÓÃÐÔ£¬Ê¹Æä³ÉΪLAMP¼Ü¹¹µÄÖÐÐÄÖ§ÖùÖ®Ò»¡£
MySQL¼à¿ØÒ»Ö±ÊǹØ×¢MySQLÊý¾Ý¿âÐÔÄܺÍMySQLÊý¾Ý¿âÔËά¹ÜÀí¼¼ÊõÈËÔ±µÄ·Ç³£¸ÐÐËȤ»°Ìâ¡£ÈçºÎÈÃÄúµÄMySQLÊý¾Ý¿â° ......
ѧjava,ÓÐ×ÅÌ«¶àµÄÒÉÎʺͲ»½â,¾ÀúÁËÎÞÊýËƺõ¼òµ¥µ½ÎÊÌâ½â¾öºóͻȻ·¢ÏÖ×Ô¼ºÄÇôsxµÄµØ²½,È»¶ø¾ÍÎҵĸоõ,¶Ôÿ¸ö³õѧÕßÀ´Ëµ¶¼ÎÞ·¨±ÜÃâµÄÒª¾¹ýÕâ¸öÈÃÈËÍ´¿àµ½¶ñÐÄŻ͵½µ½»èØʵĵز½;ÕâÒ²ÐíÕýÊÇjava½ø½×֮ǰËùν×òÒ¹Î÷·çµò±ÖÊ÷°ãµÄ±Ø¾Ö®Í¾°É!
·Ï»°²»¶à˵ÁË,ÏÂÃæ ......
Ò»°ã¸³Ó踡µãÁеÄÖµ±»ËÄÉáÎåÈëµ½Õâ¸öÁÐËùÖ¸¶¨µÄÊ®½øÖÆÊý¡£Èç¹ûÔÚÒ»¸öFLOAT(8, 1)µÄÁÐÖд洢1. 2 3 4 5 6£¬Ôò½á¹ûΪ1. 2¡£Èç¹û½«ÏàͬµÄÖµ´æÈëFLOAT(8, 4) µÄÁÐÖУ¬Ôò½á¹ûΪ1. 2 3 4 6¡£Õâ±íʾӦ¸Ã¶¨Òå¾ßÓÐ×㹻λÊýµÄ¸¡µãÁÐÒÔ±ãµÃµ½¾¡¿ÉÄܾ«È·µÄÖµ¡£Èç¹ûÏ뾫ȷµ½Ç§·ÖÖ®Ò»£¬ÄǾͲ»Òª¶¨Òåʹ¸ÃÀà ......
Mysql Explain Ïê½â
ת×ÔITPUBhttp://www.itpub.net/viewthread.php?tid=1034410&extra=page%3D1%26amp%3Bfilter%3Ddigest&page=1
Ò».Óï·¨
explain < table_name >
ÀýÈç: explain select * from t3 where id=3952602;
¶þ.explainÊä³ö½âÊÍ
+----+-------------+-------+-------+-------------------+--- ......
/***************************by
garcon1986********************************/
1.´´½¨±í¸ñʱ´íÎó£º ERROR 1005: Can't
create table (errno: 150)
Õâ¸ö´íÎóÊÇÓÐÓÉÓÚÖ÷±íºÍÒýÓñíµÄÍâ¼ü¹ØÁª×ֶζ¨Òå²»Ò»ÖÂÒý·¢µÄ¡£
¼ì²éÁ½¸ö±íµÄ¹ØÁª×Ö¶ÎÊÇ·ñÀàÐͱàÂëÍêÈ«Ò»Ö¡£
ÁíÍ⻹ÓÐÒ»ÖÖ¿ÉÄܾÍÊǹØÁª×Ö¶ÎÔÚÒýÓñíÖÐ ......