0
votes

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.

  1. Is it ok to an IP address for the upstream server?
  2. How do I test the configurations above?
  3. How do I access the index.html page verify that NGINX is installed correctly?
  4. How do I ensure that the API workers are in sync and talking to the same database?

Any help with this will be greatly appreciated!

1
I removed the open and close brackets in order to get this to submithunter
you can use the below document to configure APIM with nginx sanjeewamalalgoda.blogspot.com/2014/12/…lakshman

1 Answers

0
votes
  1. 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.

  2. Once the API Manager clustering is completed, send requests and verify whether they are served.

  3. Access the IP address of NGINX server on browser and see whether the index.html page is loaded

  4. 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