...
First, for the API to function as a clustered API, you need to setup Zookeeper. You may want to run Zookeeper in the LoadBalancer node or in a separate box, depending in your needs and/or preferences.
Zookeeper requires JVM to run, ensure that JVM (Oracle or OpenJDK) is installed.
...
Code Block |
---|
# yum -y install zookeeper |
Then, you need to add the following line in the [server] section of the abiquo.properties file in all Abiquo API server nodes:
Code Block |
---|
abiquo.api.zk.serverConnection = <zookeeper_ip>:2181 |
...
In a clustered UI setup, you will need to configure the LB as API endpoint for each UI node. Edit /var/www/html/ui/config/client-config.json file and set same config.endpoint property for each UI node. For example:
Code Block |
---|
"config.endpoint": "https://abiquo.example.com/api" |
...
LoadBalancer Apache node configuration
Make sure the jvmRoute parameter is different in each host as this will be used by Apache tomcat to route requests to each host.
To do that, edit the /opt/abiquo/tomcat/conf/server.xml file inside the tomcat directory and edit the following values:
Code Block |
---|
<Engine name="Catalina" defaultHost="localhost" jvmRoute="node1"> |
Restart tomcat after the change to apply new configuration.
LoadBalancer Apache configuration
First, you need to make sure that Apache's required modules are loaded. Be sure to include the following lines in your Apache config file:
...
You need to make sure that Apache's required modules are loaded. Be sure to include the following lines in your Apache config file:
Code Block |
---|
LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_balancer_module modules/mod_proxy_balancer.so LoadModule proxy_balancer_module modules/mod_proxy_balancer.so LoadModule proxy_ftpftp_module modules/mod_proxy_ftp.so LoadModule proxy_http_module modules/mod_proxy_http.so LoadModule proxy_connect_module modules/mod_proxy_connect.so LoadModule proxy_ajp_module modules/mod_proxy_ajp.so |
Now in In the LB LoadBalancer node running apacheApache, create a new config file in /etc/httpd/conf.d/api-balancer.conf with the following contents:
...
Tip |
---|
Note that this config enables Apache's balancer-manager to get information on the balancer cluster and perform basic operations on it. If you want to disable it, just comment or remove the <Location /> mark. |
Info | ||
---|---|---|
| ||
In the Apache configuration sample shown above, the LoadBalancer node also provides the SSL layer and hence, the Proxy balancing rule should be done without SSL against the UI nodes. |
Abiquo API Tomcat configuration
Make sure the jvmRoute parameter is different in each host as this will be used by Apache tomcat to route requests to each host.
To do that, edit the /opt/abiquo/tomcat/conf/server.xml file inside the tomcat directory and edit the following values:
Code Block |
---|
<Engine name="Catalina" defaultHost="localhost" jvmRoute="node1"> |
You need to import LoadBalancer's Apache SSL certificate and CA into Java truststore in order to enable API complete SSL connections to API endpoints. In case you are using a self-certificate for testing purposes, it will be enough importing the SSL certificate
This should be done in every node running the API webapp:
Code Block |
---|
# echo -n | openssl s_client -connect abiquo.example.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > abiquo.example.com.cert
# /usr/java/default/bin/keytool -import -file abiquo.example.com.cert -keystore /path/to/cacerts
# /usr/java/default/bin/keytool -import -trustcacerts -file /path/to/ca/ca.pem -alias CA_ALIAS -keystore /path/to/cacerts |
Tip | ||
---|---|---|
| ||
|
Restart tomcat after the change to apply new configuration.
Now, accessing your balancer IP at http://10.60.13.10/client-premium or /api, will balance requests between the two backend nodes.
...