mysqlµÄmaster/slaveÊý¾Ýͬ²½ÅäÖÃ[ת]
ÎҵIJâÊÔ»·¾³.»ù±¾ÉÏÊý¾ÝÊÇ˲¼äͬ²½£¬Ï£Íû¶Ô´ó¼ÒÓаïÖú
redhat 9.0
mysql3.23.57
mysqlÊý¾Ýͬ²½±¸·Ý
A·þÎñÆ÷£º 192.168.1.2 Ö÷·þÎñÆ÷master
B·þÎñÆ÷£º 192.168.1.3 ¸±·þÎñÆ÷slave
A·þÎñÆ÷ÉèÖÃ
#mysql –u root –p
mysql>GRANT FILE ON *.* TO backup@192.168.1.3 IDENTIFIED BY ‘1234’;
mysql>\exit
ÉÏÃæÊÇMaster¿ª·ÅÒ»¸öÕ˺ÅbackupÃÜÂë1234¸øIP:192.168.1.3Óеµ°¸´¦ÀíµÄȨÏÞ
mysqladmin –u root –p shutdown
±¸·ÝMasterËùÓÐÊý¾Ý¿â..ͨ³£¶¼ÓÃtarÖ¸Áî.
#tar –cvf /tmp/mysql.tar /var/lib/mysql
×¢Òâ:tarµÄʱºò,MySQLÊÇÒªÔÚstopÇé¿öÏÂ
ÔÚA»úÆ÷ÉÏÐÞ¸Ä/etc/my.cnf
ÔÚ[mysqld]Çø¶ÎÄÚ¼ÓÈë²ÎÊý
log-bin
server-id=1
sql-bin-update-same
binlog-do-db=vbb
ÖØÆôA·þÎñÆ÷mysql
´ËʱÒòΪÓмÓÈëlog-bin²ÎÊý,Òò´Ë¿ªÊ¼ÓÐindex²úÉúÁË,ÔÚ/var/lib/mysqlĿ¼ÏÂÓÐ.indexµµ°¸¼Í¼Êý¾Ý¿âµÄÒ춯log.
B·þÎñÆ÷ÉèÖÃ
É趨/etc/my.cnf
ÔÚ[mysqld]Çø¶Î¼ÓÈë
master-host=192.168.1.2
master-user=backup
master-password=1234
master-port=3306
server-id=2
master-connect-retry=60 Ô¤ÉèÖØÊÔ¼ä¸ô60Ãë
replicate-do-db=vbb ¸æËßslaveÖ»×övbbÊý¾Ý¿âµÄ¸üÐÂ
log-slave-updates
½«AÉϵÄmysql.tar copyµ½BÉÏ
ÓÃftp´«BµÄ/tmp
9.½âѹËõ
#cd /var/lib/
×´¿ö²âÊÔ
1.A¸úBÍøÂç¼°·þÎñ¶¼Õý³£Çé¿öÏÂ,ÓÉA¶Ë±ä»¯Êý¾Ýºó,µ½B¶Ëä¯ÀÀÊý¾Ý,¼ìÊÓÊÇ·ñÓнøÐÐreplication?!
2.Ä£ÄâBµ±»ú,»òÊÇB²»Ò»¶¨ÐèÒªÒ»Ö±¸úAÓÐÁ¬½Ó.
½«ÓÉA¶Ë±ä»¯Êý¾Ýºó,µ½B¶Ëä¯ÀÀÊý¾Ý£¬BµãÓ¦¸ÃÊÇûÓÐÊý¾Ý±ä»¯µÄ
#tar xvf /tmp/mysql-snapshot.tar
#chown –R mysql:mysql mysql
1ÖØÆôB·þÎñÆ÷µÄmysql
ÕâʱÔÚ/var/lib/mysqlĿ¼»á³öÏÖmaster.info,´Ëµµ°¸¼Í¼ÁËMaster MySQL serverµÄÐÅÏ¢.
×´¿ö²âÊÔ
1.A¸úBÍøÂç¼°·þÎñ¶¼Õý³£Çé¿öÏÂ,ÓÉA¶Ë±ä»¯Êý¾Ýºó,µ½B¶Ëä¯ÀÀÊý¾Ý,¼ìÊÓÊÇ·ñÓнøÐÐreplication?!
2.Ä£ÄâBµ±»ú,»òÊÇB²»Ò»¶¨ÐèÒªÒ»Ö±¸úAÓÐÁ¬½Ó.
½«ÓÉA¶Ë±ä»¯Êý¾Ýºó,µ½B¶Ëä¯ÀÀÊý¾Ý£¬BµãÓ¦¸ÃÊÇûÓÐÊý¾Ý±ä»¯µÄ
Ïà¹ØÎĵµ£º
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************************************************************/
ͨÓùæÔò£º
Õû
¸öÊý¾Ý¿âÀïµÄÃû×Ö¶¼¾¡Á¿Ê¹ÓÃСд¡£ÕâÑùÄÜÏû³ýÓÉÓÚ´óСд£¨
case-sensitivity
£©´øÀ´
µÄ´íÎó¡£
Mysql
ĬÈÏÇø·Ö´óСд¡£
ʹ
ÓÃÏ»®Ï߶ϿªÃû×Ö£¬Ãû×ÖÖв»ÄÜ
ʹÓÿոñ¡£
Ãû×ÖÖо¡Á¿²»Òª
ʹ
ÓÃÊý ......
Ç°ÑÔ£º
±¾ÎIJûÊöµÄÊÇÒ»¿î¾¹ýÉú²ú»·¾³¼ìÑéµÄǧÍò¼¶Êý¾ÝÈ«ÎļìË÷£¨ËÑË÷ÒýÇ棩¼Ü¹¹¡£±¾ÎÄÖ»ÁгöÇ°¼¸ÕµÄÄÚÈݽÚÑ¡£¬²»ÌṩȫÎÄÄÚÈÝ¡£
ÔÚDELL PowerEdge 6850·þÎñÆ÷£¨ËÄ¿Å64 λInter Xeon MP 7110N´¦ÀíÆ÷ / 8GBÄڴ棩¡¢RedHat AS4 Linux²Ù×÷ϵͳ¡¢MySQL 5.1.26¡¢MyISAM´æ´¢ÒýÇæ¡¢key_buffer=1024M»·¾³ÏÂʵ²â£¬µ¥±í1000ÍòÌõ¼Ç ......
SLES 11
ÉèÖÃmysql·þÎñ×Ô¶¯Æô¶¯×´Ì¬
chkconfig mysql on
(chkconfig mysql off)
Ìí¼Ó/ɾ³ýmysql·þÎñ
/sbin/chkconfig --del mysql
/sbin/chkconfig --add mysql
²é¿´mysql°æ±¾
mysql -V
mysqld -V
ÆôÍ£ mysql
service mysql start
service mysql stop
service mysql restart
......