Reputation: 33
I'm trying to load balance API Manager 1.9.0 with a front-end NGINX 1.6.2 load balancer. I have 2 servers:
Server A (xxx.xxx.xxx.xx1 and xxx.xxx.xxx.x11) - Public and Private IPs Server B (xxx.xxx.xxx.xx2 and xxx.xxx.xxx.x22) - Public and Private IPs
API Manager 1.9.0 and all four components are installed and started on server B.
I stalled NGINX on Server A which also has API Manager 1.9.0 installed and running in worker mode only. The NGINX software installed in /opt/rh/nginx16/root/etc/nginx. I added the following configuration files to /opt/rh/nginx16/root/etc/nginx/conf.d and successfully started the service:
(am.http.conf)
upstream xxx.xxx.xxx.x11
server xxx.xxx.xxx.x11:9763
server xxx.xxx.xxx.x22:9763
server
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 Host $http_host proxy_read_timeout 5m proxy_send_timeout 5m proxy_pass http://xxx.xxx.xxx.x11
(am.https.conf)
upstream xxx.xxx.xxx.1
server xxx.xxx.xxx.xx1:9443
server xxx.xxx.xxx.xx2:9443
server
listen 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)
server listen 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.key
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
I made the documented changes to the axis2.xml, carbon.xml, catalina.server.xml per this document: https://docs.wso2.com/display/CLUSTER420/Clustering+the+Gateway
I'm trying to create a prototype with limited resources.
Any help with this will be greatly appreciated!
Upvotes: 0
Views: 270
Reputation: 94
Upstream is used to define groups of servers that can be referenced by the directives such as proxy_pass. You can use anything for that but it is a good practice to use some user friendly naming format.
Once the API Manager clustering is completed, send requests and verify whether they are served.
Access the IP address of NGINX server on browser and see whether the index.html page is loaded
Here, assume that API Worker means APIM Gateway worker: you have to properly define datasources across all components and mount them. Then shutdown one worker and see the request are served by other worker. Refer https://docs.wso2.com/display/CLUSTER44x/Clustering+API+Manager+1.10.0
Upvotes: 0