|
Summary: Common uses for configuration overrides and SDD overrides; using custom overrides; overrides supplied with the Service Grid.
OverviewOverrides allow you to do two things:
Overrides simplify the configuration process. You can use a common deployment configuration for all your services, and use configuration overrides to override only the differences in configuration between the common service and the specific services. For example, the configuration override file provided in the Prime Computation Example, override.xml, is used to load the predefined job definition of the example. It does this by overriding the job submission resources in the Compute Grid deployment descriptor with the Prime task JAR. The Job Submission service then scans all the classes in the JAR that implement the task interface, and adds them to the list upon deployment.
Override Syntax<overrides> <!-- Configuration override --> <Component Name="exact component name"> <Parameter Name="first configuration argument to override" Value="new value"> </Parameter> <Parameter Name="second configuration argument to override"> <![CDATA[ new data... ]]> </Parameter> ... </Component> <!-- Configuration override --> <Component Name="exact component name"> ... </Component> <!-- Service Deployment Descriptor override --> <ServiceBean Name="exact name of service in common deployment descriptor"> <descriptor element to override> <subelement to override> New values... </subelement to override> </descriptor element to override> ... <!-- Service Deployment Descriptor override --> <ServiceBean Name="exact name of service in common deployment descriptor"> ... </ServiceBean> </overrides> Override ExampleThere are three overrides in the example below:
<override> <component Name="com.gigaspaces.start"> <parameter Name="httpPort" Value="9010"/> <parameter Name="systemProperties"> <![CDATA[ new String[] { "com.gs.protocol", "RMI" } ]]> </parameter> </component> <component Name="com.gigaspaces.grid"> <parameter Name="groups"> <![CDATA[ new String[] { "use-custom-group" } ]]> </parameter> </component> </override> Overrides Supplied with Service GridThe following override files are supplied with the Service Grid, in the <Service Grid Root>/config/overrides directory:
Applying Overrides in DeploymentTo deploy an application with an override using the Service Grid CLI:
To deploy an application with an override using the Service Grid Admin UI:
Common Configuration OverridesOverriding System Properties | Overriding Lookup Groups for Deployed Services | Making Classes in a JAR Accessible Over the Network | Starting GSM, GSC and Service Grid Admin UI using specific group | Overriding Startup Port for GSC & GSM
Overriding System PropertiesYou can use an override to inject a custom value into a system property. <overrides> <component Name="com.gigaspaces.start"> <parameter Name="systemProperties"> <![CDATA[ new String[] { "com.gs.jini_lus.groups", "${user.name}" } ]]> </parameter> </component> </overrides>
To add more than one system property, use the following syntax: <parameter Name="systemProperties"> <![CDATA[ new String[] { "property-name-1", "value-1", "property-name-2", "value-2", "property-name-3", "value-3" } ]]> </parameter> Overriding Lookup Groups for Deployed ServicesYou can use an override to change the default lookup group assigned to a newly deployed application. <overrides> <component Name="com.gigaspaces.admin"> <parameter Name="groups"> <![CDATA[ new String[] { "${user.name}" } ]]> </parameter> </component> </overrides>
Making Classes in a JAR Accessible Over the NetworkThe following configuration override directs the Service Grid to add an additional directory to the HTTP server, allowing the classes in a certain JAR, prime-job.jar in the example below, to be accessible over the network.
<overrides> <Component Name="com.gigaspaces.start"> <Parameter Name="addHttpRoots"> <![CDATA[ "${com.gigaspaces.grid.home}examples${/}prime${/}lib" ]]> </Parameter> </Component> </overrides> Starting GSM, GSC and Service Grid Admin UI using specific groupYou might want to have different deployment environments as part of your organization network, for example, development, QA, staging, and production environments. Each should have isolated GSMs and GSCs. Use the group attribute to segregate these. To start the GSM, GSC, and Service Grid Admin UI using a specific group:
Overriding Startup Port for GSC & GSMThe following override allows you to set a custom port for the GSC and GSM, so that this port is used each time you start the Service Grid.
<overrides> <Component Name="com.gigaspaces.start"> <Parameter Name="httpPort" Value="9010" /> </Component> </overrides> Common Deployment Descriptor OverridesOverriding Scaling Policy | Overriding Service Name & Scaling Policy | Using Overrides to Append JARs to Existing Services
Overriding Scaling PolicyThe following example overrides the default setting for the scaling policy, and sets it to a maximum of 4 instances, instead of the default – 3. <overrides> <ServiceBean Name="Job Submission" > <MaxPerMachine>4</MaxPerMachine> <ServiceLevelAgreements> <SLA ID="CPU"> <Configuration> <Component Name="org.jini.rio.qos.ScalingPolicyHandler"> <Parameter Name="MaxServices" Value="3" /> </Component> </Configuration> </SLA> </ServiceLevelAgreements> </ServiceBean> </overrides> Overriding Service Name & Scaling Policy<ServiceBean Name="GigaSpace" NewName="NewService"> <ServiceLevelAgreements> <SLA ID="CPU"> <Configuration> <Component Name="org.jini.rio.qos.ScalingPolicyHandler"> <Parameter Name="MaxServices" Value="50"/> </Component> </Configuration> </SLA> </ServiceLevelAgreements> </ServiceBean> Using Overrides to Append JARs to Existing ServicesThis example is part of the prime number computation example, which comes with the Compute Grid. The first configuration element augments the Job Submission services classpath and codebase to add the classes that are part of the Prime demo. <overrides> <!-- Augment the Job Submission services classpath and codebase with prime-job.jar --> <ServiceBean Name="Job Submission"> <Interfaces> <Interface>com.gigaspaces.grid.master.JobSubmission</Interface> <Resources> <JAR>prime-job.jar</JAR> </Resources> </Interfaces> <ImplementationClass>com.gigaspaces.grid.master.JobSubmissionImpl <Resources> <JAR>prime-job.jar</JAR> </Resources> </ImplementationClass> </ServiceBean> <!-- Make prime-job.jar accessible to the HTTP server, and have the HTTP server start using port 9010 --> <Component Name="com.gigaspaces.start"> <Parameter Name="addHttpRoots"> <![CDATA[ "${com.gigaspaces.grid.home}examples${/}prime${/}lib" ]]> </Parameter> <Parameter Name="httpPort" Value="9010" /> </Component> </overrides> |
Wiki Content Tree
Your Feedback Needed!
We need your help to improve this wiki site. If you have any suggestions or corrections, write to us at techw@gigaspaces.com. Please provide a link to the wiki page you are referring to.

Add Comment