Nginx Proxy ManagerÓëÂþÑÜʽ´æ´¢ÏµÍ³µÄ¼¯³É£º½â¾öº£Á¿Êý¾Ý»á¼ûÎÊÌâ
Nginx Proxy ManagerÓëÂþÑÜʽ´æ´¢ÏµÍ³µÄ¼¯³É£º½â¾öº£Á¿Êý¾Ý»á¼ûÎÊÌ⣬ÐèÒªÏêϸ´úÂëʾÀý
СÐò£º
Ëæ×Å´óÊý¾Ýʱ´úµÄµ½À´£¬Ðí¶àÆóÒµÃæÁÙ×Å´¦Öóͷ£º£Á¿Êý¾ÝµÄÌôÕ½¡£¹Å°åµÄµ¥½Úµã´æ´¢ÏµÍ³ÎÞ·¨Öª×ã¸ß²¢·¢µÄÊý¾ÝÇëÇóºÍʵʱÊý¾Ý´¦Öóͷ£µÄÐèÇó¡£ÎªÏàʶ¾öÕâ¸öÎÊÌ⣬Ðí¶àÆóÒµ×îÏȽÓÄÉÂþÑÜʽ´æ´¢ÏµÍ³À´´¦Öóͷ£º£Á¿Êý¾Ý¡£±¾ÎĽ«ÏÈÈÝÔõÑù½«Nginx Proxy ManagerÓëÂþÑÜʽ´æ´¢ÏµÍ³¼¯³É£¬ÒÔ½â¾öº£Á¿Êý¾Ý»á¼ûÎÊÌâ¡£
Ò»¡¢Nginx Proxy Manager¼ò½é
Nginx Proxy ManagerÊÇÒ»¸ö»ùÓÚNginxµÄ·´ÏòÊðÀíÖÎÀíÆ÷£¬ËüÌṩÁËÒ»¸öÓû§ÓѺõÄWeb½çÃæÀ´ÖÎÀíÊðÀíЧÀÍ¡£Nginx Proxy Manager¿ÉÒÔÇáËɵØÉèÖúÍÖÎÀíÊðÀí¹æÔò£¬²¢Ö§³Ö×Ô¶¯¸ºÔØƽºâ¡¢·´ÏòÊðÀí»º´æµÈ¹¦Ð§¡£ËüÊÇÒ»¸ö¹¦Ð§Ç¿Ê¢ÇÒÒ×ÓÚʹÓõŤ¾ß£¬¿ÉÒÔ´ó´ó¼ò»¯ÊðÀíЧÀ͵ÄÉèÖúÍÖÎÀí¡£
¶þ¡¢ÂþÑÜʽ´æ´¢ÏµÍ³µÄÑ¡Ôñ
ÔÚÑ¡ÔñÂþÑÜʽ´æ´¢ÏµÍ³Ö®Ç°£¬ÎÒÃÇÐèÒªÃ÷È·×Ô¼ºµÄÐèÇó¡£Æ¾Ö¤²î±ðµÄÓ¦Óó¡¾°£¬ÎÒÃÇ¿ÉÒÔÑ¡Ôñ²î±ðµÄÂþÑÜʽ´æ´¢ÏµÍ³£¬ºÃ±ÈHadoop¡¢HBase¡¢CassandraµÈ¡£ÕâÀïÒÔHadoopΪÀýÀ´ËµÃ÷£¬HadoopÊÇÒ»¸ö¿ªÔ´µÄÂþÑÜʽ´æ´¢ºÍÅÌËãƽ̨£¬Ëü¿ÉÒÔÔÚÁ®¼ÛµÄÓ²¼þÉϹ¹½¨´ó¹æÄ£µÄÊý¾Ý´æ´¢ºÍ´¦Öóͷ£ÏµÍ³¡£
Èý¡¢Nginx Proxy ManagerÓëHadoop¼¯³ÉµÄ°ì·¨
×°ÖúÍÉèÖÃNginx Proxy Manager
Ê×ÏÈ£¬ÎÒÃÇÐèÒªÔÚЧÀÍÆ÷ÉÏ×°ÖúÍÉèÖÃNginx Proxy Manager¡£ÏêϸµÄ×°ÖúÍÉèÖð취¿ÉÒԲο¼Nginx Proxy ManagerµÄ¹Ù·½Îĵµ¡£
×°ÖÃHadoop¼¯Èº
½ÓÏÂÀ´£¬ÎÒÃÇÐèÒª´î½¨Ò»¸öHadoop¼¯Èº¡£ÔÚÕâ¸öʾÀýÖУ¬ÎÒÃǼÙÉèÎÒÃÇÓÐ3̨ЧÀÍÆ÷£¬»®·ÖΪnamenode¡¢datanode1ºÍdatanode2¡£ÆäÖУ¬namenodeÊÇHadoopµÄÖ÷½Úµã£¬ÈÏÕæ´æ´¢ÎļþÔªÊý¾ÝºÍ¿ØÖÆÕû¸ö¼¯ÈºµÄÔËÐУ»datanode1ºÍdatanode2ÊÇHadoopµÄÊÂÇé½Úµã£¬ÈÏÕæ´æ´¢ºÍ´¦Öóͷ£ÏÖʵµÄÊý¾Ý¡£
ÉèÖÃNginx Proxy ManagerµÄ·´ÏòÊðÀí¹æÔò
ÔÚNginx Proxy ManagerµÄWeb½çÃæÖУ¬ÎÒÃÇ¿ÉÒÔÉèÖ÷´ÏòÊðÀí¹æÔò¡£ÎÒÃÇ¿ÉÒÔƾ֤ÐèÒªÉèÖöà¸öÊðÀí¹æÔò£¬Ã¿¸öÊðÀí¹æÔò¶ÔÓ¦Ò»¸öHadoop¼¯ÈºµÄ½Úµã¡£ÏêϸµÄÉèÖð취ÈçÏ£º
£¨1£©ÔÚ”Proxy Hostnames”×Ö¶ÎÖУ¬ÊäÈëHadoop¼¯ÈºµÄ½ÚµãIPµØµãºÍ¶Ë¿ÚºÅ¡£
£¨2£©ÔÚ”Remote Hostname”×Ö¶ÎÖУ¬ÊäÈ뼯ȺÄÚ²¿µÄ½ÚµãIPµØµãºÍ¶Ë¿ÚºÅ¡£
£¨3£©µã»÷”Save”°´Å¥ÉúÑÄÊðÀí¹æÔò¡£
ÉèÖÃHadoopµÄ»á¼ûȨÏÞ
ΪÁËÄܹ»»á¼ûHadoop¼¯ÈºµÄ½Úµã£¬ÎÒÃÇÐèÒªÉèÖÃÏìÓ¦µÄ»á¼ûȨÏÞ¡£ÏêϸµÄÉèÖð취ÈçÏ£º
£¨1£©±à¼HadoopµÄcore-site.xmlÉèÖÃÎļþ£¬½«Nginx Proxy ManagerµÄIPµØµãºÍ¶Ë¿ÚºÅÌí¼Óµ½fs.defaultFSÊôÐÔÖС£
£¨2£©±à¼HadoopµÄhdfs-site.xmlÉèÖÃÎļþ£¬½«Nginx Proxy ManagerµÄIPµØµãºÍ¶Ë¿ÚºÅÌí¼Óµ½dfs.namenode.secondary.http-addressÊôÐÔÖС£
£¨3£©ÖØÆôHadoop¼¯ÈºÊ¹ÉèÖÃÉúЧ¡£
ÖÁ´Ë£¬ÎÒÃÇÒѾÍê³ÉÁËNginx Proxy ManagerÓëHadoop¼¯ÈºµÄ¼¯³É¡£ÏÖÔÚ£¬ÎÒÃÇ¿ÉÒÔͨ¹ý»á¼ûNginx Proxy ManagerÀ´»á¼ûHadoop¼¯ÈºµÄ½Úµã¡£
ËÄ¡¢´úÂëʾÀý
ÒÔÏÂÊÇÒ»¸ö¼òÆÓµÄPython´úÂëʾÀý£¬ÑÝʾÔõÑùʹÓÃNginx Proxy Manager»á¼ûHadoop¼¯ÈºµÄ½Úµã£º
import requests # ÉèÖÃNginx Proxy ManagerµÄURL url = "http://nginx-proxy-manager-ip:port" # ÉèÖûá¼ûHadoopµÄ½Úµã·¾¶ path = "/hadoop-node-path" # ÌᳫGETÇëÇó response = requests.get(url + path) # Êä³öÏìÓ¦ÄÚÈÝ print(response.text)
µÇ¼ºó¸´ÖÆ
ͨ¹ýÉÏÊöʾÀý´úÂ룬ÎÒÃÇ¿ÉÒÔʹÓÃPython·¢ËÍGETÇëÇóÀ´»á¼ûHadoop¼¯ÈºµÄ½Úµã¡£
×ܽ᣺
ͨ¹ý½«Nginx Proxy ManagerÓëÂþÑÜʽ´æ´¢ÏµÍ³¼¯³É£¬ÎÒÃÇ¿ÉÒÔÇáËɵØʵÏÖº£Á¿Êý¾ÝµÄ»á¼ûºÍ´¦Öóͷ£¡£ÔÚ±¾ÎÄÖУ¬ÎÒÃÇÒÔHadoopΪÀýÀ´ÏÈÈÝÁËÔõÑù½«Nginx Proxy ManagerÓëÂþÑÜʽ´æ´¢ÏµÍ³¼¯³É£¬²¢ÌṩÁËÒ»¸ö¼òÆÓµÄPython´úÂëʾÀý¡£Ï£Íû±¾ÎĶԽâ¾öº£Á¿Êý¾Ý»á¼ûÎÊÌâÓÐËù×ÊÖú¡£
ÒÔÉϾÍÊÇNginx Proxy ManagerÓëÂþÑÜʽ´æ´¢ÏµÍ³µÄ¼¯³É£º½â¾öº£Á¿Êý¾Ý»á¼ûÎÊÌâµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡