Nginx+PHP+MySQLË«»ú»¥±¸¡¢È«×Ô¶¯Çл»·½°¸
ÔÚÉú²úÓ¦ÓÃÖУ¬Ä³Ì¨“Nginx+PHP+MySQL”½Ó¿ÚÊý¾Ý·þÎñÆ÷£¬°çÑݵĽÇÉ«Ê®·ÖÖØÒª£¬Èç¹û·þÎñÆ÷Ó²¼þ»òNginx¡¢MySQL·¢Éú¹ÊÕÏ£¬¶ø ¶Ìʱ¼äÄÚÎÞ·¨»Ö¸´£¬ºó¹û½«·Ç³£ÑÏÖØ¡£ÎªÁ˱ÜÃâµ¥µã¹ÊÕÏ£¬ÎÒÉè¼ÆÁË´ËÌ×·½°¸£¬±àдÁËfailover.sh½Å±¾£¬ÊµÏÖÁËË«»ú»¥±¸¡¢È«×Ô¶¯Çл»£¬¹ÊÕÏתÒÆʱ¼ä Ö»Ð輸ʮÃë¡£
Ò»¡¢Ë«»ú»¥±¸¡¢È«×Ô¶¯Çл»·½°¸£º
1¡¢ÍØÆËͼ£º
2¡¢½âÊÍ£º
(1)¡¢¼ÙÉèÍâÍøÓòÃûblog.s135.com½âÎöµ½ÍâÍøÐéÄâIP 72.249.146.214ÉÏ£¬ÄÚÍøhostsÉèÖÃdb10¶ÔÓ¦ÄÚÍøÐéÄâIP 192.168.146.214
(2)¡¢Ä¬ÈÏÇé¿öÏ£¬ÓÉÖ÷»ú°ó¶¨ÄÚ¡¢ÍâÍøÐéÄâIP£¬±¸»ú×÷Ϊ±¸·Ý£¬µ±Ö÷»úµÄMySQL¡¢Nginx»ò·þÎñÆ÷³öÏÖ¹ÊÕÏÎÞ·¨·ÃÎÊʱ£¬±¸»ú»á×Ô¶¯½Ó¹ÜÄÚ¡¢ÍâÍø ÐéÄâIP¡£Á½Ì¨·þÎñÆ÷¶¼Æô¶¯¸ºÔð¼à¿Ø¡¢×Ô¶¯Çл»ÐéÄâIPµÄÊØ»¤½ø³Ì/usr/bin/nohup /bin/sh /usr/local/webserver/failover/failover.sh 2>&1 > /dev/null &
(3)¡¢Ö÷»úºÍ±¸»úÉϵÄMySQL·þÎñÆ÷»¥ÎªÖ÷´Ó£¬»¥Ïàͬ²½¡£ÔÚÖ÷»ú´¦Óڻ״̬£¨¼´ÓÉÖ÷»ú°ó¶¨ÐéÄâIP£©Ê±£¬¶ÁдÖ÷»úµÄ MySQL£¬Ð´µ½Ö÷»úµÄÊý¾Ý»áͬ²½µ½±¸»ú£»ÔÚ±¸»ú´¦Óڻ״̬ʱ£¬¶Áд±¸»úµÄMySQL£¬Ð´µ½±¸»úµÄÊý¾Ý»áͬ²½µ½Ö÷»ú£¨Èç¹ûÖ÷»úÉϵÄMySQLËÀµôÔÝʱÎÞ ·¨Í¬²½£¬Ö÷»úÉϵÄMySQL»Ö¸´ºó£¬Êý¾Ý»á×Ô¶¯´Ó±¸»úÉÏͬ²½¹ýÀ´£¬·´Ö®ÒàÈ»£©¡£
(4)¡¢Ö÷»ú´¦Óڻ״̬ʱ£¬Ã¿20Ãë»á°Ñ /data0/htdocs/£¨ÍøÒ³¡¢³ÌÐò¡¢Í¼Æ¬´æ·ÅĿ¼£©¡¢/usr/local/webserver/php/etc/£¨php.iniµÈÅäÖÃÎļþÄ¿ ¼£©¡¢/usr/local/webserver/nginx/conf/£¨NginxÅäÖÃÎļþĿ¼£©Èý¸öĿ¼ÏµÄÎļþͨ¹ýrsyncÍÆË͵½±¸»ú·þÎñÆ÷ÉÏ µÄ¶ÔӦĿ¼£¨ÔöÁ¿ÍÆËÍ£¬Á½Ì¨·þÎñÆ÷ÉÏÒ»ÑùµÄÎļþ²»»áÖظ´ÍÆËÍ£©£¬·´Ö®Èç¹û±¸»ú´¦Óڻ״̬ʱ£¬Ã¿20Ãë»á³¢ÊÔ°ÑÎļþÍÆË͵½Ö÷»ú¡£rsyncµÄÅäÖÃÎļþ¼ûÁ½ ̨·þÎñÆ÷µÄ/etc/rsyncd.conf£¬rsyncÊØ»¤½ø³ÌµÄÆô¶¯ÃüÁîΪrsync –daemon
3¡¢×Ô¶¯Çл»Á÷³Ì
(1)¡¢Ö÷»úĬÈÏ°ó¶¨ÄÚ¡¢ÍâÍøÐéÄâIP£¬µ±Ö÷»úµÄMySQL¡¢NginxÎÞ·¨·ÃÎÊ»ò·þÎñÆ÷å´»ú£¬Ö÷»úÉϵÄfailover.shÊØ»¤½ø³Ì»á×Ô¶¯Õª³ý×Ô¼º °ó¶¨µÄÄÚ¡¢ÍâÍøÐéÄâIP£¨Èç¹ûÖ÷»úÉϵÄfailover.shËÀµô£¬ÎÞ·¨Õª³ý×Ô¼º°ó¶¨µÄÐéÄâIPҲû¹Øϵ£©£¬±¸»úÉϵÄfailover.shÊØ»¤½ø³Ì»á×Ô ¶¯½Ó¹Ü±¸»úÔÀ´°ó¶¨µÄÄÚ¡¢ÍâÍøÐéÄâIP£¬²¢·¢ËÍARPing°ü¸øÄÚ¡¢ÍâÍøÍø¹Ø¸üÐÂMAC£¬Ç¿Ðнӹܡ£
(2)¡¢±¸»ú°ó¶¨ÐéÄâIPºó£¬»á·¢ËÍARPing°ü¸øÄÚ¡¢ÍâÍøÍø¹Ø£¬Í¨ÖªÍø¹Ø¸üÐÂÐéÄâIPµÄMACµØַΪ±¸»úµÄMACµØÖ·£¬´Ó¶ø±£Ö¤ÁËÇл»ºóÄܹ»Í¨¹ýÐéÄâIP¼°Ê±·ÃÎʵ½±¸»ú¡£
(3)¡¢Èç¹ûÖ÷»úµÄMySQL¡¢NginxÆô¶¯ÆðÀ´£¬È
Ïà¹ØÎĵµ£º
ÀàÎļþwordsplit.class.php£º
<?php
/********************************************************************
* DirCMSÖÐÎÄ·Ö´ÊÀà beta 1.0
* ---------------------------
* begin : 2010-5-11 beta 1.0
* update : 2 ......
php cliÃüÁîÐÐģʽÊÇWINϵÄÒ»¸öSHELL£¬²»ÐèÒªAPACHEµÄÖ§³Ö¾ÍÄÜÖ´ÐÐPHP½Å±¾µÄ½Å±¾£¬²¢ÇÒÊdzÖÐøÖ´Ðеġ£ÕâЩÌصãºÜÈÝÒ×ÀûÓÃÀ´¿ìËÙ²âÊÔPHP½Å±¾¡£½ñÌì¾ÍÌØÒâÕÒÀ´Ò»Ð©×ÊÁÏ£¬ÕûÀíÁËһϣ¬È¨µ±¸´Ï°¡£
D:\AppServ\php5>php -help
Usage: php [options] [-f] <file> [--] [args...]
&nbs ......
EXPLAIN ÊÇmysql½âÊÍselect²éѯµÄÒ»¸ö¹Ø¼ü×Ö,¿ÉÒԺܷ½±ãµÄÓÃÓÚµ÷ÊÔ
Óï·¨¸ñʽÈçÏÂ
EXPLAIN tbl_name
»òÕß:
EXPLAIN SELECT select_options
EXPLAIN Óï¾ä¿ÉÒÔ±»µ±×÷ DESCRIBE µÄͬÒå´ÊÀ´Óã¬Ò²¿ÉÒÔÓÃÀ´»ñÈ¡Ò»¸öMySQLÒªÖ´ÐÐµÄ SELECT Óï¾äµÄÏà¹ØÐÅÏ¢¡£
EXPLAIN tbl_name Óï·¨ºÍ DESCRIBE tbl_name »ò SHOW COLUMNS ......
windows주
½â¾ö°ì·¨£º
1.¼ì²éÄãµÄMysqlĿ¼ÓÐûÓиøϵͳµÄSystemÓû§È¨ÏÞ¡£
2.ɾ³ýµôÄãµÄ %WINDOWS%/my.ini Îļþ¡£
3.¼ì²éÄãµÄ c:/my.cnf ÎļþÅäÖÃÊÇ·ñÕýÈ·¡£
ÐÞ¸Ä%windir%\my.ini£¬Ôö¼Ó
[mysqld]
#ÉèÖÃbasedirÖ¸ÏòmysqlµÄ°²×°Â·¾¶
basedir=D:\Program\Tools\mysql
datadir=D:\Program\Tools\mysql\data& ......