modules/common/cassandra-common/src/main/java/org/rhq/cassandra/DeploymentOptions.java | 13 ++++++ modules/common/cassandra-common/src/main/resources/cassandra-1.2.0-beta1/conf/log4j-server.properties | 4 - modules/common/cassandra-common/src/main/resources/cassandra.properties | 8 +++ modules/common/cassandra-common/src/main/resources/deploy.xml | 6 ++ modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml | 21 ++++++++++ 5 files changed, 50 insertions(+), 2 deletions(-)
New commits: commit 08f50d7711680f38bc2898efafae2feb10b8b174 Author: John Sanda jsanda@redhat.com Date: Wed Oct 31 14:21:27 2012 -0400
adding num-tokens and ring.delay properties to bundle recipe
Also updating container build to include num-tokens and ring.delay in rhq-server.properties. This commit also updates the log4j-server.properties file in the bundle so that logging levels are set according to the rhq.cassandra.logging.level property.
diff --git a/modules/common/cassandra-common/src/main/java/org/rhq/cassandra/DeploymentOptions.java b/modules/common/cassandra-common/src/main/java/org/rhq/cassandra/DeploymentOptions.java index 4bbc858..60cb9a3 100644 --- a/modules/common/cassandra-common/src/main/java/org/rhq/cassandra/DeploymentOptions.java +++ b/modules/common/cassandra-common/src/main/java/org/rhq/cassandra/DeploymentOptions.java @@ -48,6 +48,7 @@ public class DeploymentOptions { private Boolean embedded; private String loggingLevel; private Long ringDelay; + private Integer numTokens;
public DeploymentOptions() { init(loadProperties()); @@ -94,6 +95,8 @@ public class DeploymentOptions { if (ringDelay != null && !ringDelay.isEmpty()) { setRingDelay(Long.valueOf(ringDelay)); } + + setNumTokens(Integer.valueOf(loadProperty("rhq.cassandra.node.num-tokens", properties))); }
private String loadProperty(String key, Properties properties) { @@ -194,4 +197,14 @@ public class DeploymentOptions { } }
+ public Integer getNumTokens() { + return numTokens; + } + + public void setNumTokens(int numTokens) { + if (this.numTokens == null) { + this.numTokens = numTokens; + } + } + } diff --git a/modules/common/cassandra-common/src/main/resources/cassandra-1.2.0-beta1/conf/log4j-server.properties b/modules/common/cassandra-common/src/main/resources/cassandra-1.2.0-beta1/conf/log4j-server.properties index d3081e6..08ecb45 100644 --- a/modules/common/cassandra-common/src/main/resources/cassandra-1.2.0-beta1/conf/log4j-server.properties +++ b/modules/common/cassandra-common/src/main/resources/cassandra-1.2.0-beta1/conf/log4j-server.properties @@ -24,7 +24,7 @@ log4j.rootLogger=@@logging.level@@,stdout,R,tracing log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%5p %d{HH:mm:ss,SSS} %m%n -log4j.appender.stdout.Threshold=INFO +log4j.appender.stdout.Threshold=@@logging.level@@
# rolling log file log4j.appender.R=org.apache.log4j.RollingFileAppender @@ -34,7 +34,7 @@ log4j.appender.R.layout=org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern=%5p [%t] %d{ISO8601} %F (line %L) %m%n # Edit the next line to point to your logs directory log4j.appender.R.File=@@rhq.deploy.dir@@/@@log.dir@@/system.log -log4j.appender.R.Threshold=INFO +log4j.appender.R.Threshold=@@logging.level@@
log4j.appender.tracing=org.apache.cassandra.tracing.TracingAppender log4j.appender.tracing.layout=org.apache.log4j.PatternLayout diff --git a/modules/common/cassandra-common/src/main/resources/cassandra.properties b/modules/common/cassandra-common/src/main/resources/cassandra.properties index 1d1247d..389d765 100644 --- a/modules/common/cassandra-common/src/main/resources/cassandra.properties +++ b/modules/common/cassandra-common/src/main/resources/cassandra.properties @@ -11,6 +11,14 @@ rhq.cassandra.bundle.version=1.0 # the value from the cassandra.ring_delay_ms system property # rhq.cassandra.ring.delay
+# Defines the number of tokens randomly assigned to a node on the ring. The more tokens, +# relative to other nodes, the larger the proportion of data that this node will store. You +# probably want all nodes to have the same number of tokens assuming they have equal +# hardware capability. Tokens are randomly generated with the expectation of an even +# distribution. With that said, there can be some variation. Either increasing this value +# or increasing the number of nodes in the cluster will help even out the distribution. +rhq.cassandra.node.num-tokens=256 + # The remaining properties pertain to cluster configuration and are only used in # development and testing environments when an embedded cluster is used. These properties # are also loaded into the container build (when the dev profile is active) in the diff --git a/modules/common/cassandra-common/src/main/resources/deploy.xml b/modules/common/cassandra-common/src/main/resources/deploy.xml index e92ca87..e07cc0e 100644 --- a/modules/common/cassandra-common/src/main/resources/deploy.xml +++ b/modules/common/cassandra-common/src/main/resources/deploy.xml @@ -59,6 +59,12 @@ defaultValue="127.0.0.1" type="string"/>
+ <rhq:input-property name="rhq.cassandra.node.num-tokens" + description="Defines the number of tokens randomly assigned to a node on the ring. The more tokens, relative to other nodes, the larger the proportion of data that this node will store. You probably want all nodes to have the same number of tokens assuming they have equal hardware capability." + required="false" + defaultValue="256" + type="string"/> + <rhq:input-property name="initial.token" description="Each Cassandra node is assigned a unique token that determines what keys it is the first replica for. If you sort all nodes' token, the range of keys each is responsible for is (PreviousToken, MyToken], that is, from the previous token (exclusive) to the node's token (inclusive). The machine with the lowest Token gets both all keys less than that token, and all keys greater than the largest token; this is called a wrapping range." required="false" diff --git a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml index b23c0a4..6f3b1c0 100644 --- a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml +++ b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml @@ -381,6 +381,12 @@
<target name="prepare-bin-dir"> <echo>*** Preparing bin dir ***</echo> + + <loadproperties> + <zipentry zipfile="${settings.localRepository}/org/rhq/rhq-cassandra-common/${project.version}/rhq-cassandra-common-${project.version}.jar" + name="cassandra.properties"/> + </loadproperties> + <echo>Connection URL is ${rhq.server.database.connection-url}</echo>
<property name="rhq.bin.dir" location="${project.build.outputDirectory}/bin" /> @@ -564,6 +570,19 @@ rhq.autoinstall.public-endpoint-address= # topology. rhq.cassandra.cluster.seeds=
+# When a node initializes it contacts a seed and then sleeps for RING_DELAY +# (milliseconds) to learn about other nodes in the cluster. This defaults to 30 +# seconds. +# rhq.cassandra.ring.delay + +# Defines the number of tokens randomly assigned to a node on the ring. The more +# tokens, relative to other nodes, the larger the proportion of data that this +# node will store. You probably want all nodes to have the same number of tokens +# assuming they have equal hardware capability. Tokens are randomly generated +# with the expectation of an even distribution. With that said, there can be +# some variation. Either increasing this value or increasing the number of +# nodes in the cluster will help even out the distribution. +rhq.cassandra.node.num-tokens=${rhq.cassandra.node.num-tokens} </echo>
</target> @@ -591,10 +610,12 @@ rhq.cassandra.cluster.seeds= <copy todir="${project.build.outputDirectory}" verbose="true"> <fileset dir="src/main/dev-resources" /> </copy> + <loadproperties> <zipentry zipfile="${settings.localRepository}/org/rhq/rhq-cassandra-common/${project.version}/rhq-cassandra-common-${project.version}.jar" name="cassandra.properties"/> </loadproperties> + <echo file="${project.build.outputDirectory}/bin/rhq-server.properties" append="true"> # The following properties that begin with a prefix of rhq.cassandra are ONLY for # development/testing environments where an embedded cluster is used. These properties are
rhq-commits@lists.fedorahosted.org