Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

 

Abiquo version

This configuration is valid for Abiquo 3.x

 

The Abiquo API can be balanced amongst several servers to spread load and increase service capacity. As you know, Abiquo provides an HTML5 client application that runs on your browser that interacts with the API to operate the cloud.

So, as the UI is a regular HTML app, there may be several options to balance both the UI and the API. A couple of examples are given below.

API plus UI cluster

In this setup, we are spreading the load amongst a cluster of nodes running both API and UI. Please note that any API clustered setup REQUIRES using zookeeper to work.
For the sake of simplicity, we are using a two node setup, but this is easily scalable to several nodes and using Apache web server as a load balancer.

 

 CHANGE THIS

Assume the following IP addressing for our cluster nodes.

NodeIP addressingPort / Protocol
Apache LB10.60.13.1080 or 443
ZooKeeper node10.60.13.102181
API node1192.168.2.1008010
UI node1192.168.2.10080
API node2192.168.2.1018010
UI node2192.168.2.10180

Installation

Start by installing backend severs using the Server profile of the Abiquo ISO installer. This profile will install API and UI webapps, as well as the zookeeper daemon needed for API to work in a clustered configuration.

Follow instructions in Distributed Install of Abiquo Server 3.0 or Distributed Install of Abiquo Server v3.1 to get the Server profile installed.

Once you have both servers with the Server profile installed, keep in mind that you need to keep abiquo.properties file synchronized on every node in the API cluster.

API consensus

First, for the API to function as a clustered API, you need to setup zookeeper. The zookeeper package is installed using the "Server" profile of the Abiquo installer ISO. If it is not installed, you can do so typing:

# 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:

abiquo.api.zk.serverConnection = <zookeeper_ip>:2181

Replace <zookeeper_ip> to match your environment. Also, add or modify the abiquo.server.api.location property to match the load balancer URL for the API service (shown below):

abiquo.server.api.location = https://abiquoui.example.com/api

You will need to edit file /opt/abiquo/tomcat/conf/Catalina/localhost/api.xml and set the values for the MySQL kinton database:

<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="root" password="" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/kinton?autoReconnect=true&amp;useUnicode=true&amp;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 urlusername and password attributes to match your environment.

UI configuration

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 node. For example:

"config.endpoint": "https://abiquoui.example.com/api",

*** In this setup, maybe it would be nice that by default each UI users the API hosted in the same node and in case of API failure, balance petitions to other nodes. This should be configurable at LB level I guess. *** 

Tomcat configuration

First of all, we will configure a couple of Tomcats to listen to regular HTTP and AJP connections. To do that, edit the conf/server.xml file inside the tomcat directory and edit the following values:

<Connector port="8009" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
 
<Connector port="8010" protocol="AJP/1.3" redirectPort="8443" />
 
<Engine name="Catalina" defaultHost="localhost" jvmRoute="node1">

Make sure the jvmRoute parameter is different in each host as this will be used by Apache tomcat to route requests to each host.

Restart tomcat after the change to apply new configuration.

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:

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 node running apache create a new config file in /etc/httpd/conf.d/api-balancer.conf with the following contents:

# Enable the balancer manager console in the server root
<Location />
    SetHandler balancer-manager
</Location>

# Configure the cluster nodes
<Proxy balancer://cluster>
    BalancerMember ajp://192.168.2.100:8010 route=node1 ping=1
    BalancerMember ajp://192.168.2.101:8010 route=node2 ping=1
</Proxy>

# Configure the modules we want to load balance
ProxyPass /api			    balancer://cluster/api
ProxyPass /client-premium/	balancer://cluster/client-premium/ stickysession=JSESSIONID|jsessionid

Restart or reload your Apache server to apply new configuration.

 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.

Now, accessing your balancer IP at http://10.60.13.10/client-premium or /api, will balance requests between the two backend nodes.

Check the API balancing with the following curl command:

~$ curl -u admin:xabiquo http://10.60.13.10/api/login | xmllint --format -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   844  100   844    0     0  15238      0 --:--:-- --:--:-- --:--:-- 15345
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<user>
  <link rel="edit" type="application/vnd.abiquo.user+xml" href="http://10.60.13.10:80/api/admin/enterprises/1/users/1"/>
  <link rel="enterprise" type="application/vnd.abiquo.enterprise+xml" href="http://10.60.13.10:80/api/admin/enterprises/1"/>
  <link rel="role" type="application/vnd.abiquo.role+xml" href="http://10.60.13.10:80/api/admin/roles/1"/>
  <link rel="virtualmachines" type="application/vnd.abiquo.virtualmachines+xml" href="http://10.60.13.10:80/api/admin/enterprises/1/users/1/action/virtualmachines"/>
  <id>1</id>
  <nick>admin</nick>
  <password>c69a39bd64ffb77ea7ee3369dce742f3</password>
  <name>Cloud</name>
  <surname>Administrator</surname>
  <description>Main administrator</description>
  <email/>
  <locale>en_US</locale>
  <authType>ABIQUO</authType>
  <active>true</active>
</user>

Make sure the href links returned by the curl API call point to the correct location. Otherwise, check your configuration again.

 

API cluster and client-premium cluster

In this setup, there are two separate clusters. One is for balancing API requests, and the other one is to balance client-premium traffic.

Assume the following IP addressing for our cluster nodes.

NodeIP addressing
API LB10.60.13.10
API node1192.168.2.100
API node2

192.168.2.101 

Client LB10.60.13.50
Client node1192.168.2.200
Client node2192.168.2.201

Installation

Start by installing backend severs using the Server profile of the Abiquo ISO installer. This profile will install API and client-premium webapps, as well as the zookeeper daemon needed for API to work in a clustered configuration.

Follow instructions in Distributed Install of Abiquo Server v2.6 or Distributed Install of Abiquo Server v2.4 to get the Server profile installed.

Once you have all servers with Server profile installed, follow steps below:

  • In client-premium nodes, delete de API webapp from tomcat's webapp folder, and API config file:

    # rm -rf /opt/abiquo/tomcat/webapps/api
    # rm /opt/abiquo/tomcat/conf/Catalina/localhost/api.xml
  • In the API nodes, delete the client-premium webapp and client-premium's config file

    # rm -rf /opt/abiquo/tomcat/webapps/client-premium
    # rm /opt/abiquo/tomcat/conf/Catalina/localhost/client-premium.xml

Keep in mind that you need to keep abiquo.properties file in sync in every node of the cluster.

API Cluster

You should follow the procedure explained in API plus client-premium cluster with a couple of modifications:

  1. Remove the client-premium webapp on each node running API.
  2. Use the following Apache load balancer configuration file:
# Enable the balancer manager console in the server root
<Location />
    SetHandler balancer-manager
</Location>

# Configure the cluster nodes
<Proxy balancer://cluster>
    BalancerMember ajp://192.168.2.100:8010 route=node1 ping=1
    BalancerMember ajp://192.168.2.101:8010 route=node2 ping=1
</Proxy>

# Configure the modules we want to load balance
ProxyPass /api			    balancer://cluster/api

It is enough for this balancer to just proxy requests to /api context. Remember to set the required properties in Abiquo tomcat servers.

Client cluster

The client-preimium cluster configuration is quite similar to the API cluster. For convenience, client-premium nodes should share Abiquo properties file with nodes running API and you need to remove every webapp other than client-premium one. Also, delete the file /opt/abiquo/tomcat/conf/Catalina/localhost/api.xml so Tomcat does not complain about the missing API webapp.

Now, in the Apache balancer for client-premium instances, use the following configuration file:

# Enable the balancer manager console in the server root
<Location />
    SetHandler balancer-manager
</Location>

# Configure the cluster nodes
<Proxy balancer://cluster>
    BalancerMember ajp://192.168.2.200:8010 route=node1 ping=1
    BalancerMember ajp://192.168.2.201:8010 route=node2 ping=1
</Proxy>

# Configure the modules we want to load balance
ProxyPass /client-premium/	balancer://cluster/client-premium/ stickysession=JSESSIONID|jsessionid

Now you have a balanced client-premium environment that connects to a balanced API cluster.

Adding SSL

If you want to use SSL connections to the Abiquo GUI, follow the steps in Apache Frontend with the following modifications:

  • Be sure to set a common name for your certificate. This needs to match ServerName parameter in Apache's virtual host definition and abiquo.server.api.location property in Abiquo configuration file.
  • Use the following Apache virtual host configuration, replacing ServerName value with your certificate's CN:
<VirtualHost *:443>
    ServerName apibalancer
    SSLEngine on
    SSLProtocol all -SSLv2
    SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
    SSLCertificateFile /etc/pki/tls/certs/ca.crt
    SSLCertificateKeyFile /etc/pki/tls/private/ca.key


    # Enable the balancer manager console in the server root
    <Location />
        SetHandler balancer-manager
    </Location>


    # Configure the cluster nodes (secondary disabled by default)
    <Proxy balancer://cluster>
        BalancerMember ajp://192.168.2.216:8009 route=node1 ping=1
        BalancerMember ajp://192.168.2.217:8009 route=node2 ping=1
    </Proxy>


    # Configure the modules we want to load balance
    ProxyPass /api			balancer://cluster/api
    ProxyPass /client-premium/	balancer://cluster/client-premium/ stickysession=JSESSIONID|jsessionid
</VirtualHost>

  • Set abiquo.server.api.location property in Abiquo configuration file to point to the "ServerName" host name and using HTTPS protocol:
abiquo.server.api.location = https://apibalancer/api
  • You need to import Apache server's certificate and CA into Java truststore in order for the client-premium webapp to be able to connect to API. This should be done in every node running the client-premium webapp:

 

# echo -n | openssl s_client -connect <ServerName>:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /tmp/temp.cert
# /usr/java/default/bin/keytool -import -file /tmp/temp.cert -keystore /usr/java/jdk1.6.0_37/jre/lib/security/cacerts
# /usr/java/default/bin/keytool -import -trustcacerts -file /path/to/ca/ca.pem -alias CA_ALIAS -keystore /usr/java/jdk1.6.0_37/jre/lib/security/cacerts

Note that default password for a JVM truststore is changeit. Also note you may need to adjust paths for both keytool command and cacerts truststore depending on your java version.

Edit /opt/abiquo/tomcat/webapps/client-premium/config/client-config.xml.jsp and change USE_SECURE_CHANNEL_LOGIN value to 1:

...
<name>USE_SECURE_CHANNEL_LOGIN</name> <value>1</value>
...

Once everything is in place, restart abiquo-tomcat service.

  • No labels