Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a cpanel VPS in one datacenter (linode), where i have a bunch of client's accounts, i want to balance loads using 2 additional VPS's in the same datacenter connected with private IP's.

I was thinking of setting this for balancing loads:

VPS 1: Cpanel, mail server, Apache (Proxy). Get requests, public IP.
VPS 2 : Mysql.
VPS 3: Tomcat.

Right now my priority is setting the VPS 3.

Cpanel architecture loads Java modules through apache loading including in the virtual host definition a mod_jk, i was thinking of changing the servlet to the tomcat VPS, and changing its location to something like:

DocumentRoot IP_OF_VPS:/home/didactac/public_html

How ever i'm not sure if this will wok !

Here is a virtual host in apache:

<VirtualHost 173.230.130.64:80>
    ServerName danielakosanstore.com
    ServerAlias www.danielakosanstore.com
    DocumentRoot /home/danielak/public_html
    ServerAdmin webmaster@danielakosanstore.com
    UseCanonicalName Off
    CustomLog /usr/local/apache/domlogs/danielakosanstore.com combined
    CustomLog /usr/local/apache/domlogs/danielakosanstore.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
    ## User danielak # Needed for Cpanel::ApacheConf
    <IfModule mod_suphp.c>
        suPHP_UserGroup danielak danielak
    </IfModule>
    <IfModule !mod_disable_suexec.c>
        SuexecUserGroup danielak danielak
    </IfModule>
    ScriptAlias /cgi-bin/ /home/danielak/public_html/cgi-bin/

    Include "/usr/local/apache/conf/userdata/*.conf"
    Include "/usr/local/apache/conf/userdata/*.owner-root"
    Include "/usr/local/apache/conf/userdata/std/*.conf"
    Include "/usr/local/apache/conf/userdata/std/*.owner-root"
    Include "/usr/local/apache/conf/userdata/std/2/*.conf"
    Include "/usr/local/apache/conf/userdata/std/2/*.owner-root"
    Include "/usr/local/apache/conf/userdata/std/2/danielak/*.conf"
    Include "/usr/local/apache/conf/userdata/std/2/danielak/danielakosanstore.com/*.conf"

The configuration file included on those last lines, which loads servlets:

</VirtualHost>

<IfModule mod_jk.c>
 JkMount /*.jsp ajp13
 JkMount /* ajp13
 JkUnmount /*.php* ajp13
 JkUnmount /*.cgi ajp13
 JkUnmount /*.shtm* ajp13
 JkUnmount /*.pl ajp13
 JkMount /servlet/* ajp13
 JkMount /servlets/* ajp13
</IfModule>

What do you guys think ? i need to be able to add a bunch of clients-accounts-servlets, or delete them automatically

Thank you very much!

UPDATE, Improving my question:

This section is intended on given additional detail about the question base on the feedback and questions of quanta in the comments:

quanta: What do you want to load balancing when you have only one Tomcat instance on VPS3? What does "add a bunch of clients-accounts-servlets" mean?
Answer: Probably i did not use the term load balancing the right way, you see, i install one java application per account, an account is a website that runs based on this java app, for each website there is a linux user, and a virtual host in http.cnf (apache) and one virtual host in the server.xml. Apache acts as a proxy, for tomcat on the current VPS. Right now there is only one VPS. What i need is this same setup but running tomcat in a different machine. This way if tomcat's machine's memory does not hold up, i can set a new tomcat machine, put the new client there. To that i called load balancing. But i get the feeling im not using the term the right way.

share|improve this question
    
Could you please explain your situation a litle more? What do you want to load balancing when you have only one Tomcat instance on VPS3? What does "add a bunch of clients-accounts-servlets" mean? –  quanta Sep 3 '11 at 0:45
    
Probably i did not use the term load balancing the right way, i install one java application per account, an account is a website that runs based on this java app, for each website there is a linux user, and a virtual host in http.cnf (apache) and one virtual host in the server.xml. Apache acts as a proxy, for tomcat on the current VPS. Right now there is only one VPS. What i need is this same setup but running tomcat in a different machine. This way if tomcat's machine's memory does not hold up, i can set a new tomcat machine, put the new client there. To that i called load balancing. –  Ernest Sep 3 '11 at 21:42

1 Answer 1

up vote 1 down vote accepted

I install one java application per account, an account is a website that runs based on this java app, for each website there is a linux user, and a virtual host in http.cnf (apache) and one virtual host in the server.xml. Apache acts as a proxy, for tomcat on the current VPS. Right now there is only one VPS. What i need is this same setup but running tomcat in a different machine.

Sure, you can do it by changing the worker.<worker_name>.host to the IP address of backend Tomcat instance in workers.properties, something like this:

worker.worker1.host=backend.Tomcat's.IP.address

Can i link a specific client (website, virtual host, account... the same in this case) to a specific worker

Yes, you can. Put the JkMount into VirtualHost section:

<VirtualHost *:80>
    ServerName  ...
    ServerAdmin ...

    JkMount /*.jsp ajp13
    JkMount /* ajp13
    ...
</VirtualHost>
share|improve this answer
    
Thanks man! this is great! i read the workes doc in tomcat.apache.org wiki and it feels so right!. How ever i don´t understand something. Can i link a specific client (website, virtual host, account... the same in this case) to a specific worker, or im a miss understanding something ? thank you its been a great help already –  Ernest Sep 6 '11 at 2:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.