One of the more interesting of ColdFusion MX 7's new functions and features is the capability to create multiple instances of the ColdFusion server directly from the ColdFusion Administrator. This feature is only available in the Enterprise version of CFMX 7 installed in the multiserver configuration. There are two major reasons why you might want to deploy multiple instances of ColdFusion on a server: Application isolation. Each instance of ColdFusion uses its own JVM and its own resources, and you can deploy separate applications each on its own instance of ColdFusion. If one application has problems that hit the server, other applications on their own instance will remain unaffected. Load balancing and failover. Multiple instances of ColdFusion can be set up and added to a cluster to provide failover and load balancing; if one instance fails due to application issues, the other instance will pick up the load. It's important to note that this only provides application-level failover. True high availability and failover will require hardware redundancy. In ColdFusion MX 6, establishing multiple instances of the server required that you use J2EE deployment on top of a J2EE container, with multiple instances of the J2EE server; this could become complex and required multiple steps. Now, setting up and deploying multiple instances of ColdFusion could not be simpler. To set up multiple instances of ColdFusion MX 7, first make sure you are running ColdFusion MX 7 in the multiserver configuration, which is the only option that supports the creation of instances and clusters from the ColdFusion Administrator. NOTE You can still manually create multiple instances of ColdFusion MX 7 using your specific J2EE server's create-and-deploy mechanism. You'll learn more about this in Chapter 4, "Scaling with J2EE." Lets walk through the steps of creating a new instance. 1. | Log in to the ColdFusion Administrator. At the bottom of the navigation panel on the left, click to expand the Enterprise Manager menu. Click on Instance Manager to display the window shown in Figure 3.4. Figure 3.4. The ColdFusion MX 7 Administrator Instance Manager.
| 2. | Select Add New Instance. You'll see the Add New ColdFusion Server window as shown in Figure 3.5. Figure 3.5. Adding a new instance of ColdFusion via the Instance Manager.
| 3. | Fill in the form: Add the name for the server instance in the Server Name field. If you can want to use the default directory for the server instance ColdFusion should automatically fill it in for you (jrun_root/servers/servername) otherwise you will need to add the path to where you want the server instance. If you plan to deploy a ColdFusion application and its databases and various settings at that same time, you can use a Java Enterprise Archive file EAR or Java Web Application Archive WAR. You can add the path to your EAR or WAR and have ColdFusion deploy the application when it creates the instance. This is optional, and for this example we will leave it blank. There are two more optional settings, available only on Windows versions of ColdFusion MX 7. If desired, you can specify that you want the new instance to be created as a Windows server, and you can enable an auto restart for the instance. | 4. | After you have set all your options, click the Submit button. ColdFusion MX 7 starts to create a new instance of the server with all the options you have defined. This can take several minutes, during which you'll see a window like that in Figure 3.6. Figure 3.6. Creation and deployment of a new ColdFusion MX 7 instance.
| 5. | After the new instance has been created, select Instance Manager again. You should see your new instance of ColdFusion MX 7, as shown in Figure 3.7. Figure 3.7. Instance Manager showing a view of multiple instances running.
You can now also start and stop each instance of the ColdFusion MX 7 server from the JMC, the JRun Launcher, or by using the start and stop batch files from the command line: jrun_root/bin jrun -start|-stop servername | To obtain application isolation, you'll also want to create a specific separate website and associate a specific instance with it. This way, you'll have complete separation between your applications and can even configure and set up your JVM for each instance (more on this in Chapter 4). For more information on setting up and configuring your Web server to create a separate Web site, refer to your Web server's documentation. You'll also need to use the Web Server Configuration Tool to then connect an instance of ColdFusion MX 7 to the new Web site. The various Web servers have their own procedures to do this, so you'll need to refer to the topic "Web Server Configuration for Application Isolation" in your ColdFusion MX 7 documentation. Later, in the section "Scaling with ColdFusion MX 7 Load Balancing," we'll show you how to use multiple local ormultiple remote instances of ColdFusion MX 7 to create a cluster for failover and load balancing. |