ColdFusion MX 6.1 Step-by-Step Creating and Configuring Multiple Instances
Print
There are several advantages to running ColdFusion in multiple instances instead of a single instance on a single machine: Isolate applications to ensure high availability,Isolate applications for security, or Fine-tune each website with its ColdFusion server instance. For details on why you would use multiple instances see my article on the advantanges. Also see Tim Buntel's article on Mutiple Server Advantages.
Now that you know why you should do it the question is how do I do it? I outline a step-by-step process in this article from installing ColdFusionMX 6.1 to creating new instances of CF and configuring the external webserver.
- Install ColdFusion MX 6.1 with the J2EE Configuration (ColdFusion MX with JRun 4)
 |
| Figure 1: Installation Wizard Choosing your Install method |
- During the install choose the Built in webserver as shown in figure 2
 |
| Figure 2: Installation Wizard choosing the webserver (choose Built-in) |
- Follow the prompts for the installer and complete the install for CFMX 6.1
- When prompted launch the Configuration Wizard after the installer finishes, enter you CF Admin password and follow the prompts in the wizard to complete the install.
- On windows five different services will be installed as shown below
- ColdFusion MX ODBC Agent
- ColdFusion MX ODBC Server
- Macromedia JRun Admin Server - JRun Management Console (JMC) htttp://127.0.0.1:8000/
- Macromedia JRun CFusion Server - ColdFusion Server
- Macromedia JRun Default Server - Default JRun Server
Only services a, b, d are needed for CFMX to run correctly, the JMC and Default server can be shut down unless you need to use the JMC to administer JRun
- On unix you can use the following command to start and stop the JRun servers
/jrun4/bin/jrun -nohup -start <servername> /jrun4/binjrun -stop <servername> /jrun4/bin/jrun -nohup -start cfusion
- Stop the cfusion server from the command prompt or in the Windows services panel
- Next we will copy the cfusion-ear from the cfusion server in (C:\JRun4\servers\cfusion\cfusion-ear\) to a location of your choosing. In this example I chose C:\working\cfusion-template. We will use these files when we create new instances of CFMX. As we create new instances we will copy the entire folder to the server root of the new instance.
- Start the cfusion server through the services control panel or from the command line
- In this step we will connect the cfusion server instance to our external webserver. In this example I will use IIS but the process applies to any webserver. For each new instance we will configure a new site in IIS.
- We will use the GUI for this example if you would like to use command line see livedocs.
- Open the wsconfig gui by typing the following command
c:\jrun4\bin\wsconfig
- Click Add once wsconfig opens
- For the JRun Host choose localhost unless the webserver and JRun server are on seperate machines
- For the JRun Server choose cfusion
- Choose your Webserver (for this example I use IIS)
- Choose the Default Web Site or your website name, do not use All for multiple instances with IIS. If you are using Apache or IIS type in the web servers configuration directory.
- Check the box for configuring the web server for ColdFusion MX application
- Click OK and the webserver will be configured. In some cases you may manually need to configure the webserver
 |
| Figure 3: Web Server Confuration Tool, configuring your first ColdFusion Instance |
- After configuring the webserver you will need to copy the /CFIDE directory from C:\JRun4\servers\cfusion\cfusion-ear\cfusion-war to the webroot of your web server. In this example I copied the CFIDE directory to C:\Inetpub\wwwroot
- To verify the webserver configuration test the CF Administrator with the following URL http://host:port/CFIDE/administrator/index.cfm
- Our next step is to create a new JRun server or instance of JRun then deploy ColdFusoin MX to it. We will then configure that instance to another IIS site. To create the new JRun server you will need to have the JRun admin server running. You can either start the process in the control panel or from the command line with the following command
C:\jrun4\bin\jrun -start admin
- Open a web browser and type in the following URL to access the JRun Management Console (JMC)
http://host:8000/
- After logging into the JMC with the username and password that you specified in the CFMX install click on the Create New Server link at the top of the JMC
- Type in a name for the JRun server, in this example I used cfusion2 then click the Create Server button <img>
 |
| Figure 4: Creating a new server in the JRun Managment Console (JMC) |
- Next you will be presented with the option to choose the ports for the server. Leave the JNDI port in the range of 2900-3000, you can choose any port for the Web Server Port Number or Proxy Port. In this example I chose the defaults.
 |
| Figure 5 : Choosing the ports for the new JRun server in the JMC |
- Now that we have created a new JRun server we can add it as a service on Windows, if you are on unix you will start it from the command line. To add the server as a service use the jrunsvc command. For information on the jrunsvc command type c:\jrun4\bin\jrunsvc ? To add the server as a service type the following command.
C:\JRun4\bin>jrunsvc -install cfusion2 "Macromedia JRun CFusion2 Server" "Macromedia JRun CFusion2 Server" You will get a message that looks like the following if it succeeds. Service "Macromedia JRun CFusion2 Server" installed with display name "Macromedia JRun CFusion2 Server"
- Next we need to copy the cfusion-ear files from the temporary location we copied them to earlier to the server root of the new server you just created.. In this example I copy the files from C:\working\cfusion-template\cfusion-ear to C:\JRun4\servers\cfusion2\cfusion-ear
- Delete the default-ear from the newly created JRun server. Since both cfusion-ear and default-ear have a context root of / they will conflict so it needs to be deleted. I deleted mine from C:\JRun4\serves\cfusion2\default-ear
- Start the cfusion2 (or your new server name) server through the services control panel or from the command line
- In the next step we will configure the new JRun server to its own site in IIS. If you only have the default site in IIS setup then you will need to add a second site. If you are running Apache or Iplanet you can either create a new instance or with Apache you can use virtual hosts. This process is outilined here......
- Now we will connect the cfusion2 server instance to our the second site in IIS.
- We will use the GUI for this example if you would like to use command line see livedocs.
- Open the wsconfig gui by typing the following command
c:\jrun4\bin\wsconfig
- Click Add once wsconfig opens
- For the JRun Host choose localhost unless the webserver and JRun server are on seperate machines
- For the JRun Server choose cfusion2 (or your new server name)
- Choose your Webserver (for this example I use IIS)
- Choose the new web site name. In this example I used IIS Site 2 or your website name, do not use All for multiple instances with IIS. If you are using Apache or IIS type in the web servers configuration directory.
- Check the box for configuring the web server for ColdFusion MX application
- Click OK and the webserver will be configured. In some cases you may manually need to configure the webserver
 |
| Figure 6: Web Server Confuration Tool, configuring the second ColdFusion Instance |
- After configuring the webserver you will need to copy the /CFIDE directory from C:\JRun4\servers\cfusion2\cfusion-ear\cfusion-war to the webroot of your web server. In this example I copied the CFIDE directory to C:\Site2\wwwroot
- To verify the webserver configuration test the CF Administrator with the following URL http://site2IP::port/CFIDE/administrator/index.cfm
- You have now successfully created two instances of CF and tied them to external webservers. For each additional instance follow steps 13-25 each time you want to create a new server.
In some cases you may want to have individual settings for each instance. For example lets say you wanted to configure the first instance with a maximum JVM heap of 512MB and you wanted to have 256MB for the second instance. Or a different classpath for each instance. By default this is not possible, you will need to create different jvm.config files for each instance and follow the instructions in this technote to configure different JVM configurations.
|