05-10-2017 04:32 AM
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
Solved! Go to Solution.
05-10-2017 04:11 PM
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.
05-10-2017 04:11 PM
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.
05-15-2017 12:31 PM
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?
05-15-2017 12:52 PM
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
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: