cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3456
Views
3
Helpful
3
Replies

Configuring HAProxy/Nginx for non-HTTP

allera001
Level 1
Level 1

Hi all,

I've tried to find the answer to this in the documentation, but keep coming up empty.

HAProxy and Nginx, when used as tier apps within the App Builder, work great at configuring themselves for the HTTP backends they balance.  However, I'd like to balance non-HTTP ports (in this example, TCP 3306 for back end slave MySQL databases).

How can this be done programmatically?

Thank you!

Alex

1 Accepted Solution

Accepted Solutions

tuanngu4
Cisco Employee
Cisco Employee

Alex,

From my perspective you could stage an haproxy.cfg file in an app package and, in a script - say, node initialization script for example - copy that file from the /opt/remoteFiles/appPackage directory to the /etc/haproxy directory (assuming a Linux OS). Alternatively, you could use sed or echo to replace/add text to your haproxy.cfg file. As for the actual structure of the cfg file I think this would vary greatly. PLease let me know if this answers your question.

View solution in original post

3 Replies 3

tuanngu4
Cisco Employee
Cisco Employee

Alex,

From my perspective you could stage an haproxy.cfg file in an app package and, in a script - say, node initialization script for example - copy that file from the /opt/remoteFiles/appPackage directory to the /etc/haproxy directory (assuming a Linux OS). Alternatively, you could use sed or echo to replace/add text to your haproxy.cfg file. As for the actual structure of the cfg file I think this would vary greatly. PLease let me know if this answers your question.

Thanks, Tuan.  It sounds like this might work for initial deployment. 

How would we handle auto scaling with this approach?  Are there phases or stages for scaling up/down that I can hook a script into?

Alex,

Our out-of-box Nginx service should handle this automatically so if you wanted to use that for your base LB or take the lifecycle functions in the script to crate your own you could do that (the script is named service and it resides in /usr/local/osmosix/service/nginx). If you wanted to create an External Service to leverage an ecosystem partner like f5, you could write a function for the "Update" lifecycle stage and handle the logic upon a CloudCenter originated scaling event. The scaling event, from a platform perspective, will initiate the "Update" stage of the lifecycle actions.

Tuan

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: