1. 程式人生 > >叢集中通過外網8088埠訪問不到

叢集中通過外網8088埠訪問不到

  叢集之間是通過內網互連的,host的對映檔案也是內網的ip地址,現在想通過外網訪問叢集,發現8088埠以及其它的埠訪問不到,解決的方法是用apache的反向代理。

  apache的安裝這裡就不介紹了

  1、開啟httpd.conf檔案,命令:vi /etc/httpd/conf/httpd.conf

      檢查檔案中以下東西是否配置:

      

        

2、在/etc/httpd/conf.d/目錄下新建任意檔名.conf的檔案,因為在1中包含了此目錄下所有的以.conf為字尾的檔案。

     新建檔案命令:vi /etc//httpd/conf.d/httpd-vhosts.conf 

     在檔案中加入內容:

    <VirtualHost *:80>

      ProxyPreserveHost On

      ProxyPass /cluster http://192.168.x.xx:8088/cluster
      ProxyPassReverse /cluster http://192.168.x.xx

:8088/cluster

      ProxyPass /jobhistory http://192.168.x.xx:19888/jobhistory
      ProxyPassReverse /jobhistory http://192.168.x.xx:19888/jobhistory
      ProxyPass /proxy http://192.168.x.xx:8088/proxy
      ProxyPassReverse /proxy http://192.168.x.xx:8088/proxy
      ErrorLog logs/master.infobird.com-error_log
      CustomLog logs/master.infobird.com-access_log common
   </VirtualHost>

   解釋:

        1、 當我們訪問http://ip:80/cluster的時候實際請求的是http://192.168.x.xx:8088/cluster的地址。

         ProxyPass /cluster http://192.168.x.xx:8088/cluster
         ProxyPassReverse /cluster http://192.168.x.xx:8088/cluster

        2、 配置的日誌檔案路徑

        ErrorLog logs/master.infobird.com-error_log
        CustomLog logs/master.infobird.com-access_log common