首页 文章

如何使用NGINX 1.6.2对wso2 1.9.0进行负载均衡

提问于
浏览
0

我正在尝试使用前端NGINX 1.6.2负载均衡器来 balancer API Manager 1.9.0 . 我有2台服务器:

服务器A(xxx.xxx.xxx.xx1和xxx.xxx.xxx.x11) - 公共和专用IP服务器B(xxx.xxx.xxx.xx2和xxx.xxx.xxx.x22) - 公共和私有IP

API Manager 1.9.0和所有四个组件都在服务器B上安装并启动 .

我在服务器A上停止了NGINX,它也安装了API Manager 1.9.0并且只在工作模式下运行 . NGINX软件安装在/ opt / rh / nginx16 / root / etc / nginx中 . 我将以下配置文件添加到/opt/rh/nginx16/root/etc/nginx/conf.d并成功启动了该服务:

(am.http.conf)

上游xxx.xxx.xxx.x11

server xxx.xxx.xxx.x11:9763

    server xxx.xxx.xxx.x22:9763

服务器

listen 80

    server_name xxx.xxx.xxx.x11

    location / 
           proxy_set_header X-Forwarded-Host $host
           proxy_set_header X-Forwarded-Server $host
           proxy_set_header X-Forwarded-For

$ proxy_add_x_forwarded_for proxy_set_header主机$ http_host proxy_read_timeout 5m proxy_send_timeout 5m proxy_pass http://xxx.xxx.xxx.x11

(am.https.conf)

上游xxx.xxx.xxx.1

server xxx.xxx.xxx.xx1:9443
server xxx.xxx.xxx.xx2:9443

服务器

听443

server_name xxx.xxx.xxx.xx1

ssl on



ssl_certificate /opt/rh/nginx16/root/etc/nginx/ssl/wrk.crt
ssl_certificate_key /opt/rh/nginx16/root/etc/nginx/ssl/wrk.key
location / 
           proxy_set_header X-Forwarded-Host $host
           proxy_set_header X-Forwarded-Server $host
           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
           proxy_set_header Host $http_host
           proxy_read_timeout 5m
           proxy_send_timeout 5m
    proxy_pass https://xxx.xxx.xxx.xx1

(mgt.am.https.conf)

服务器侦听443 server_name xxx.xxx.xxx.xx2 ssl on ssl_certificate /opt/rh/nginx16/root/etc/nginx/ssl/mgt.crt ssl_certificate_key / opt / rh / nginx16 / root / etc / nginx / ssl / mgt . 键

location /carbon 
           proxy_set_header X-Forwarded-Host $host
           proxy_set_header X-Forwarded-Server $host
           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
           proxy_set_header Host $http_host
           proxy_read_timeout 5m
           proxy_send_timeout 5m
    proxy_pass https://xxx.xxx.xxx.xx2:9443/

error_log  /var/log/nginx/mgt-error.log 
       access_log  /var/log/nginx/mgt-access.log

我根据此文档对axis2.xml,carbon.xml,catalina.server.xml进行了文档更改:https://docs.wso2.com/display/CLUSTER420/Clustering+the+Gateway

我正在尝试用有限的资源创建一个原型 .

  • 上游服务器的IP地址可以吗?

  • 如何测试上述配置?

  • 如何访问index.html页面以验证NGINX是否安装正确?

  • 如何确保API工作人员同步并与同一数据库通信?

任何有关这方面的帮助将不胜感激!

1 回答

  • 0
    • Upstream用于定义可由指令引用的服务器组,例如proxy_pass . 你可以使用任何东西,但使用一些用户友好的命名格式是一个好习惯 .

    • 完成API Manager群集后,发送请求并验证它们是否已提供 .

    • 在浏览器上访问NGINX服务器的IP地址,查看是否已加载index.html页面

    • 这里,假设API Worker意味着APIM网关工作者:您必须在所有组件中正确定义数据源并安装它们 . 然后关闭一个工作人员,看到该请求由其他工作人员提供服务 . 参考https://docs.wso2.com/display/CLUSTER44x/Clustering+API+Manager+1.10.0

相关问题