Date Posted:
Product: TIBCO Spotfire®
Product: TIBCO Spotfire®
Problem:
How to run LiveView behind an Apache Load Balancer
Solution:
What are the proxy and load-balancer configurations for connecting to LiveView tables through an Apache httpd server?
Only Apache httpd.conf needs to be modified to permit proxying and load-balancing of LiveView Tables to external clients.
This example has been tested using product versions:
- Apache 2.4
- TIBCO Spotfire 10.8 (for re-connect capability)
- TIBCO Spotfire Data Streams (TIBCO Streaming) 10.5.0
- command-line: lv-client -u lv://localhost:80 "select * from ItemsInventory"
- web browser (lvweb and other application end-points): http://localhost:80/simple
- Spotfire Analyst: localhost:80
This example redirects from the normal HTTP port 80 to back-end servers running on port 10080 at IP's 127.0.0.1 and 192.168.1.7. The LiveView application which provides the "/simple" end-point is sample "sample_lv_sample_javascript" available within StreamBase Studio.
Make the following additions to the default Apache httpd.conf:
LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_balancer_module modules/mod_proxy_balancer.so LoadModule proxy_http_module modules/mod_proxy_http.so LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so LoadModule slotmem_shm_module modules/mod_slotmem_shm.so LoadModule xml2enc_module modules/mod_xml2enc.so LoadModule headers_module modules/mod_headers.so ProxyRequests Off ProxyPreserveHost On Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED <Proxy "balancer://simple"> BalancerMember "http://127.0.0.1:10080" route=1 BalancerMember "http://192.168.1.7:10080" route=2 ProxySet lbmethod=bytraffic ProxySet stickysession=ROUTEID </Proxy> <Proxy "balancer://lvapi"> BalancerMember "http://127.0.0.1:10080" route=1 BalancerMember "http://192.168.1.7:10080" route=2 ProxySet lbmethod=bytraffic ProxySet stickysession=ROUTEID </Proxy> <Proxy "balancer://lvclient"> BalancerMember "http://127.0.0.1:10080" route=1 BalancerMember "http://192.168.1.7:10080" route=2 ProxySet lbmethod=bytraffic ProxySet stickysession=ROUTEID </Proxy> <Proxy "balancer://lvstreaming/"> BalancerMember "ws://127.0.0.1:10080" route=1 BalancerMember "ws://192.168.1.7:10080" route=2 ProxySet lbmethod=bytraffic ProxySet stickysession=ROUTEID </Proxy> <Proxy "balancer://lvweb"> BalancerMember "http://127.0.0.1:10080" route=1 BalancerMember "http://192.168.1.7:10080" route=2 ProxySet lbmethod=bytraffic ProxySet stickysession=ROUTEID </Proxy> # Application Specific End-point ProxyPass "/simple" "balancer://simple/simple" ProxyPassReverse "/simple" "balancer://simple/simple" # Platform Specific Redirects ProxyPass "/lv/api" "balancer://lvapi/lv/api" ProxyPassReverse "/lv/api" "balancer://lvapi/lv/api" ProxyPass "/lv/client" "balancer://lvclient/lv/client" ProxyPassReverse "/lv/client" "balancer://lvclient/lv/client" ProxyPass "/lv/streaming/" "balancer://lvstreaming/lv/streaming/" ProxyPassReverse "/lv/streaming/" "balancer://lvstreaming/lv/streaming/" ProxyPass "/lvweb" "balancer://lvweb/lvweb" ProxyPassReverse "/lvweb" "balancer://lvweb/lvweb"
Please see the Apache documentation for a description of each of these settings.
https://httpd.apache.org/docs/2.4/mod/mod_proxy.html
https://httpd.apache.org/docs/2.4/mod/mod_proxy_balancer.html#stickyness
Apache mod_proxy documentation:
https://httpd.apache.org/docs/2.4/mod/mod_proxy.html
https://httpd.apache.org/docs/2.4/mod/mod_proxy_balancer.html#stickyness
Comments
0 comments
Article is closed for comments.