...
First, for the API to function as a clustered API, you need to setup zookeeper. Zookeeper. Zookeeper requires JVM to run, ensure that JVM (Oracle or OpenJDK) is installed.
Code Block |
---|
# java -v |
The zookeeper package is installed using the "Server" profile of the Abiquo installer ISO. If it is not installed, you can do so typing:
Code Block |
---|
# yum -y install zookeeper |
At the command line. Then, you need to add the following line in the [server] section of the abiquo.properties file:
...
You will need to edit file /opt/abiquo/tomcat/conf/Catalina/localhost/api.xml and /opt/abiquo/tomcat/conf/Catalina/localhost/m.xml and set the values for the MySQL kinton database connection:
Code Block |
---|
<Resource name="jdbc/abiquoDB" auth="Container" type="javax.sql.DataSource" initialSize="10" suspectTimeout="60" timeBetweenEvictionRunsMillis="30000" minEvictableIdleTimeMillis="60000" maxActive="100" minIdle="10" maxIdle="50" maxWait="10000" removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true" username="rootmysql_user" password="user_password" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhostmysql.example.com:3306/kinton?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8"/> |
The same configuration on the client-premium MySQL jdbc connection should be done in /opt/abiquo/tomcat/conf/Catalina/localhost/client-premium.xml file.
You need to change the url, username and password attributes to match your environment.
...
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", |
...
//abiquo.example.com/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 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:
Code Block |
---|
LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_balancer_module modules/mod_proxy_balancer.so LoadModule proxy_ftp_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 the LB node running apache, create a new config file in /etc/httpd/conf.d/api-balancer.conf with the following contents:
Code Block |
---|
<VirtualHost *:443> ServerName abiquo.example.com SSLEngine on SSLProtocol all -SSLv2 SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW SSLCertificateFile /etc/pki/tls/certs/abiquo.example.com.crt SSLCertificateKeyFile /etc/pki/tls/private/abiquo.example.com.key # Enable the balancer manager console in the server root <Location /> SetHandler balancer-manager </Location> # Configure the API AJP cluster nodes <Proxy balancer://api-cluster> BalancerMember ajp://10192.60168.132.39100:8010 route=node1 ping=1 BalancerMember ajp://10192.60168.132.39101:8010 route=node2 ping=1 </Proxy> # Configure the UI HTTP cluster nodes <Proxy balancer://ui-cluster> BalancerMember http://10192.60168.132.39100 route=node1 ping=1 BalancerMember http://10192.60168.132.25101 route=node2 ping=1 </Proxy> # Configure the modules we want to load balance ProxyPass /api/ balancer://api-cluster/api/ ProxyPass /ui/ balancer://ui-cluster/ui/ stickysession=JSESSIONID|jsessionid </VirtualHost> |
...