通过nginx反向代理查看内网Spark UI

1.下载nginx_substitutions_filter并解压

git clone git://github.com/yaoweibin/ngx_http_substitutions_filter_module.git

2.安装nginx 

wget http://nginx.org/download/nginx-1.4.2.tar.gz  

3.编译安装 

sudo ./configure --prefix=/usr/local/nginx --pid-path=/usr/local/nginx.pid  --with-http_dav_module --with-http_flv_module --with-http_realip_module --with-http_gzip_static_module --with-http_stub_status_module  --with-debug --add-module=/home/spark/ngx_http_substitutions_filter_module/ //这是模块解压的路径

sudo make

sudo make install

4.配置nginx.conf 

upstream  master {
     server 172.16.236.128:8080;
}
upstream  master2 {
     server 172.16.236.128:8088;
}
upstream  master3 {
     server 172.16.236.129:4040;
}


upstream  h102 {
     server 172.16.236.129:8042;
}
upstream  h103 {
     server 172.16.236.130:8042;
}
upstream  h104 {
     server 172.16.236.131:8042;
}
upstream  h105 {
     server 172.16.236.132:8042;
}
upstream  h106 {
     server 172.16.236.133:8042;
}
upstream  h107 {
     server 172.16.236.134:8042;
}
upstream  h108 {
     server 172.16.236.135:8042;
}
upstream  h109 {
     server 172.16.236.136:8042;
}
upstream  h110 {
     server 172.16.236.137:8042;
}
upstream  h111 {
     server 172.16.236.138:8042;
}


server {
listen 8080;
location / {
proxy_pass http://master;
}
}
server {
listen 8088;
location / {
proxy_pass http://master2;
}
}
server {
listen 4040;
location / {
proxy_pass http://master3;
}
}
server {
listen 8042;
location / {
proxy_pass http://h102;
}
}
server {
listen 8043;
location / {
proxy_pass http://h103;
}
}
server {
listen 8044;
location / {
proxy_pass http://h104;
}
}
server {
listen 8045;
location / {
proxy_pass http://h105;
}
}
server {
listen 8046;
location / {
proxy_pass http://h106;
}
}
server {
listen 8047;
location / {
proxy_pass http://h107;
}
}
server {
listen 8048;
location / {
proxy_pass http://h108;
}
}
server {
listen 8049;
location / {
proxy_pass http://h109;
}
}
server {
listen 8050;
location / {
proxy_pass http://h110;
}
}
server {
listen 8051;
location / {
proxy_pass http://h111;
}
}

最后重载配置文件

sudo /usr/local/nginx/sbin/nginx -s reload

通过服务器地址+端口号即可访问内网集群的对应网址

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值