Cluster configuration service manages these three things in the cluster:

  • contents of cluster.xml for each cluster group
  • a list of runtime properties for each cluster group
  • a list of deployed jars for each cluster group

When a server starts up and claims it's using cluster configuration, it will get these above 3 things from the connected locator and use them to configure its own cache and runtime environment (on top of its own properties) based on the cluster group it belongs to. So if you would like your attributes to be managed by cluster configuration, first decide which one of those three types of attributes it is. Making it part of the cluster.xml or part of the runtime geode configuration are usually the first thing you have to decide. 


Add Element to Cluster.xml

Our cache.xsd allows you to add your own custom elements in two places: one is directly under <cache> element, another is to add it under <region>. Please consider carefully if this is the right place for you to add your element.

These are the essential steps you need to follow to do this:

  1. define your element xml schema. See lucene.xsd for example.
  2. use jaxb tool in your IDE to auto generate java pojo objects based on your xml schema. This step can be automated using build tool
  3. You need annotate the root object created by step 2 with @XSDRootElement and define the namespace and schemaLocation. See Index.java for example. This allows the Geode to correctly register your type into cluster configuration service.
  4. Then you are free to use this object you created in step 3 when interacting with Geode's Cluster Persistence Service. CPS will use that object to correctly serialize/deserialize into/from xml and inserted into cluster.xml
  5. Note this only takes care of saving your element into cluster.xml, the part that actually takes what's in the cluster.xml and realize it in cache object is done using a different process involving CacheCreation, You will need to find out what to do in that end.


Add Element to Runtime Properties

This needs to be Geode property that can be altered after the cache is created. Gfsh command "alter runtime" is managing these attributes. So if you add a runtime property, you will need to update that command to manage it.


Add Code in Deployed Jars

This is controlled by the gfsh "deploy" command, every jars deployed by the "deploy" command will be managed by cluster configuration service.

  • No labels