Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

mysqlµÄÈȱ¸£º mysql replicationÔ­Àí½éÉÜ

×î½üÒµÎñ·ÃÎÊÁ¿±È½Ï´ó£¬Êý¾Ýͳ¼ÆÀàµÄ²Ù×÷¶¼Çл»µ½mysqlµÄ±¸»úÉÏÈ¥ÁË£¬±¸»úµÄ¶Á²Ù×÷²»»áÓ°ÏìÖ÷¡¢±¸Ö®¼äµÄÈȱ¸µÄ
ÏÂÃæÁÐһϾßÌåµÄÔ­Àí£º
ÒªÏëÓúÃÒ»¸öϵͳ£¬Àí½âÆäʵÏÖÔ­ÀíÊǷdz£ÖØÒªµÄÊÂÇ飬ֻÓÐÀí½âÁËÆäʵÏÖÔ­Àí£¬ÎÒÃDzÅÄܹ»Ñﳤ±Ü¶Ì£¬ºÏÀíµÄÀûÓ㬲ÅÄܹ»´î½¨³ö×îÊʺÏÎÒÃÇ×Ô¼ºÓ¦Óû·¾³µÄϵͳ£¬²ÅÄܹ»ÔÚϵͳʵʩ֮ºó¸üºÃµÄά»¤Ëû¡£MySQL Replication ¿ÉÒÔ˵ÊÇÔÚÄ¿Ç° MySQL Êý¾Ý¿âµÄʵ¼ÊÓ¦Óó¡¾°ÖÐ×îΪ³£¼ûµÄScale Out ÊÖ¶ÎÁË£¬ÕâÀï¾ÍÕë¶ÔÆäʵÏÖÔ­Àí×öÒ»¸ö¼òµ¥µÄ·ÖÎö¡£
¡¡¡¡Ò»¡¢ Replication Ïß³Ì
¡¡¡¡MysqlµÄ Replication ÊÇÒ»¸öÒì²½µÄ¸´Öƹý³Ì£¬´ÓÒ»¸ö Mysql instace(ÎÒÃdzÆ֮Ϊ Master)¸´ÖƵ½ÁíÒ»¸ö Mysql instance(ÎÒÃdzÆÖ® Slave)¡£ÔÚ Master Óë Slave Ö®¼äµÄʵÏÖÕû¸ö¸´Öƹý³ÌÖ÷ÒªÓÉÈý¸öÏß³ÌÀ´Íê³É£¬ÆäÖÐÁ½¸öÏß³Ì(SqlÏ̺߳ÍIOÏß³Ì)ÔÚ Slave ¶Ë£¬ÁíÍâÒ»¸öÏß³Ì(IOÏß³Ì)ÔÚ Master ¶Ë¡£
¡¡¡¡ÒªÊµÏÖ MySQL µÄ Replication £¬Ê×ÏȱØÐë´ò¿ª Master ¶ËµÄBinary Log(mysql-bin.xxxxxx)¹¦ÄÜ£¬·ñÔòÎÞ·¨ÊµÏÖ¡£ÒòΪÕû¸ö¸´Öƹý³Ìʵ¼ÊÉϾÍÊÇSlave´ÓMaster¶Ë»ñÈ¡¸ÃÈÕ־ȻºóÔÙÔÚ×Ô¼ºÉíÉÏÍêȫ˳ÐòµÄÖ´ÐÐÈÕÖ¾ÖÐËù¼Ç¼µÄ¸÷ÖÖ²Ù×÷¡£´ò¿ª MySQL µÄ Binary Log ¿ÉÒÔͨ¹ýÔÚÆô¶¯ MySQL Server µÄ¹ý³ÌÖÐʹÓà “—log-bin” ²ÎÊýÑ¡Ï»òÕßÔÚ my.cnf ÅäÖÃÎļþÖÐµÄ mysqld ²ÎÊý×é([mysqld]±êʶºóµÄ²ÎÊý²¿·Ö)Ôö¼Ó “log-bin” ²ÎÊýÏî¡£
¡¡¡¡MySQL ¸´ÖƵĻù±¾¹ý³ÌÈçÏ£º
¡¡¡¡1. Slave ÉÏÃæµÄIOÏß³ÌÁ¬½ÓÉÏ Master£¬²¢ÇëÇó´ÓÖ¸¶¨ÈÕÖ¾ÎļþµÄÖ¸¶¨Î»ÖÃ(»òÕß´Ó×ʼµÄÈÕÖ¾)Ö®ºóµÄÈÕÖ¾ÄÚÈÝ;
¡¡¡¡2. Master ½ÓÊÕµ½À´×Ô Slave µÄ IO Ï̵߳ÄÇëÇóºó£¬Í¨¹ý¸ºÔð¸´ÖÆµÄ IO Ï̸߳ù¾ÝÇëÇóÐÅÏ¢¶ÁÈ¡Ö¸¶¨ÈÕÖ¾Ö¸¶¨Î»ÖÃÖ®ºóµÄÈÕÖ¾ÐÅÏ¢£¬·µ»Ø¸ø Slave ¶ËµÄ IO Ï̡߳£·µ»ØÐÅÏ¢ÖгýÁËÈÕÖ¾Ëù°üº¬µÄÐÅÏ¢Ö®Í⣬»¹°üÀ¨±¾´Î·µ»ØµÄÐÅÏ¢ÔÚ Master ¶ËµÄ Binary Log ÎļþµÄÃû³ÆÒÔ¼°ÔÚ Binary Log ÖеÄλÖÃ;
¡¡¡¡3. Slave µÄ IO Ï߳̽ÓÊÕµ½ÐÅÏ¢ºó£¬½«½ÓÊÕµ½µÄÈÕÖ¾ÄÚÈÝÒÀ´ÎдÈëµ½ Slave ¶ËµÄRelay LogÎļþ(mysql-relay-bin.xxxxxx)µÄ×îÄ©¶Ë£¬²¢½«¶ÁÈ¡µ½µÄMaster¶ËµÄbin-logµÄÎļþÃûºÍλÖüǼµ½master- infoÎļþÖУ¬ÒÔ±ãÔÚÏÂÒ»´Î¶ÁÈ¡µÄʱºòÄܹ»Çå³þµÄ¸ßËÙMaster“ÎÒÐèÒª´Óij¸öbin-logµÄÄĸöλÖÿªÊ¼ÍùºóµÄÈÕÖ¾ÄÚÈÝ£¬Çë·¢¸øÎÒ”
¡¡¡¡4. Slave µÄ SQL Ï̼߳ì²âµ½ Relay Log ÖÐÐÂÔö¼ÓÁËÄÚÈݺ󣬻áÂíÉϽâÎö¸Ã Log ÎļþÖеÄÄÚÈݳÉΪÔÚ Master ¶ËÕæʵִÐÐʱºòµÄÄÇЩ¿ÉÖ´Ðе


Ïà¹ØÎĵµ£º

ÔÚaccessÖбíÖÐÊý¾Ýµ¼³öΪÎı¾Îļþµ½MySQLµÄÎÊÌ⣿

ÔÚaccessÖбíÖÐÊý¾Ýµ¼³öΪÎı¾Îļþµ½MySQLµÄÎÊÌ⣿
µ¼³öÎı¾Îļþʱºò£¬¿ÉÒÔÑ¡Ôñ×ֶηָô·û£¬À´°ÑÿһÁиô¿ª ºÍ Îı¾Ê¶±ð·û£¬À´°ÑcharÐÍÊý¾ÝÀ¨ÆðÀ´
ÎÒÏÖÔÚÓÓ£¬”×÷Ϊ×ֶηָô·û£¬²»Ê¹ÓÃÎı¾Ê¶±ð·û
Éú³ÉµÄÎı¾ÎļþÈçÏÂ
1£¬ÕÅÈý£¬ÄУ¬£¬Öйú  ÉϺ££¬80501206
2£¬ÍõÎ壬Ů£¬Öйú  ±±¾© ......

¸ßЧµÄMySQL·ÖÒ³

PERCONA PERFORMANCE CONFERENCE 2009ÉÏ£¬À´×ÔÑÅ»¢µÄ¼¸Î»¹¤³Ìʦ´øÀ´ÁËһƪ”Efficient Pagination Using MySQL“µÄ±¨¸æ£¬ÓкܶàÁÁµã£¬±¾ÎÄÊÇÔÚÔ­ÎÄ»ù´¡ÉϵĽøÒ»²½ÑÓÉì¡£
Ê×ÏÈ¿´Ò»Ï·ÖÒ³µÄ»ù±¾Ô­Àí£º
mysql> explain SELECT * from message ORDER BY id DESC LIMIT 10000, 20\G
***************** 1. row ** ......

ÐÞ¸ÄmysqlµÄrootÃÜÂëµÄ¼¸ÖÖ·½·¨

×÷Õß: Ф½¨±ò
| ¿ÉÒÔתÔØ, תÔØʱÎñ±ØÒÔ³¬Á´½ÓÐÎʽ±êÃ÷ÎÄÕÂԭʼ³ö´¦
ºÍ×÷ÕßÐÅÏ¢¼°°æȨÉùÃ÷
꿅᣼http://www.xiaojb.com/archives/it/mysqlroot.shtml
Method 1:
ÔÚ/usr/local/mysql/bin/Ï£º
./mysqladmin -u root password ‘new_password’
Ò»°ã°²×°Ê±Óô˷½·¨ÉèÖá£
Method 2:
ÔÚmysql×´ ......

MySqlÓï·¨

´´½¨Êý¾Ý¿â£ºcreate database Êý¾Ý¿âÃû;
´´½¨±í£ºcreate table ±íÃû £¨ ÁÐÃû Êý¾ÝÀàÐÍ not null... £©;
²é¿´ÏµÍ³ÖÐËùÓеÄÊý¾Ý¿â£ºshow databases;
Ñ¡ÔñÒªÓ¦ÓõÄÊý¾Ý¿â£ºuse Êý¾Ý¿âÃû;
²é¿´Ä³¸öÊý¾Ý¿âϵÄËùÓÐ±í£ºshow tables;
²é¿´±í½á¹¹£ºdesc(describe) ±íÃû;
ÖØÃüÃû±íÃû£ºalter table ±íÃû rename as бíÃû
¸ ......

SqlÔÚMysqlµÄÖ´ÐÐ

     ×òÌì½âÎöÁËdblp.xml£¬´æÈëÊý¾Ý¿â£¬Éú³ÉÁËÈô¸ÉÕÅÁÙʱ±í¡£½ñÌìÉÏÎ磬¶ÔÕâЩÁÙʱ±í½øÐд¦Àí£¬È»ºó´æÈëʵÑéÉè¼ÆµÄ±íÖС£Êý¾Ý¿âµÄÊý¾ÝÁ¿±È½Ï´ó£¬50¶àM£¬80¶àÍòÌõ¼Ç¼¡£Òò¶øÖ´ÐÐsqlʱ£¬¾ÍÓöµ½Á˺ܶàÎÊÌâ¡£
1¡¢È¥³ýÖظ´tuple
     ԭʼdblp.xmlÖУ¬Í¬Ò»ÂÛÎĵĴæÔÚ¼¸¸öÍêÈ«ÏàͬµÄ&l ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ