×ðÁú¿­Ê±¹ÙÍøµÇ¼

ÔõÑùÔÚLinuxÉÏÉèÖø߿ÉÓõÄϵͳ׼ʱʹÃü

ÔõÑùÔÚlinuxÉÏÉèÖø߿ÉÓõÄϵͳ׼ʱʹÃü

ÔÚLinuxϵͳÖÐ £¬×¼Ê±Ê¹ÃüÊÇÒ»ÏîºÜÊÇÖ÷ÒªµÄ¹¦Ð§ £¬¿ÉÒÔÈÃÎÒÃÇ×Ô¶¯Ö´ÐÐһЩÖظ´ÐÔµÄʹÃü £¬Ìá¸ßÊÂÇéЧÂÊ¡£È»¶ø £¬µ±ÎÒÃǵÄϵͳÐèÒª¼á³Ö¸ß¿ÉÓÃÐÔʱ £¬¾ÍÐèÒªÌØÊâ¹Øע׼ʱʹÃüµÄÉèÖà £¬È·±£×ÝÈ»ÔÚij¸ö½Úµã·ºÆð¹ÊÕϵÄÇéÐÎÏ £¬Ê¹ÃüÈÔÈ»Äܹ»Õý³£ÔËÐС£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚlinuxÉÏÉèÖø߿ÉÓõÄϵͳ׼ʱʹÃü £¬²¢¸½ÉÏÏìÓ¦µÄ´úÂëʾÀý¡£

Ò»¡¢Ê¹ÓÃcrontabÖÎÀí׼ʱʹÃü

ÔÚLinuxϵͳÖÐ £¬ÎÒÃÇͨ³£Ê¹ÓÃcrontabÏÂÁîÀ´ÖÎÀí׼ʱʹÃü¡£crontabÏÂÁîÄܹ»ÈÃÎÒÃÇÌí¼Ó¡¢É¾³ý¡¢Éó²éºÍ±à¼­×¼Ê±Ê¹Ãü £¬ºÜÊÇÀû±ãÊÊÓá£

Ìí¼Ó׼ʱʹÃü

ÎÒÃÇ¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁîÀ´Ìí¼Ó׼ʱʹÃü£º

crontab -e

µÇ¼ºó¸´ÖÆ

Õâ¸öÏÂÁî»á·­¿ªÒ»¸öÎı¾±à¼­Æ÷ £¬ÈÃÎÒÃDZ༭Ŀ½ñÓû§µÄ׼ʱʹÃü¡£Ã¿Ò»Ðдú±íÒ»¸ö׼ʱʹÃü £¬ÃûÌÃÈçÏ£º

command

ÆäÖÐ£¬Îå¸öÐǺŻ®·Ö´ú±íÁË·ÖÖÓ¡¢Ð¡Ê±¡¢Ìì¡¢Ô¡¢ÐÇÆÚ£¬¿ÉÒÔÓÃÏêϸµÄÊý×ÖÌåÏÖ£¬Ò²¿ÉÒÔÓÃ"*"ÌåÏÖí§ÒâÖµ¡£command´ú±íÒªÖ´ÐеÄÏÂÁî»ò¾ç±¾¡£

µÇ¼ºó¸´ÖÆ

ɾ³ý׼ʱʹÃü

ÈôÊÇÎÒÃÇÐèҪɾ³ýÒ»¸ö׼ʱʹÃü £¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁ

crontab -r

µÇ¼ºó¸´ÖÆ

Õâ¸öÏÂÁî»áɾ³ýÄ¿½ñÓû§µÄËùÓÐ׼ʱʹÃü¡£

Éó²é׼ʱʹÃü

ÈôÊÇÎÒÃÇÐèÒªÉó²éÄ¿½ñÓû§µÄ׼ʱʹÃüÁбí £¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁ

crontab -l

µÇ¼ºó¸´ÖÆ

Õâ¸öÏÂÁî»áÏÔʾĿ½ñÓû§µÄ׼ʱʹÃüÁбí¡£

¶þ¡¢ÉèÖø߿ÉÓõÄϵͳ׼ʱʹÃü

ÒªÔÚLinuxϵͳÉÏÉèÖø߿ÉÓõÄϵͳ׼ʱʹÃü £¬ÎÒÃÇÐèҪʹÓü¯ÈºÖÎÀí¹¤¾ßÀ´ÊµÏÖʹÃüµÄ×Ô¶¯Çл»ºÍͬ²½¡£ÏÂÃæÒÔKeepalivedΪÀý £¬ÏÈÈÝÔõÑù¾ÙÐÐÉèÖá£

×°ÖÃKeepalived

Ê×ÏÈ £¬ÎÒÃÇÐèҪװÖÃKeepalived¡£ÔÚDebian/UbuntuϵͳÉÏ £¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁî¾ÙÐÐ×°Öãº

apt-get install keepalived

µÇ¼ºó¸´ÖÆ

ÔÚÆäËûLinux¿¯ÐаæÉÏ £¬¿ÉÒÔͨ¹ýÔ´Âë×°Öá£

ÉèÖÃKeepalived

µ±KeepalivedÍê³É×°Öúó £¬ÐèÒª¾ÙÐÐÏà¹ØÉèÖ᣿ÉÒÔͨ¹ý±à¼­ÉèÖÃÎļþ/etc/keepalived/keepalived.confÀ´¾ÙÐÐÉèÖá£ÏêϸµÄÉèÖÃÏîºÍ²ÎÊý¿ÉÒÔƾ֤ÏÖʵÐèÇó¾ÙÐе÷½â¡£

ÉèÖÃHAProxy

Keepalivedͨ³£ºÍHAProxyÅäºÏʹÓà £¬ÒÔʵÏÖʹÃüµÄ×Ô¶¯Çл»ºÍ¸ºÔØƽºâ¡£ÔÚÉèÖÃHAProxyʱ £¬ÎÒÃÇÐèÒª½«×¼Ê±Ê¹ÃüµÄÇëÇóת·¢¸øºó¶ËµÄʹÃü½Úµã¡£¿ÉÒÔͨ¹ý±à¼­ÉèÖÃÎļþ/etc/haproxy/haproxy.cfgÀ´¾ÙÐÐÉèÖá£ÏêϸµÄÉèÖÃÏîºÍ²ÎÊý¿ÉÒÔƾ֤ÏÖʵÐèÇó¾ÙÐе÷½â¡£

ÉèÖÃ׼ʱʹÃü

ÔÚÉèÖÃÁËKeepalivedºÍHAProxyÖ®ºó £¬ÎÒÃÇÐèÒª½«×¼Ê±Ê¹ÃüÉèÖÃÔÚºó¶ËµÄʹÃü½ÚµãÉÏ¡£ÕâÑù £¬µ±Ö÷½Úµã±¬·¢¹ÊÕÏʱ £¬×¼Ê±Ê¹Ãü»á×Ô¶¯Çл»µ½±¸·Ý½ÚµãÉÏÖ´ÐС£

ÒÔÏÂÊÇÒ»¸öʾÀýµÄ׼ʱʹÃüÉèÖãº

* * * * * root /usr/local/bin/mycronjob.sh

µÇ¼ºó¸´ÖÆ

Õâ¸ö׼ʱʹÃü»áÿ·ÖÖÓÖ´ÐÐÒ»´ÎÃûΪmycronjob.shµÄ¾ç±¾¡£

ͬ²½ÉèÖÃÎļþºÍ¾ç±¾

ΪÁË°ü¹Ü¸ß¿ÉÓÃÐÔ £¬ÎÒÃÇÐèÒª½«ÉèÖÃÎļþºÍ¾ç±¾Í¬²½µ½ËùÓеÄʹÃü½ÚµãÉÏ¡£¿ÉÒÔʹÓù¤¾ßÈçrsync»òscpÀ´¾ÙÐÐÎļþµÄͬ²½¡£

²âÊԸ߿ÉÓÃÐÔ

µ±ÉèÖÃÍê³Éºó £¬ÎÒÃÇ¿ÉÒÔ¾ÙÐÐһЩ¹ÊÕÏÄ£Äâ²âÊÔ £¬ÒÔÑéÖ¤¸ß¿ÉÓÃÐÔ¡£ÀýÈç £¬¿ÉÒÔͨ¹ý¹Ø±ÕÖ÷½ÚµãÉϵÄKeepalivedЧÀÍÀ´Ä£ÄâÖ÷½ÚµãµÄ¹ÊÕÏ £¬ÊÓ²ìʹÃüÊÇ·ñÄܹ»×Ô¶¯Çл»µ½±¸·Ý½ÚµãÉÏÖ´ÐС£

×ܽá

ͨ¹ýÒÔÉϵÄÉèÖà £¬ÎÒÃÇ¿ÉÒÔÔÚLinuxϵͳÉÏʵÏָ߿ÉÓõÄϵͳ׼ʱʹÃü¡£Í¨¹ýʹÓü¯ÈºÖÎÀí¹¤¾ßºÍ¸ºÔØƽºâÊÖÒÕ £¬ÎÒÃÇÄܹ»È·±£×ÝÈ»ÔÚij¸ö½Úµã¹ÊÕϵÄÇéÐÎÏ £¬×¼Ê±Ê¹ÃüÈÔÈ»Äܹ»Õý³£ÔËÐС£Ï£Íû±¾ÎĹØÓÚ¸÷ÈËÃ÷È·ºÍÉèÖø߿ÉÓõÄϵͳ׼ʱʹÃüÓÐËù×ÊÖú¡£

ÒÔÉϾÍÊÇÔõÑùÔÚLinuxÉÏÉèÖø߿ÉÓõÄϵͳ׼ʱʹÃüµÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí £¬°æȨÕùÒéÓë±¾Õ¾ÎÞ¹Ø £¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È £¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ £¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢ £¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢ £¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎå £¬9:30-18:30 £¬½ÚãåÈÕÐÝÏ¢

QR code
ÍøÕ¾µØͼ