吹静静

欢迎QQ交流:592590682

随笔 - 421,  文章 - 68,  评论 - 65,  阅读 - 164万

场景描述

现在有 jar_1、jar_2 两个项目, 3个bigdata服务器节点,

jar_1 部署在bigdata1节点,jar_2 部署在3个节点,

用户访问 jar_1,jar_1 将访问请求转发给3个节点上的 jar_2。

jar_2 的监听端口 50544。

配置调试

1.修改nginx.conf
vim /etc/nginx.conf
复制代码
# For more information on configuration, see:
#   * Official English Documentation: http://nginx.org/en/docs/
#   * Official Russian Documentation: http://nginx.org/ru/docs/

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$host" "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 4096;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/conf.d/*.conf;

}
nginx.conf
复制代码
2.添加calc.bigdata.com.conf
vim cd /etc/nginx/conf.d/calc.bigdata.com.conf
复制代码
upstream calc {
    server bigdata1:50544;
    server bigdata2:50544;
    server bigdata3:50544;
}

server {
    server_name calc.bigdata.com;
    listen 30543;

    location / {
        proxy_pass http://calc;
    }
}
复制代码

3.修改bigdata1的hosts文件,添加如下内容:

127.0.0.1        calc.msun.com

4.重启Nginx

nginx -s reload

访问  jar_1 项目即可。

 

posted on   吹静静  阅读(365)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 字符编码:从基础到乱码解决

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示