Skip to main content
July 20, 2010
Answered

How to configure multiple instances in CF9

  • July 20, 2010
  • 1 reply
  • 2137 views

I'm having a few issues with a couple of our staging servers that are running multiple instances of CF9, and I'm not sure if they're set up correctly. I have CF9 Enterprise multiserver installed and I created 4 additional instances using the Instance Manager. I also created a specific jvm for each one to use and reregistered each service to use the custom jvm. In Apache I added the following to each vhost (changing the serverstore and port):

<IfModule mod_jrun22.c>

    JRunConfig Serverstore "C:/JRun4/lib/wsconfig/muffin/jrunserver.store"

    JRunConfig Bootstrap 127.0.0.1:51000

</IfModule>

However, when the service is stopped for one of the sites, instead of getting the JRun 500 error it will instead return a CF error or the site will still come up. But if I stop the main CF server service it will kill all the sites.

So it seems that all the instances are still tied to the main service. Is there something I'm missing here or something that wasn't configured correctly?

I used this guide when setting it all up. http://help.adobe.com/en_US/ColdFusion/9.0/Admin/WSc3ff6d0ea77859461172e0811cbf364104-7fc4.html

Thanks for any help.

    This topic has been closed for replies.
    Correct answer bendensmore

    Thanks again for the help, I think we're getting closer

    So I added all the instances to the wsconfig.properties file and they all show up when I run the wsconfig.exe.

    #JRun/ColdFusion MX Web Server Configuration File

    #Mon Mar 01 13:30:00 PST 2010

    1=Apache,C:/Apache2.2/conf,"",C:\\Apache2.2\\bin\\httpd.exe,"",false

    1.srv=cfusion,"cfusion"

    1.cfmx=true,<null>

    2=Apache,C:/Apache2.2/conf,"",C:\\Apache2.2\\bin\\httpd.exe,"",false

    2.srv=cf2,"cf2"

    2.cfmx=true,<null>

    3=Apache,C:/Apache2.2/conf,"",C:\\Apache2.2\\bin\\httpd.exe,"",false

    3.srv=cf3,"cf3"

    3.cfmx=true,<null>

    4=Apache,C:/Apache2.2/conf,"",C:\\Apache2.2\\bin\\httpd.exe,"",false

    4.srv=cf4,"cf4"

    4.cfmx=true,<null>

    5=Apache,C:/Apache2.2/conf,"",C:\\Apache2.2\\bin\\httpd.exe,"",false

    5.srv=cf5,"cf5"

    5.cfmx=true,<null>

    I also did this for each instance....since they were set to true.

    Open the jrun_root/servers/servername/SERVER-INF/jrun.xml file for each server instance and locate the ProxyService service. Ensure that the deactivated element is set to false

    But lets say I kill the service for cf2 and/or stop it in CF Admin from the Instance Manager, the site still stays up...

    Here's a sample of my Apache configs.

    httpd.conf

    # JRun Settings

    LoadModule jrun_module "C:/JRun4/lib/wsconfig/1/mod_jrun22.so"

    <IfModule mod_jrun22.c>

        JRunConfig Verbose false

        JRunConfig Apialloc false

        JRunConfig Ignoresuffixmap false

        JRunConfig Serverstore "C:/JRun4/lib/wsconfig/1/jrunserver.store"

        JRunConfig Bootstrap 127.0.0.1:51020

        #JRunConfig Errorurl url <optionally redirect to this URL on errors>

        #JRunConfig ProxyRetryInterval 600 <number of seconds to wait before trying to reconnect to unreachable clustered server>

        #JRunConfig ConnectTimeout 15 <number of seconds to wait on a socket connect to a jrun server>

        #JRunConfig RecvTimeout 300 <number of seconds to wait on a socket receive to a jrun server>

        #JRunConfig SendTimeout 15 <number of seconds to wait on a socket send to a jrun server>

        AddHandler jrun-handler .jsp .jws .cfm .cfml .cfc .cfr .cfswf

    </IfModule>

    httpd-vhosts.conf

    <VirtualHost x.x.x.x:80>

        DocumentRoot "C:/domains/cf2"

    <IfModule mod_jrun22.c>

        JRunConfig Verbose true

        JRunConfig Serverstore "C:/JRun4/lib/wsconfig/2/jrunserver.store"

        JRunConfig Bootstrap 127.0.0.1:51000

    </IfModule>

    </VirtualHost>

    <VirtualHost x.x.x.x:80>

        DocumentRoot "C:/domains/cf3"

    <IfModule mod_jrun22.c>

        JRunConfig Verbose true

        JRunConfig Serverstore "C:/JRun4/lib/wsconfig/3/jrunserver.store"

        JRunConfig Bootstrap 127.0.0.1:51002

    </IfModule>

    </VirtualHost>

    I also noticed that in each jrunserver.store for every instance, all that's in there is "proxyservers=" Should there be anything else?


    For the most part everything looks like it should be working.

    My jrunserver.store files all say the same thing as yours.

    Have you done a restart on Apache and CF just to make sure things are being picked up correctly?

    A couple of things you can try but I'm not sure if it will make a difference or not.

    In each of your virtual hosts, remove the

    <IfModule mod_jrun22.c>

        JRunConfig Verbose true

        JRunConfig Serverstore "C:/JRun4/lib/wsconfig/2/jrunserver.store"

        JRunConfig Bootstrap 127.0.0.1:51000

    </IfModule>

    And just do:

        JRunConfig Verbose true

        JRunConfig Serverstore "C:/JRun4/lib/wsconfig/2/jrunserver.store"

        JRunConfig Bootstrap 127.0.0.1:51000

    Also add in "JRunConfig Apialloc false" to each of them. This will allow the stub to grab memory from the operating system rather than Apache which is supposed to be safer.

    Let me know if any of those help at all.

    1 reply

    Inspiring
    July 20, 2010

    Have you looked in the wsconfig.properties file to make sure that the instance is not tied to localhost? I've run into this before and I think the way I solved it was to go into:

    {cf9root}/lib/wsconfig and in the wsconfig.properties file make sure each instance has this in line 2.

    srv=myinstance,"myinstance"

    Instead of:

    srv=localhost,"myinstance"

    You also may want to make sure that in the JRunConfig Bootstrap line in your httpd.config you have the correct port. Each instance should be given a new port so web1 would have 51000 and web2 would have 51001 etc...

    Hopefully that helps you some.

    Ben

    July 20, 2010

    Ah, I think you may be on to something. Here's my wsconfig:

    #JRun/ColdFusion MX Web Server Configuration File

    #Mon Mar 01 13:30:00 PST 2010

    1=Apache,C:/Apache2.2/conf,"",C:\\Apache2.2\\bin\\httpd.exe,"",false

    1.srv=localhost,"cfusion"

    1.cfmx=true,<null>

    But I also noticed in the {cf9root}/lib/wsconfig directory that there is nothing in the folders for each instance. Should there be a wsconfig.properties in each one? Or can I add all the instances to the main wsconfig.properties?

    I also double checked all the ports and they are correct.

    Thanks for the help.

    Inspiring
    July 20, 2010

    You need to run the webserver connector or you can manually wire up each instance. There will only be one properties file. There won't be one in each folder.

    To use the webserver connector tool you can run wsconfig.jar which sits in the {cf9root}/lib folder.

    This is the command I use:

    java -Dtrace.ci=1 -jar /opt/jrun4/lib/wsconfig.jar -server "your instance name" -ws apache -dir /etc/httpd/conf -bin /usr/sbin/httpd -script /etc/rc.d/init.d/httpd -ws32 -coldfusion -v         > /opt/jrun4/ConnectorInstall0.txt 2>&1

    Just make sure you change "your instance name" to match whatever you named your instance. You also want to make sure that the paths to your apache setup are correct.

    You can also do things manually. All you would need to do is in the {cf9root}/lib/wsconfig folder copy the main instance directory and change the name to match your instance.

    So if there is a directory in there named "1", just copy that directory and name it "2" or whatever you would like to name it.

    Then in the wsconfig.properties file you would need to add in:

    2=Apache,/etc/httpd/conf,"",/usr/sbin/httpd,/etc/rc.d/init.d/httpd,true

    2.srv=instancename,"instancename"

    2.cfmx=true,<null>

    So now your properties file would look like:

    1=Apache,/etc/httpd/conf,"",/usr/sbin/httpd,/etc/rc.d/init.d/httpd,true

    1.srv=instance1,"instance1"

    1.cfmx=true,<null>

    2=Apache,/etc/httpd/conf,"",/usr/sbin/httpd,/etc/rc.d/init.d/httpd,true

    2.srv=instance2,"instance2"

    2.cfmx=true,<null>

    I'm using numbers here but if you wanted to use other names just make sure where I have "1" and "2" you match the folder names you created in the lib/wsconfig directory.

    Let me know if that helps or not.