modules/common/cassandra-ccm/cassandra-ccm-core/src/main/bundle/cassandra/conf/rhq.cassandra.yaml | 26 - modules/common/cassandra-ccm/cassandra-ccm-core/src/main/bundle/cassandra/conf/rhq.log4j-server.properties | 39 - modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/CassandraClusterManager.java | 4 modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/DeploymentOptions.java | 149 +++--- modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/DeploymentOptionsFactory.java | 2 modules/common/cassandra-ccm/cassandra-ccm-core/src/main/resources/cassandra.properties | 54 +- modules/common/cassandra-ccm/cassandra-ccm-core/src/test/java/org/rhq/cassandra/DeployerITest.java | 31 - modules/common/cassandra-ccm/cassandra-ccm-core/src/test/resources/expected.cassandra.yaml | 2 modules/common/cassandra-ccm/cassandra-ccm-testng/src/main/java/org/rhq/cassandra/CCMTestNGListener.java | 11 modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java | 220 +++++----- modules/common/cassandra-installer/src/test/java/org/rhq/storage/installer/StorageInstallerTest.java | 77 ++- modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml | 92 ++-- modules/enterprise/server/appserver/src/main/scripts/storage_setup.groovy | 18 modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Upgrade.java | 6 modules/plugins/rhq-storage/src/test/java/org/rhq/plugins/storage/StorageNodeComponentITest.java | 8 15 files changed, 386 insertions(+), 353 deletions(-)
New commits: commit 8a5c8c38a145d0521d019360e3f2526f7604b1fa Author: Jay Shaughnessy jshaughn@redhat.com Date: Thu Sep 26 10:11:23 2013 -0400
Normalize storage props to be prefixed with "rhq.storage." and use the props consistently, removing different names for the same logical value.
Also: - remove the sslStoragePort setting, it was not actually supported - improve some comments in the generated rhq-storage.properties file.
diff --git a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/bundle/cassandra/conf/rhq.cassandra.yaml b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/bundle/cassandra/conf/rhq.cassandra.yaml index 94ff227..97f6926 100644 --- a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/bundle/cassandra/conf/rhq.cassandra.yaml +++ b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/bundle/cassandra/conf/rhq.cassandra.yaml @@ -21,7 +21,7 @@ cluster_name: ${cluster.name} # # If you already have a cluster with 1 token per node, and wish to migrate to # multiple tokens per node, see http://wiki.apache.org/cassandra/Operations -num_tokens: ${rhq.cassandra.num_tokens} +num_tokens: ${rhq.storage.num_tokens}
# If you haven't specified num_tokens, or have set it to the default of 1 then # you should always specify InitialToken when setting up a production @@ -66,7 +66,7 @@ max_hints_delivery_threads: 2 # - PasswordAuthenticator relies on username/password pairs to authenticate # users. It keeps usernames and hashed passwords in system_auth.credentials table. # Please increase system_auth keyspace replication factor if you use this authenticator. -authenticator: ${rhq.cassandra.authenticator} +authenticator: ${rhq.storage.authenticator}
# Authorization backend, implementing IAuthorizer; used to limit access/provide permissions # Out of the box, Cassandra provides org.apache.cassandra.auth.{AllowAllAuthorizer, @@ -75,7 +75,7 @@ authenticator: ${rhq.cassandra.authenticator} # - AllowAllAuthorizer allows any action to any user - set it to disable authorization. # - CassandraAuthorizer stores permissions in system_auth.permissions table. Please # increase system_auth keyspace replication factor if you use this authorizer. -authorizer: ${rhq.cassandra.authorizer} +authorizer: ${rhq.storage.authorizer}
# Validity period for permissions cache (fetching permissions can be an # expensive operation depending on the authorizer, CassandraAuthorizer is @@ -110,10 +110,10 @@ partitioner: org.apache.cassandra.dht.Murmur3Partitioner # will spread data evenly across them, subject to the granularity of # the configured compaction strategy. data_file_directories: - - ${rhq.cassandra.data.dir} + - ${rhq.storage.data}
# commit log -commitlog_directory: ${rhq.cassandra.commitlog.dir} +commitlog_directory: ${rhq.storage.commitlog}
# policy for data disk failures: # stop: shut down gossip and Thrift, leaving the node effectively dead, but @@ -193,7 +193,7 @@ row_cache_save_period: 0 row_cache_provider: SerializingCacheProvider
# saved caches -saved_caches_directory: ${rhq.cassandra.saved.caches.dir} +saved_caches_directory: ${rhq.storage.saved-caches}
# commitlog_sync may be either "periodic" or "batch." # When in batch mode, Cassandra won't ack writes until the commit log @@ -232,7 +232,7 @@ seed_provider: parameters: # seeds is actually a comma-delimited list of addresses. # Ex: "<ip1>,<ip2>,<ip3>" - - seeds: "${rhq.cassandra.seeds}" + - seeds: "${rhq.storage.seeds}"
# emergency pressure valve: each time heap usage after a full (CMS) # garbage collection is above this fraction of the max, Cassandra will @@ -307,11 +307,11 @@ trickle_fsync: false trickle_fsync_interval_in_kb: 10240
# TCP port, for commands and data -storage_port: ${rhq.cassandra.storage.port} +storage_port: ${rhq.storage.gossip-port}
# SSL port, for encrypted communication. Unused unless enabled in # encryption_options -ssl_storage_port: ${rhq.cassandra.ssl.storage.port} +ssl_storage_port: 7101
# Address to bind to and tell other Cassandra nodes to connect to. You # _must_ change this if you want multiple nodes to be able to @@ -323,7 +323,7 @@ ssl_storage_port: ${rhq.cassandra.ssl.storage.port} # address associated with the hostname (it might not be). # # Setting this to 0.0.0.0 is always wrong. -listen_address: ${rhq.cassandra.listen.address} +listen_address: ${rhq.storage.listen.address}
# Address to broadcast to other Cassandra nodes # Leaving this blank will set it to the same value as listen_address @@ -340,7 +340,7 @@ internode_authenticator: org.rhq.cassandra.auth.RhqInternodeAuthenticator # same as the rpc_address. The port however is different and specified below. start_native_transport: true # port for the CQL native transport to listen for clients on -native_transport_port: ${rhq.cassandra.native_transport_port} +native_transport_port: ${rhq.storage.cql-port} # NOTE: native_transport_min_threads is now deprecated and ignored (but kept # in the 1.2.x series for compatibility sake). # The minimum and maximum threads for handling requests when the native @@ -350,7 +350,7 @@ native_transport_port: ${rhq.cassandra.native_transport_port} # native_transport_max_threads: 128
# Whether to start the thrift rpc server. -start_rpc: ${rhq.cassandra.start_rpc} +start_rpc: ${rhq.storage.start_rpc}
# The address to bind the Thrift RPC service and native transport # server -- clients connect here. @@ -364,7 +364,7 @@ start_rpc: ${rhq.cassandra.start_rpc} # client drivers. rpc_address: ${rpc.address} # port for Thrift to listen for clients on -rpc_port: ${rhq.cassandra.rpc_port} +rpc_port: ${rhq.storage.rpc_port}
# enable or disable keepalive on rpc connections rpc_keepalive: true diff --git a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/bundle/cassandra/conf/rhq.log4j-server.properties b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/bundle/cassandra/conf/rhq.log4j-server.properties index e1b3cd4..fcea1b3 100644 --- a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/bundle/cassandra/conf/rhq.log4j-server.properties +++ b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/bundle/cassandra/conf/rhq.log4j-server.properties @@ -13,33 +13,26 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - -# for production, you should probably set pattern to %c instead of %l. -# (%l is slower.) - -# output messages into a rolling log file as well as stdout -log4j.rootLogger=${rhq.cassandra.logging.level},stdout,R - -# stdout -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 - # rolling log file -log4j.appender.R=org.apache.log4j.RollingFileAppender -log4j.appender.R.maxFileSize=20MB -log4j.appender.R.maxBackupIndex=50 -log4j.appender.R.layout=org.apache.log4j.PatternLayout -log4j.appender.R.layout.ConversionPattern=%5p [%t] %d{ISO8601} %F (line %L) %m%n +log4j.appender.R = org.apache.log4j.RollingFileAppender # Edit the next line to point to your logs directory -log4j.appender.R.File=${rhq.cassandra.log.file} -log4j.appender.R.Threshold=${rhq.cassandra.logging.level} - +log4j.appender.R.File = ${rhq.storage.log.file} +log4j.appender.R.Threshold = ${rhq.storage.logging.level} +log4j.appender.R.layout = org.apache.log4j.PatternLayout +log4j.appender.R.layout.ConversionPattern = %5p [%t] %d{ISO8601} %F (line %L) %m%n +log4j.appender.R.maxBackupIndex = 50 +log4j.appender.R.maxFileSize = 20MB +# stdout +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 # Application logging options #log4j.logger.org.apache.cassandra=DEBUG #log4j.logger.org.apache.cassandra.db=DEBUG #log4j.logger.org.apache.cassandra.service.StorageProxy=DEBUG - # Adding this to avoid thrift logging disconnect errors. -log4j.logger.org.apache.thrift.server.TNonblockingServer=ERROR - +log4j.logger.org.apache.thrift.server.TNonblockingServer = ERROR +# for production, you should probably set pattern to %c instead of %l. +# (%l is slower.) +# output messages into a rolling log file as well as stdout +log4j.rootLogger = ${rhq.storage.logging.level},stdout,R diff --git a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/CassandraClusterManager.java b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/CassandraClusterManager.java index 4a02e1d..a49d77d 100644 --- a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/CassandraClusterManager.java +++ b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/CassandraClusterManager.java @@ -144,7 +144,7 @@ public class CassandraClusterManager {
this.nodes = new String[deploymentOptions.getNumNodes()]; this.jmxPorts = new int[deploymentOptions.getNumNodes()]; - this.cqlPort = deploymentOptions.getNativeTransportPort(); + this.cqlPort = deploymentOptions.getCqlPort();
for (int i = 0; i < deploymentOptions.getNumNodes(); ++i) { File basedir = new File(deploymentOptions.getClusterDir(), "node" + i); @@ -240,7 +240,7 @@ public class CassandraClusterManager { this.jmxPorts[i] = deploymentOptions.getJmxPort() + i; }
- this.cqlPort = deploymentOptions.getNativeTransportPort(); + this.cqlPort = deploymentOptions.getCqlPort(); }
public void startCluster() { diff --git a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/DeploymentOptions.java b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/DeploymentOptions.java index 36620c2..cbe408d 100644 --- a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/DeploymentOptions.java +++ b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/DeploymentOptions.java @@ -73,7 +73,7 @@ public class DeploymentOptions { private Boolean embedded; private String loggingLevel; private Integer numTokens; - private Integer nativeTransportPort; + private Integer cqlPort; private Boolean startRpc; private Integer rpcPort; private Integer nativeTransportMaxThreads; @@ -87,8 +87,7 @@ public class DeploymentOptions { private String listenAddress; private String rpcAddress; private Integer jmxPort; - private Integer storagePort; - private Integer sslStoragePort; + private Integer gossipPort; private String seeds; private String heapSize; private String heapNewSize; @@ -138,34 +137,38 @@ public class DeploymentOptions { setUsername(loadProperty("rhq.storage.username", properties)); setPassword(loadProperty("rhq.storage.password", properties));
- setClusterDir(loadProperty("rhq.cassandra.cluster.dir", properties)); - setNumNodes(Integer.parseInt(loadProperty("rhq.cassandra.cluster.num-nodes", properties))); - setEmbedded(Boolean.valueOf(loadProperty("rhq.cassandra.cluster.is-embedded", properties))); - setLoggingLevel(loadProperty("rhq.cassandra.logging.level", properties)); + setBasedir(loadProperty("rhq.storage.basedir", properties)); + setClusterDir(loadProperty("rhq.storage.cluster.dir", properties)); + setNumNodes(Integer.parseInt(loadProperty("rhq.storage.cluster.num-nodes", properties))); + setEmbedded(Boolean.valueOf(loadProperty("rhq.storage.cluster.is-embedded", properties)));
- setNumTokens(Integer.valueOf(loadProperty("rhq.cassandra.num-tokens", properties))); - setNativeTransportPort(Integer.valueOf(loadProperty("rhq.cassandra.native-transport-port", properties))); - setRpcPort(Integer.valueOf(loadProperty("rhq.cassandra.rpc-port", properties))); - setNativeTransportMaxThreads(Integer.valueOf(loadProperty("rhq.cassandra.native-transport-max-threads", + setLoggingLevel(loadProperty("rhq.storage.logging.level", properties)); + setLogFileName(loadProperty("rhq.storage.log.file", properties)); + + setRpcPort(Integer.valueOf(loadProperty("rhq.storage.rpc-port", properties))); + setCqlPort(Integer.valueOf(loadProperty("rhq.storage.cql-port", properties))); + setJmxPort(Integer.valueOf(loadProperty("rhq.storage.jmx-port", properties))); + setGossipPort(Integer.valueOf(loadProperty("rhq.storage.gossip-port", properties))); + + setNumTokens(Integer.valueOf(loadProperty("rhq.storage.num-tokens", properties))); + setNativeTransportMaxThreads(Integer.valueOf(loadProperty("rhq.storage.native-transport-max-threads", properties))); - setAuthenticator(loadProperty("rhq.cassandra.authenticator", properties)); - setAuthorizer(loadProperty("rhq.cassandra.authorizer", properties)); - setDataDir(loadProperty("rhq.cassandra.data.dir", properties)); - setCommitLogDir(loadProperty("rhq.cassandra.commitlog.dir", properties)); - setSavedCachesDir(loadProperty("rhq.cassandra.saved.caches.dir", properties)); - setLogFileName(loadProperty("rhq.cassandra.log.file", properties)); - setListenAddress(loadProperty("rhq.cassandra.listen.address", properties)); - setStartRpc(Boolean.valueOf(loadProperty("rhq.cassandra.start_rpc", properties))); - setRpcAddress(loadProperty("rhq.cassandra.rpc.address", properties)); - setJmxPort(Integer.valueOf(loadProperty("rhq.cassandra.jmx.port", properties))); - setStoragePort(Integer.valueOf(loadProperty("rhq.cassandra.storage.port", properties))); - setSslStoragePort(Integer.valueOf(loadProperty("rhq.cassandra.ssl.storage.port", properties))); - - setSeeds(loadProperty("rhq.cassandra.seeds", properties)); - setBasedir(loadProperty("rhq.cassandra.basedir", properties)); - setHeapSize(loadProperty("rhq.cassandra.max.heap.size", properties)); - setHeapNewSize(loadProperty("rhq.cassandra.heap.new.size", properties)); - setStackSize(loadProperty("rhq.cassandra.stack.size", properties)); + + setAuthenticator(loadProperty("rhq.storage.authenticator", properties)); + setAuthorizer(loadProperty("rhq.storage.authorizer", properties)); + + setDataDir(loadProperty("rhq.storage.data", properties)); + setCommitLogDir(loadProperty("rhq.storage.commitlog", properties)); + setSavedCachesDir(loadProperty("rhq.storage.saved-caches", properties)); + + setSeeds(loadProperty("rhq.storage.seeds", properties)); + setListenAddress(loadProperty("rhq.storage.listen.address", properties)); + setStartRpc(Boolean.valueOf(loadProperty("rhq.storage.start_rpc", properties))); + setRpcAddress(loadProperty("rhq.storage.rpc.address", properties)); + + setHeapSize(loadProperty("rhq.storage.heap-size", properties)); + setHeapNewSize(loadProperty("rhq.storage.heap-new-size", properties)); + setStackSize(loadProperty("rhq.storage.stack-size", properties)); }
private String loadProperty(String key, Properties properties) { @@ -182,7 +185,7 @@ public class DeploymentOptions { setEmbedded(other.embedded); setLoggingLevel(other.loggingLevel); setNumTokens(other.numTokens); - setNativeTransportPort(other.nativeTransportPort); + setCqlPort(cqlPort); setNativeTransportMaxThreads(other.nativeTransportMaxThreads); setUsername(other.username); setPassword(other.password); @@ -197,8 +200,7 @@ public class DeploymentOptions { setStartRpc(other.startRpc); setRpcPort(other.rpcPort); setJmxPort(other.jmxPort); - setStoragePort(other.storagePort); - setSslStoragePort(other.sslStoragePort); + setGossipPort(other.gossipPort); setSeeds(other.seeds); setBasedir(other.basedir); setHeapSize(other.heapSize); @@ -252,7 +254,7 @@ public class DeploymentOptions { /** * @return The directory in which the node will be installed. */ - @DeploymentProperty(name = "rhq.cassandra.basedir") + @DeploymentProperty(name = "rhq.storage.basedir") public String getBasedir() { return basedir; } @@ -269,7 +271,7 @@ public class DeploymentOptions { /** * @return The number of nodes in the cluster. This only applies to embedded clusters. */ - @DeploymentProperty(name = "rhq.cassandra.cluster.num-nodes") + @DeploymentProperty(name = "rhq.storage.cluster.num-nodes") public int getNumNodes() { return numNodes; } @@ -289,7 +291,7 @@ public class DeploymentOptions { * embedded cluster is one in which all nodes run on a single host and can only accept * requests from that same host. */ - @DeploymentProperty(name = "rhq.cassandra.cluster.is-embedded") + @DeploymentProperty(name = "rhq.storage.cluster.is-embedded") public boolean isEmbedded() { return embedded; } @@ -308,7 +310,7 @@ public class DeploymentOptions { /** * @return The log4j logging level that Cassandra uses */ - @DeploymentProperty(name = "rhq.cassandra.logging.level") + @DeploymentProperty(name = "rhq.storage.logging.level") public String getLoggingLevel() { return loggingLevel; } @@ -325,7 +327,7 @@ public class DeploymentOptions { /** * @return The number of tokens assigned to this the node on the ring. Defaults to 256. */ - @DeploymentProperty(name = "rhq.cassandra.num_tokens") + @DeploymentProperty(name = "rhq.storage.num_tokens") public Integer getNumTokens() { return numTokens; } @@ -343,24 +345,24 @@ public class DeploymentOptions { /** * @return The port on which Cassandra listens for client requests. */ - @DeploymentProperty(name = "rhq.cassandra.native_transport_port") - public Integer getNativeTransportPort() { - return nativeTransportPort; + @DeploymentProperty(name = "rhq.storage.cql-port") + public Integer getCqlPort() { + return cqlPort; }
/** * @param port The port on which Cassandra listens for client requests. */ - public void setNativeTransportPort(Integer port) { - if (nativeTransportPort == null) { - nativeTransportPort = port; + public void setCqlPort(Integer port) { + if (cqlPort == null) { + cqlPort = port; } }
/** * @return true whether the Thrift-based RPC should be started */ - @DeploymentProperty(name = "rhq.cassandra.start_rpc") + @DeploymentProperty(name = "rhq.storage.start_rpc") public Boolean getStartRpc() { return startRpc; } @@ -374,7 +376,7 @@ public class DeploymentOptions { } }
- @DeploymentProperty(name = "rhq.cassandra.rpc_port") + @DeploymentProperty(name = "rhq.storage.rpc_port") public Integer getRpcPort() { return rpcPort; } @@ -388,7 +390,7 @@ public class DeploymentOptions { /** * @return The max number of threads to handle CQL requests */ - @DeploymentProperty(name = "rhq.cassandra.native_transport_max_threads") + @DeploymentProperty(name = "rhq.storage.native_transport_max_threads") public Integer getNativeTransportMaxThreads() { return nativeTransportMaxThreads; } @@ -449,7 +451,7 @@ public class DeploymentOptions { /** * @return The FQCN of the class that handles Cassandra authentication */ - @DeploymentProperty(name = "rhq.cassandra.authenticator") + @DeploymentProperty(name = "rhq.storage.authenticator") public String getAuthenticator() { return authenticator; } @@ -466,7 +468,7 @@ public class DeploymentOptions { /** * @return The FQCN of the class that handles Cassandra authorization */ - @DeploymentProperty(name = "rhq.cassandra.authorizer") + @DeploymentProperty(name = "rhq.storage.authorizer") public String getAuthorizer() { return authorizer; } @@ -483,7 +485,7 @@ public class DeploymentOptions { /** * @return The directory where Cassandra stores data on disk */ - @DeploymentProperty(name = "rhq.cassandra.data.dir") + @DeploymentProperty(name = "rhq.storage.data") public String getDataDir() { return dataDir; } @@ -500,7 +502,7 @@ public class DeploymentOptions { /** * @return The directory where Cassandra stores commit log files */ - @DeploymentProperty(name = "rhq.cassandra.commitlog.dir") + @DeploymentProperty(name = "rhq.storage.commitlog") public String getCommitLogDir() { return commitLogDir; } @@ -517,7 +519,7 @@ public class DeploymentOptions { /** * @return The directory where Cassandra stores saved caches on disk */ - @DeploymentProperty(name = "rhq.cassandra.saved.caches.dir") + @DeploymentProperty(name = "rhq.storage.saved-caches") public String getSavedCachesDir() { return savedCachesDir; } @@ -534,7 +536,7 @@ public class DeploymentOptions { /** * @return The full path of the Log4J log file to which Cassandra writes. */ - @DeploymentProperty(name = "rhq.cassandra.log.file") + @DeploymentProperty(name = "rhq.storage.log.file") public String getLogFileName() { return logFileName; } @@ -551,7 +553,7 @@ public class DeploymentOptions { /** * @return The address to which Cassandra binds and tells other node to connect to */ - @DeploymentProperty(name = "rhq.cassandra.listen.address") + @DeploymentProperty(name = "rhq.storage.listen.address") public String getListenAddress() { return listenAddress; } @@ -579,7 +581,7 @@ public class DeploymentOptions { /** * @return The port on which Cassandra listens for JMX connections */ - @DeploymentProperty(name = "rhq.cassandra.jmx.port") + @DeploymentProperty(name = "rhq.storage.jmx-port") public Integer getJmxPort() { return jmxPort; } @@ -596,36 +598,17 @@ public class DeploymentOptions { /** * @return The port on which Cassandra listens for gossip requests */ - @DeploymentProperty(name = "rhq.cassandra.storage.port") - public Integer getStoragePort() { - return storagePort; + @DeploymentProperty(name = "rhq.storage.gossip-port") + public Integer getGossipPort() { + return gossipPort; }
/** * @param port The port on which Cassandra listens for gossip requests */ - public void setStoragePort(Integer port) { - if (storagePort == null) { - storagePort = port; - } - } - - /** - * @return The port on which Cassandra listens for encrypted gossip requests. Note that - * this is only used if encryption is enabled. - */ - @DeploymentProperty(name = "rhq.cassandra.ssl.storage.port") - public Integer getSslStoragePort() { - return sslStoragePort; - } - - /** - * @param port The port on which Cassandra listens for encrypted gossip requests. Note - * that this is only used if encryption is enabled. - */ - public void setSslStoragePort(Integer port) { - if (sslStoragePort == null) { - sslStoragePort = port; + public void setGossipPort(Integer port) { + if (gossipPort == null) { + gossipPort = port; } }
@@ -633,7 +616,7 @@ public class DeploymentOptions { * @return A comma-delimited list of IP addresses/host names that are deemed contact * points during node start up to learn about the ring topology. */ - @DeploymentProperty(name = "rhq.cassandra.seeds") + @DeploymentProperty(name = "rhq.storage.seeds") public String getSeeds() { return seeds; } @@ -652,7 +635,7 @@ public class DeploymentOptions { * @return The value to use for both the max and min heap sizes. Defaults to * ${MAX_HEAP_SIZE} which allows the cassandra-env.sh script to determine the value. */ - @DeploymentProperty(name = "rhq.cassandra.max.heap.size") + @DeploymentProperty(name = "rhq.storage.heap-size") public String getHeapSize() { return heapSize; } @@ -671,7 +654,7 @@ public class DeploymentOptions { * @return The value to use for the size of the new generation. Defaults to * ${HEAP_NEWSIZE} which allows the cassandra-env.sh script to determine the value. */ - @DeploymentProperty(name = "rhq.cassandra.heap.new.size") + @DeploymentProperty(name = "rhq.storage.heap-new-size") public String getHeapNewSize() { return heapNewSize; } @@ -691,7 +674,7 @@ public class DeploymentOptions { * @return The value to use for the JVM stack size. This is passed directly to the -Xss * JVM start up option. */ - @DeploymentProperty(name = "rhq.cassandra.stack.size") + @DeploymentProperty(name = "rhq.storage.stack-size") public String getStackSize() { return stackSize; } diff --git a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/DeploymentOptionsFactory.java b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/DeploymentOptionsFactory.java index 7a3f207..5aa138c 100644 --- a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/DeploymentOptionsFactory.java +++ b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/DeploymentOptionsFactory.java @@ -39,7 +39,7 @@ public class DeploymentOptionsFactory { */ public DeploymentOptions newDeploymentOptions() { // Make sure we have a high enough stack size. See https://bugzilla.redhat.com/show_bug.cgi?id=1008090 - System.setProperty("rhq.cassandra.stack.size", "256k"); + System.setProperty("rhq.storage.stack-size", "256k"); return new DeploymentOptions(); }
diff --git a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/resources/cassandra.properties b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/resources/cassandra.properties index e44b3ac..3f565c1 100644 --- a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/resources/cassandra.properties +++ b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/resources/cassandra.properties @@ -4,7 +4,7 @@
# The directory in which Cassandra is installed. This property must be # specified. -rhq.cassandra.basedir=${rhq.rootDir} +rhq.storage.basedir=${rhq.rootDir}
# The username with which to authenticate requests to Cassandra. # rhq.storage.username= @@ -18,77 +18,73 @@ rhq.cassandra.basedir=${rhq.rootDir} # 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.num-tokens=256 +rhq.storage.num-tokens=256
# A comma-delimited list of IP addresses/host names that are deemed contact points. # Cassandra nodes use this list of hosts to find each other and learn the # topology of the ring. If you are running a local development cluster, be sure # to have aliases set up for localhost. -rhq.cassandra.seeds=localhost +rhq.storage.seeds=localhost
# A class that performs authentication. The value should be a fully qualified class name # and implement IAuthenticator. -rhq.cassandra.authenticator=org.apache.cassandra.auth.PasswordAuthenticator +rhq.storage.authenticator=org.apache.cassandra.auth.PasswordAuthenticator
# A class that performs authorization. Used to limit/provide permissions. The value should # be a fully qualified class name and implement IAuthorizer. -rhq.cassandra.authorizer=org.apache.cassandra.auth.CassandraAuthorizer +rhq.storage.authorizer=org.apache.cassandra.auth.CassandraAuthorizer
# The IP address or hostname that other Cassandra nodes will use to connect to # this node. -rhq.cassandra.listen.address=localhost +rhq.storage.listen.address=localhost
# Set this property to true for starting the Thrift-based RPC -rhq.cassandra.start_rpc=false +rhq.storage.start_rpc=false
# The listen address for Thrift clients. -rhq.cassandra.rpc.address=localhost +rhq.storage.rpc.address=localhost
# The port to listen for Thrift clients on. -rhq.cassandra.rpc-port=9160 +rhq.storage.rpc-port=9160
# The maximum number of threads handling native CQL requests. -rhq.cassandra.native-transport-max-threads=64 +rhq.storage.native-transport-max-threads=64
# The port for the CQL native transport to listen for clients on. -rhq.cassandra.native-transport-port=9042 +rhq.storage.cql-port=9042
# The port over which Cassandra listens for JMX connections. -rhq.cassandra.jmx.port=7200 +rhq.storage.jmx-port=7200
# TCP port, for commands and data (i.e., inter-node communication) -rhq.cassandra.storage.port=7000 - -# SSL port, for encrypted communication. Unused unless enabled in -# encryption_options (i.e., encrypted inter-node communication) -rhq.cassandra.ssl.storage.port=7001 +rhq.storage.gossip-port=7000
# The directory where Cassandra stores data files. -rhq.cassandra.data.dir=${rhq.cassandra.basedir}/data +rhq.storage.data=${rhq.storage.basedir}/data
# Th directory where Cassandra stores commit log files. -rhq.cassandra.commitlog.dir=${rhq.cassandra.basedir}/commit_log +rhq.storage.commitlog=${rhq.storage.basedir}/commit_log
# The directory where Cassandra stores saved caches. -rhq.cassandra.saved.caches.dir=${rhq.cassandra.basedir}/saved_caches +rhq.storage.saved-caches=${rhq.storage.basedir}/saved_caches
# The directory where Cassandra stored log4j log files. -rhq.cassandra.log.dir=${rhq.cassandra.basedir}/logs +rhq.storage.log.dir=${rhq.storage.basedir}/logs
# The log file to which Cassandra writes. -rhq.cassandra.log.file=${rhq.cassandra.basedir}/logs/rhq-storage-node.log +rhq.storage.log.file=${rhq.storage.basedir}/logs/rhq-storage-node.log
# Used for both the min and max heap sizes for the Cassandra JVM. -rhq.cassandra.max.heap.size=${MAX_HEAP_SIZE} +rhq.storage.heap-size=${MAX_HEAP_SIZE}
# Heap new size refers to the size of the young generation. -rhq.cassandra.heap.new.size=${HEAP_NEWSIZE} +rhq.storage.heap-new-size=${HEAP_NEWSIZE}
# The JVM stack size for Cassandra. This value is passed directly to the -Xss option. -rhq.cassandra.stack.size=256k +rhq.storage.stack-size=256k
# The log4j logging level to use. -rhq.cassandra.logging.level=DEBUG +rhq.storage.logging.level=DEBUG
# The remaining properties pertain to cluster configuration and are only used in # development and testing environments when an embedded cluster is used. These properties @@ -102,16 +98,16 @@ rhq.cassandra.logging.level=DEBUG # Accepts a value of true or false and specifies whether or not the cluster is embedded. # Note that if this property is set to false, the other, remaining cluster configuration # properties that are set will be ignored as they are only used with embedded clusters. -rhq.cassandra.cluster.is-embedded=true +rhq.storage.cluster.is-embedded=true
################################################################### # Properties below this point apply ONLY to embedded clusters. # ###################################################################
# The directory in which cluster nodes will be installed. -rhq.cassandra.cluster.dir=${rhq.rootDir}/cassandra +rhq.storage.cluster.dir=${rhq.rootDir}/cassandra
# The number of nodes in the cluster. This specifies how many nodes to install and # configure. The top level or base directory for each node will be nodeN where N is the # node number. -rhq.cassandra.cluster.num-nodes=2 +rhq.storage.cluster.num-nodes=2 diff --git a/modules/common/cassandra-ccm/cassandra-ccm-core/src/test/java/org/rhq/cassandra/DeployerITest.java b/modules/common/cassandra-ccm/cassandra-ccm-core/src/test/java/org/rhq/cassandra/DeployerITest.java index 76ff090..86c382d 100644 --- a/modules/common/cassandra-ccm/cassandra-ccm-core/src/test/java/org/rhq/cassandra/DeployerITest.java +++ b/modules/common/cassandra-ccm/cassandra-ccm-core/src/test/java/org/rhq/cassandra/DeployerITest.java @@ -33,15 +33,15 @@ import java.io.File; import java.io.FileReader; import java.util.List;
+import difflib.DiffUtils; +import difflib.Patch; + import org.testng.annotations.BeforeClass; import org.testng.annotations.Test;
import org.rhq.core.util.StringUtil; import org.rhq.core.util.stream.StreamUtil;
-import difflib.DiffUtils; -import difflib.Patch; - /** * @author John Sanda */ @@ -81,7 +81,7 @@ public class DeployerITest { assertTrue(binDir.exists(), binDir + " does not exist");
File confDir = new File(deployDir, "conf"); - assertTrue(confDir.exists(), confDir + " does not exist"); + assertTrue(confDir.exists(), confDir + " does not exist");
File libDir = new File(deployDir, "lib"); assertTrue(libDir.exists(), libDir + " does not exist"); @@ -89,7 +89,14 @@ public class DeployerITest {
@Test(dependsOnMethods = "deploy") public void applyConfigChanges() throws Exception { - deployer.applyConfigChanges(); + try { + deployer.applyConfigChanges(); + } catch (DeploymentException e) { + // on windows the update will fail when looking for the wrapper file + if (!(File.separatorChar == '\' && e.getMessage().contains("rhq-storage-wrapper.env"))) { + throw e; + } + } }
@Test(dependsOnMethods = "applyConfigChanges") @@ -110,15 +117,15 @@ public class DeployerITest { private void assertFileDeployedAndUpdated(String fileName) throws Exception { File rhqFile = new File(confDir, "rhq." + fileName); File file = new File(confDir, fileName); - assertTrue(file.exists(), file + " does not exist"); + assertTrue(file.exists(), file + " does not exist"); assertFalse(rhqFile.exists(), "Failed to delete " + rhqFile); assertFileUpdated(file); }
private void assertFileUpdated(File actualFile) throws Exception { File expectedFile = new File(getClass().getResource("/expected." + actualFile.getName()).toURI()); - assertTrue(expectedFile.exists(), "Cannot verify that " + actualFile.getName() + " has been updated. There " + - "should be a file named expected." + actualFile.getName() + " in the root of the test classpath."); + assertTrue(expectedFile.exists(), "Cannot verify that " + actualFile.getName() + " has been updated. There " + + "should be a file named expected." + actualFile.getName() + " in the root of the test classpath.");
String actualContents = StreamUtil.slurp(new FileReader(actualFile)); List<String> actualList = asList(actualContents.split("\n")); @@ -127,10 +134,10 @@ public class DeployerITest { List<String> expectedList = asList(expectedContents.split("\n"));
Patch patch = DiffUtils.diff(actualList, expectedList); - List<String> diffs = DiffUtils.generateUnifiedDiff(actualFile.getName(), "expected.cassandra.yaml", - actualList, patch, 5); - assertTrue(patch.getDeltas().isEmpty(), actualFile.getName() + " was not configured correctly. The " + - "following differences were found:\n" + StringUtil.listToString(diffs, "\n")); + List<String> diffs = DiffUtils.generateUnifiedDiff(actualFile.getName(), "expected.cassandra.yaml", actualList, + patch, 5); + assertTrue(patch.getDeltas().isEmpty(), actualFile.getName() + " was not configured correctly. The " + + "following differences were found:\n" + StringUtil.listToString(diffs, "\n")); }
} diff --git a/modules/common/cassandra-ccm/cassandra-ccm-core/src/test/resources/expected.cassandra.yaml b/modules/common/cassandra-ccm/cassandra-ccm-core/src/test/resources/expected.cassandra.yaml index 1aa6f87..90f298e 100644 --- a/modules/common/cassandra-ccm/cassandra-ccm-core/src/test/resources/expected.cassandra.yaml +++ b/modules/common/cassandra-ccm/cassandra-ccm-core/src/test/resources/expected.cassandra.yaml @@ -311,7 +311,7 @@ storage_port: 7000
# SSL port, for encrypted communication. Unused unless enabled in # encryption_options -ssl_storage_port: 7001 +ssl_storage_port: 7101
# Address to bind to and tell other Cassandra nodes to connect to. You # _must_ change this if you want multiple nodes to be able to diff --git a/modules/common/cassandra-ccm/cassandra-ccm-testng/src/main/java/org/rhq/cassandra/CCMTestNGListener.java b/modules/common/cassandra-ccm/cassandra-ccm-testng/src/main/java/org/rhq/cassandra/CCMTestNGListener.java index ab58c95..286a5ff 100644 --- a/modules/common/cassandra-ccm/cassandra-ccm-testng/src/main/java/org/rhq/cassandra/CCMTestNGListener.java +++ b/modules/common/cassandra-ccm/cassandra-ccm-testng/src/main/java/org/rhq/cassandra/CCMTestNGListener.java @@ -56,8 +56,8 @@ public class CCMTestNGListener implements IInvokedMethodListener { Method method = invokedMethod.getTestMethod().getConstructorOrMethod().getMethod(); if (method.isAnnotationPresent(ShutdownCluster.class)) { try { - Boolean skipShutdown = Boolean.valueOf( - System.getProperty("rhq.cassandra.cluster.skip-shutdown", "false")); + Boolean skipShutdown = Boolean + .valueOf(System.getProperty("rhq.storage.cluster.skip-shutdown", "false")); if (!skipShutdown) { shutdownCluster(); } @@ -68,12 +68,12 @@ public class CCMTestNGListener implements IInvokedMethodListener { }
private void deployCluster(DeployCluster annotation) throws Exception { - boolean deploy = Boolean.valueOf(System.getProperty("rhq.cassandra.cluster.deploy", "true")); + boolean deploy = Boolean.valueOf(System.getProperty("rhq.storage.cluster.deploy", "true")); if (!deploy) { return; }
- String clusterDir = System.getProperty("rhq.cassandra.cluster.dir"); + String clusterDir = System.getProperty("rhq.storage.cluster.dir"); if (clusterDir == null || clusterDir.isEmpty()) { File basedir = new File("target"); clusterDir = new File(basedir, "cassandra").getAbsolutePath(); @@ -102,7 +102,7 @@ public class CCMTestNGListener implements IInvokedMethodListener { String[] nodes = ccm.getNodes(); int[] jmxPorts = ccm.getJmxPorts();
- if (System.getProperty("rhq.cassandra.cluster.skip-shutdown") == null) { + if (System.getProperty("rhq.storage.cluster.skip-shutdown") == null) { for (int index = 0; index < nodes.length; index++) { try { if (clusterInitService.isNativeTransportRunning(nodes[index], jmxPorts[index])) { @@ -115,7 +115,6 @@ public class CCMTestNGListener implements IInvokedMethodListener { } ccm.startCluster(false);
- clusterInitService.waitForClusterToStart(nodes, jmxPorts, nodes.length, 2000, 20, 10);
SchemaManager schemaManager = new SchemaManager(annotation.username(), annotation.password(), nodes, diff --git a/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java b/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java index 295c7ed..58c04ac 100644 --- a/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java +++ b/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java @@ -105,9 +105,20 @@ public class StorageInstaller {
private final String STORAGE_BASEDIR = "rhq-storage";
- private final Log log = LogFactory.getLog(StorageInstaller.class); + private static final String OPTION_HOSTNAME = "rhq.storage.hostname"; + private static final String OPTION_SEEDS = "rhq.storage.seeds"; + private static final String OPTION_CQL_PORT = "rhq.storage.cql-port"; + private static final String OPTION_JMX_PORT = "rhq.storage.jmx-port"; + private static final String OPTION_GOSSIP_PORT = "rhq.storage.gossip-port"; + private static final String OPTION_COMMITLOG = "rhq.storage.commitlog"; + private static final String OPTION_DATA = "rhq.storage.data"; + private static final String OPTION_SAVED_CACHES = "rhq.storage.saved-caches"; + private static final String OPTION_HEAP_SIZE = "rhq.storage.heap-size"; + private static final String OPTION_HEAP_NEW_SIZE = "rhq.storage.heap-new-size"; + private static final String OPTION_STACK_SIZE = "rhq.storage.stack-size"; + private static final String OPTION_VERIFY_DATA_DIRS_EMPTY = "rhq.storage.verify-data-dirs-empty";
- private final String VERIFY_DATA_DIRS_EMPTY = "verify-data-dirs-empty"; + private final Log log = LogFactory.getLog(StorageInstaller.class);
private Options options;
@@ -119,11 +130,9 @@ public class StorageInstaller {
private int rpcPort = 9160;
- private int defaultNativeTransportPort = 9142; - - private int defaultStoragePort = 7100; + private int defaultCqlPort = 9142;
- private int sslStoragePort = 7101; + private int defaultGossipPort = 7100;
private File logDir;
@@ -137,28 +146,28 @@ public class StorageInstaller { storageBasedir = new File(basedir, STORAGE_BASEDIR); logDir = new File(serverBasedir, "logs");
- Option hostname = new Option("n", "hostname", true, + Option hostname = new Option("n", OPTION_HOSTNAME, true, "The hostname or IP address on which the node will listen for " - + "requests. Note that if a hostname is specified, the IP address is used. Defaults to the IP " + - "address of the local host (which depending on hostname configuration may not be localhost)."); + + "requests. Note that if a hostname is specified, the IP address is used. Defaults to the IP " + + "address of the local host (which depending on hostname configuration may not be localhost)."); hostname.setArgName("HOSTNAME");
- Option seeds = new Option("s", "seeds", true, "A comma-delimited list of hostnames or IP addresses that " + Option seeds = new Option("s", OPTION_SEEDS, true, "A comma-delimited list of hostnames or IP addresses that " + "serve as contact points. Nodes use this list to find each other and to learn the cluster topology. " + "It does not need to specify all nodes in the cluster. Defaults to this node's hostname."); seeds.setArgName("SEEDS");
- Option jmxPortOption = new Option("j", "jmx-port", true, "The port on which to listen for JMX connections. " - + "Defaults to " + defaultJmxPort + "."); + Option jmxPortOption = new Option("j", OPTION_JMX_PORT, true, + "The port on which to listen for JMX connections. " + "Defaults to " + defaultJmxPort + "."); jmxPortOption.setArgName("PORT");
- Option nativeTransportPortOption = new Option("c", "client-port", true, "The port on which to " - + "listen for client requests. Defaults to " + defaultNativeTransportPort); - nativeTransportPortOption.setArgName("PORT"); + Option cqlPortOption = new Option("c", OPTION_CQL_PORT, true, "The port on which to " + + "listen for client requests. Defaults to " + defaultCqlPort); + cqlPortOption.setArgName("PORT");
- Option storagePortOption = new Option(null, "storage-port", true, "The port on which to listen for requests " - + " from other nodes. Defaults to " + defaultStoragePort); - storagePortOption.setArgName("PORT"); + Option gossipPortOption = new Option(null, OPTION_GOSSIP_PORT, true, + "The port on which to listen for requests " + " from other nodes. Defaults to " + defaultGossipPort); + gossipPortOption.setArgName("PORT");
Option startOption = new Option(null, "start", true, "Start the storage node after installing it on disk. " + "Defaults to true."); @@ -168,45 +177,49 @@ public class StorageInstaller { + "after starting it. This option is ignored if the start option is not set. Defaults to true."); checkStatus.setArgName("true|false");
- Option commitLogOption = new Option(null, "commitlog", true, "The directory where the storage node keeps " + Option commitLogOption = new Option(null, OPTION_COMMITLOG, true, "The directory where the storage node keeps " + "commit log files. Defaults to " + getDefaultCommitLogDir() + "."); commitLogOption.setArgName("DIR");
- Option dataDirOption = new Option(null, "data", true, "The directory where the storage node keeps data files. " - + "Defaults to " + getDefaultDataDir() + "."); + Option dataDirOption = new Option(null, OPTION_DATA, true, + "The directory where the storage node keeps data files. " + "Defaults to " + getDefaultDataDir() + "."); dataDirOption.setArgName("DIR");
- Option savedCachesDirOption = new Option(null, "saved-caches", true, "The directory where the storage node " - + "keeps saved cache files. Defaults to " + getDefaultSavedCachesDir() + "."); + Option savedCachesDirOption = new Option(null, OPTION_SAVED_CACHES, true, + "The directory where the storage node " + "keeps saved cache files. Defaults to " + + getDefaultSavedCachesDir() + "."); savedCachesDirOption.setArgName("DIR");
Option basedirOption = new Option(null, "dir", true, "The directory where the storage node will be installed " + "The default directory will be " + storageBasedir);
- Option heapSizeOption = new Option(null, "heap-size", true, "The value to use for both the min and max heap. " - + "This value is passed directly to the -Xms and -Xmx options of the Java executable. Defaults to " - + defaultHeapSize); + Option heapSizeOption = new Option(null, OPTION_HEAP_SIZE, true, + "The value to use for both the min and max heap. " + + "This value is passed directly to the -Xms and -Xmx options of the Java executable. Defaults to " + + defaultHeapSize);
- Option heapNewSizeOption = new Option(null, "heap-new-size", true, "The value to use for the new generation " - + "of the heap. This value is passed directly to the -Xmn option of the Java executable. Defaults to " - + defaultHeapNewSize); + Option heapNewSizeOption = new Option(null, OPTION_HEAP_NEW_SIZE, true, + "The value to use for the new generation " + + "of the heap. This value is passed directly to the -Xmn option of the Java executable. Defaults to " + + defaultHeapNewSize);
- Option stackSizeOption = new Option(null, "stack-size", true, "The value to use for the thread stack size. " - + "This value is passed directly to the -Xss option of the Java executable."); + Option stackSizeOption = new Option(null, OPTION_STACK_SIZE, true, + "The value to use for the thread stack size. " + + "This value is passed directly to the -Xss option of the Java executable.");
Option upgradeOption = new Option(null, "upgrade", true, "Upgrades an existing storage node. The directory " + "where the existing RHQ server is installed."); upgradeOption.setArgName("RHQ_SERVER_DIR");
- Option verifyDataDirsEmptyOption = new Option(null, VERIFY_DATA_DIRS_EMPTY, true, "Will cause the installer " + - "to abort if any of the data directories is not empty. Defaults to true."); + Option verifyDataDirsEmptyOption = new Option(null, OPTION_VERIFY_DATA_DIRS_EMPTY, true, + "Will cause the installer " + "to abort if any of the data directories is not empty. Defaults to true.");
options = new Options().addOption(new Option("h", "help", false, "Show this message.")).addOption(hostname) .addOption(seeds).addOption(jmxPortOption).addOption(startOption).addOption(checkStatus) .addOption(commitLogOption).addOption(dataDirOption).addOption(savedCachesDirOption) - .addOption(nativeTransportPortOption).addOption(storagePortOption).addOption(basedirOption) - .addOption(heapSizeOption).addOption(heapNewSizeOption).addOption(stackSizeOption) - .addOption(upgradeOption).addOption(verifyDataDirsEmptyOption); + .addOption(cqlPortOption).addOption(gossipPortOption).addOption(basedirOption).addOption(heapSizeOption) + .addOption(heapNewSizeOption).addOption(stackSizeOption).addOption(upgradeOption) + .addOption(verifyDataDirsEmptyOption); }
public int run(CommandLine cmdLine) throws Exception { @@ -230,14 +243,14 @@ public class StorageInstaller { log.warn(e.getMessage()); log.warn("The storage installer will exit due to previous errors"); return e.getErrorCode(); - } + }
PropertiesFileUpdate serverPropertiesUpdater = getServerProperties(); log.info("Updating rhq-server.properties..."); Properties properties = new Properties(); properties.setProperty("rhq.storage.nodes", installerInfo.hostname); - properties.setProperty("rhq.storage.cql-port", Integer.toString(installerInfo.cqlPort)); - properties.setProperty("rhq.storage.gossip-port", Integer.toString(installerInfo.gossipPort)); + properties.setProperty(OPTION_CQL_PORT, Integer.toString(installerInfo.cqlPort)); + properties.setProperty(OPTION_GOSSIP_PORT, Integer.toString(installerInfo.gossipPort));
serverPropertiesUpdater.update(properties);
@@ -257,12 +270,12 @@ public class StorageInstaller { log.warn("The storage node reported the following errors while trying to start:\n\n" + startupErrors + "\n"); if (startupErrors.contains("Port already in use: " + installerInfo.jmxPort)) { - log.warn("There is a conflict with the JMX port that prevented the storage node JVM " + - "from starting."); + log.warn("There is a conflict with the JMX port that prevented the storage node JVM " + + "from starting."); File confDir = new File(storageBasedir, "conf"); File confFile = new File(confDir, "cassandra-jvm.properties"); - log.info("Change the jmx_port property in " + confFile + " to have the storage node listen " + - "on a different port for JMX connections."); + log.info("Change the jmx_port property in " + confFile + " to have the storage node listen " + + "on a different port for JMX connections.");
return STATUS_JMX_PORT_CONFLICT; } @@ -283,13 +296,12 @@ public class StorageInstaller { } } else { if (isRunning()) { - log.info("Installation of the storage node is complete. The node should be up and " - + "running"); + log.info("Installation of the storage node is complete. The node should be up and " + "running"); return STATUS_NO_ERRORS; } else { log.warn("Installation of the storage node is complete, but the node does not appear to " - + "be running. No start up errors were reported. Check the log file at " + - installerInfo.logFile + " for any other possible errors."); + + "be running. No start up errors were reported. Check the log file at " + + installerInfo.logFile + " for any other possible errors."); return STATUS_STORAGE_NOT_RUNNING; } } @@ -322,96 +334,91 @@ public class StorageInstaller { deploymentOptions.setListenAddress(installerInfo.hostname); deploymentOptions.setRpcAddress(installerInfo.hostname);
- String seeds = cmdLine.getOptionValue("seeds", installerInfo.hostname); + String seeds = cmdLine.getOptionValue(OPTION_SEEDS, installerInfo.hostname); deploymentOptions.setSeeds(seeds);
- String commitlogDir = cmdLine.getOptionValue("commitlog", getDefaultCommitLogDir().getAbsolutePath()); - String dataDir = cmdLine.getOptionValue("data", getDefaultDataDir().getAbsolutePath()); - String savedCachesDir = cmdLine.getOptionValue("saved-caches", getDefaultSavedCachesDir().getAbsolutePath()); + String commitlogDir = cmdLine.getOptionValue(OPTION_COMMITLOG, getDefaultCommitLogDir().getAbsolutePath()); + String dataDir = cmdLine.getOptionValue(OPTION_DATA, getDefaultDataDir().getAbsolutePath()); + String savedCachesDir = cmdLine.getOptionValue(OPTION_SAVED_CACHES, getDefaultSavedCachesDir() + .getAbsolutePath());
File commitLogDirFile = new File(commitlogDir); File dataDirFile = new File(dataDir); File savedCachesDirFile = new File(savedCachesDir); installerInfo.logFile = new File(logDir, "rhq-storage.log");
- boolean verifyDataDirsEmpty = Boolean.valueOf(cmdLine.getOptionValue(VERIFY_DATA_DIRS_EMPTY, "true")); + boolean verifyDataDirsEmpty = Boolean + .valueOf(cmdLine.getOptionValue(OPTION_VERIFY_DATA_DIRS_EMPTY, "true")); if (verifyDataDirsEmpty) { // validate the three data directories are empty - if they are not, we are probably stepping on // another storage node if (!isDirectoryEmpty(commitLogDirFile)) { log.error("Commitlog directory is not empty. It should not exist for a new Storage Node [" + commitLogDirFile.getAbsolutePath() + "]"); - throw new StorageInstallerException("Installation cannot proceed. The commit log directory " + - commitLogDirFile + " is not empty", STATUS_DATA_DIR_NOT_EMPTY); + throw new StorageInstallerException("Installation cannot proceed. The commit log directory " + + commitLogDirFile + " is not empty", STATUS_DATA_DIR_NOT_EMPTY); } if (!isDirectoryEmpty(dataDirFile)) { log.error("Data directory is not empty. It should not exist for a new Storage Node [" + dataDirFile.getAbsolutePath() + "]"); - throw new StorageInstallerException("Installation cannot proceed. The data directory " + dataDirFile + - " is not empty", STATUS_DATA_DIR_NOT_EMPTY); + throw new StorageInstallerException("Installation cannot proceed. The data directory " + + dataDirFile + " is not empty", STATUS_DATA_DIR_NOT_EMPTY); } if (!isDirectoryEmpty(savedCachesDirFile)) { log.error("Saved caches directory is not empty. It should not exist for a new Storage Node [" + savedCachesDirFile.getAbsolutePath() + "]"); - throw new StorageInstallerException("Installation cannot proceed. The saved caches directory " + - savedCachesDirFile + " is not empty", STATUS_DATA_DIR_NOT_EMPTY); + throw new StorageInstallerException("Installation cannot proceed. The saved caches directory " + + savedCachesDirFile + " is not empty", STATUS_DATA_DIR_NOT_EMPTY); } }
- installerInfo.jmxPort = getPort(cmdLine, "jmx-port", defaultJmxPort); + installerInfo.jmxPort = getPort(cmdLine, OPTION_JMX_PORT, defaultJmxPort); if (isPortBound(installerInfo.hostname, installerInfo.jmxPort, "jmx-port")) { - throw new StorageInstallerException("The jmx-port (" + installerInfo.jmxPort + ") is already in use. " + - "Installation cannot proceed.", STATUS_JMX_PORT_CONFLICT); + throw new StorageInstallerException("The jmx-port (" + installerInfo.jmxPort + ") is already in use. " + + "Installation cannot proceed.", STATUS_JMX_PORT_CONFLICT); }
- installerInfo.cqlPort = getPort(cmdLine, "client-port", defaultNativeTransportPort); - if (isPortBound(installerInfo.hostname, installerInfo.cqlPort, "client-port")) { - throw new StorageInstallerException("The client-port (" + installerInfo.cqlPort + ") is already in use. " + - "Installation cannot proceed.", STATUS_CQL_PORT_CONFLICT); + installerInfo.cqlPort = getPort(cmdLine, OPTION_CQL_PORT, defaultCqlPort); + if (isPortBound(installerInfo.hostname, installerInfo.cqlPort, OPTION_CQL_PORT)) { + throw new StorageInstallerException("The cql-port (" + installerInfo.cqlPort + ") is already in use. " + + "Installation cannot proceed.", STATUS_CQL_PORT_CONFLICT); }
- installerInfo.gossipPort = getPort(cmdLine, "storage-port", defaultStoragePort); - if (isPortBound(installerInfo.hostname, installerInfo.gossipPort, "storage-port")) { - throw new StorageInstallerException("The storage-port (" + installerInfo.gossipPort + ") is already in use. " + - "Installation cannot proceed.", STATUS_GOSSIP_PORT_CONFLICT); + installerInfo.gossipPort = getPort(cmdLine, OPTION_GOSSIP_PORT, defaultGossipPort); + if (isPortBound(installerInfo.hostname, installerInfo.gossipPort, OPTION_GOSSIP_PORT)) { + throw new StorageInstallerException("The gossip-port (" + installerInfo.gossipPort + + ") is already in use. " + "Installation cannot proceed.", STATUS_GOSSIP_PORT_CONFLICT); }
deploymentOptions.setCommitLogDir(commitlogDir); // TODO add support for specifying multiple dirs deploymentOptions.setDataDir(dataDirFile.getAbsolutePath()); deploymentOptions.setSavedCachesDir(savedCachesDir); + deploymentOptions.setLogFileName(installerInfo.logFile.getPath()); deploymentOptions.setLoggingLevel("INFO"); - deploymentOptions.setRpcPort(rpcPort); - deploymentOptions.setNativeTransportPort(installerInfo.cqlPort); - deploymentOptions.setStoragePort(installerInfo.gossipPort); - deploymentOptions.setSslStoragePort(getPort(cmdLine, "ssl-storage-port", sslStoragePort));
+ deploymentOptions.setRpcPort(rpcPort); + deploymentOptions.setCqlPort(installerInfo.cqlPort); + deploymentOptions.setGossipPort(installerInfo.gossipPort); deploymentOptions.setJmxPort(installerInfo.jmxPort); - deploymentOptions.setHeapSize(cmdLine.getOptionValue("heap-size", defaultHeapSize)); - deploymentOptions.setHeapNewSize(cmdLine.getOptionValue("heap-new-size", defaultHeapNewSize)); - if (cmdLine.hasOption("stack-size")) { - deploymentOptions.setStackSize(cmdLine.getOptionValue("stack-size")); - }
+ deploymentOptions.setHeapSize(cmdLine.getOptionValue(OPTION_HEAP_SIZE, defaultHeapSize)); + deploymentOptions.setHeapNewSize(cmdLine.getOptionValue(OPTION_HEAP_NEW_SIZE, defaultHeapNewSize)); + if (cmdLine.hasOption(OPTION_STACK_SIZE)) { + deploymentOptions.setStackSize(cmdLine.getOptionValue(OPTION_STACK_SIZE)); + }
// The out of box default for native_transport_max_threads is 128. We default // to 64 for dev/test environments so we need to update it here. deploymentOptions.setNativeTransportMaxThreads(128);
- deploymentOptions.setHeapSize(cmdLine.getOptionValue("heap-size", defaultHeapSize)); - deploymentOptions.setHeapNewSize(cmdLine.getOptionValue("heap-new-size", defaultHeapNewSize)); - - if (cmdLine.hasOption("stack-size")) { - deploymentOptions.setStackSize(cmdLine.getOptionValue("stack-size")); - } - deploymentOptions.load();
List<String> errors = new ArrayList<String>(); - checkPerms(options.getOption("saved-caches"), savedCachesDir, errors); - checkPerms(options.getOption("commitlog"), commitlogDir, errors); - checkPerms(options.getOption("data"), dataDir, errors); + checkPerms(options.getOption(OPTION_SAVED_CACHES), savedCachesDir, errors); + checkPerms(options.getOption(OPTION_COMMITLOG), commitlogDir, errors); + checkPerms(options.getOption(OPTION_DATA), dataDir, errors);
if (!errors.isEmpty()) { log.error("Problems have been detected with one or more of the directories in which the storage " @@ -419,11 +426,12 @@ public class StorageInstaller { for (String error : errors) { log.error(error); } - throw new StorageInstallerException("Installation cannot proceed. There are problems with one or more of " + - "the storage data directories.", STATUS_INVALID_FILE_PERMISSIONS); + throw new StorageInstallerException( + "Installation cannot proceed. There are problems with one or more of " + + "the storage data directories.", STATUS_INVALID_FILE_PERMISSIONS); }
- Deployer deployer = new Deployer(); + Deployer deployer = getDeployer(); deployer.setDeploymentOptions(deploymentOptions); storageBasedir.mkdirs(); deployer.unzipDistro(); @@ -439,11 +447,19 @@ public class StorageInstaller { throw new StorageInstallerException("The upgrade cannot proceed. An unexpected I/O error occurred", e, STATUS_IO_ERROR); } catch (DeploymentException e) { - throw new StorageInstallerException("The installation cannot proceed. An error occurred during storage " + - "node deployment.", e, STATUS_DEPLOYMENT_ERROR); + throw new StorageInstallerException("The installation cannot proceed. An error occurred during storage " + + "node deployment.", e, STATUS_DEPLOYMENT_ERROR); } }
+ /** + * This can be overridden to allow for custom deploy behavior. + * @return a Deployer + */ + protected Deployer getDeployer() { + return new Deployer(); + } + private InstallerInfo upgrade(File upgradeFromDir) throws StorageInstallerException { DeploymentOptionsFactory factory = new DeploymentOptionsFactory(); DeploymentOptions deploymentOptions = factory.newDeploymentOptions(); @@ -454,16 +470,16 @@ public class StorageInstaller { if (!upgradeFromDir.isDirectory()) { log.error("The value passed to the upgrade option is not a directory. The value must be a valid " + "path that points to the base directory of an existing RHQ server installation."); - throw new StorageInstallerException("The upgrade cannot proceed. The value passed to the upgrade option " + - "is invalid.", STATUS_INVALID_UPGRADE); + throw new StorageInstallerException("The upgrade cannot proceed. The value passed to the upgrade option " + + "is invalid.", STATUS_INVALID_UPGRADE); } existingStorageDir = new File(upgradeFromDir, "rhq-storage"); if (!(existingStorageDir.exists() && existingStorageDir.isDirectory())) { log.error(existingStorageDir + " does not appear to be an existing RHQ storage node installation. " + "Check the value that was passed to the upgrade option and make sure it specifies the base " + "directory of an existing RHQ server installation."); - throw new StorageInstallerException("The upgrade cannot proceed. " + existingStorageDir + " is not an " + - "existing RHQ storage node installation", STATUS_INVALID_UPGRADE); + throw new StorageInstallerException("The upgrade cannot proceed. " + existingStorageDir + " is not an " + + "existing RHQ storage node installation", STATUS_INVALID_UPGRADE); }
try { @@ -540,8 +556,8 @@ public class StorageInstaller {
return installerInfo; } catch (DeploymentException e) { - throw new StorageInstallerException("THe upgrade cannot proceed. An error occurred during the storage " + - "node deployment", e, STATUS_DEPLOYMENT_ERROR); + throw new StorageInstallerException("THe upgrade cannot proceed. An error occurred during the storage " + + "node deployment", e, STATUS_DEPLOYMENT_ERROR); } catch (IOException e) { throw new StorageInstallerException("The upgrade cannot proceed. An unexpected I/O error occurred", e, STATUS_IO_ERROR); @@ -852,7 +868,7 @@ public class StorageInstaller { throw new RuntimeException("Cannot determine JMX port"); }
- jmxPort = jmxPort.replaceAll(""",""); + jmxPort = jmxPort.replaceAll(""", "");
return Integer.parseInt(jmxPort); } catch (IOException e) { @@ -895,8 +911,8 @@ public class StorageInstaller {
public Options getHelpOptions() { Options helpOptions = new Options(); - for (Option option : (Collection<Option>)options.getOptions()) { - if (option.getLongOpt().equals(VERIFY_DATA_DIRS_EMPTY)) { + for (Option option : (Collection<Option>) options.getOptions()) { + if (option.getLongOpt().equals(OPTION_VERIFY_DATA_DIRS_EMPTY)) { continue; } helpOptions.addOption(option); diff --git a/modules/common/cassandra-installer/src/test/java/org/rhq/storage/installer/StorageInstallerTest.java b/modules/common/cassandra-installer/src/test/java/org/rhq/storage/installer/StorageInstallerTest.java index dff74bf..fab1a9f 100644 --- a/modules/common/cassandra-installer/src/test/java/org/rhq/storage/installer/StorageInstallerTest.java +++ b/modules/common/cassandra-installer/src/test/java/org/rhq/storage/installer/StorageInstallerTest.java @@ -1,6 +1,5 @@ package org.rhq.storage.installer;
- import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; @@ -28,6 +27,8 @@ import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test;
import org.rhq.cassandra.CassandraClusterManager; +import org.rhq.cassandra.Deployer; +import org.rhq.cassandra.DeploymentException; import org.rhq.cassandra.util.ConfigEditor; import org.rhq.core.util.MessageDigestGenerator; import org.rhq.core.util.file.FileUtil; @@ -68,7 +69,7 @@ public class StorageInstallerTest {
storageDir = new File(serverDir, "rhq-storage");
- installer = new StorageInstaller(); + installer = new SafeStorageInstaller(); }
@AfterMethod(alwaysRun = true) @@ -134,7 +135,7 @@ public class StorageInstallerTest { assertEquals(yamlEditor.getAuthenticator(), "org.apache.cassandra.auth.PasswordAuthenticator", "The authenticator property is wrong"); assertEquals(yamlEditor.getListenAddress(), address, "The listen_address property is wrong"); - assertEquals(yamlEditor.getNativeTransportPort(), (Integer) 9142, "The native_transport_port property is wrong"); + assertEquals(yamlEditor.getNativeTransportPort(), (Integer) 9142, "The native_transport_port property is wrong"); assertEquals(yamlEditor.getRpcAddress(), address, "The rpc_address property is wrong"); assertEquals(yamlEditor.getStoragePort(), (Integer) 7100, "The storage_port property is wrong");
@@ -154,7 +155,7 @@ public class StorageInstallerTest { CommandLineParser parser = new PosixParser(); File defaultInstallDir = new File(basedir.getParentFile(), "performDefaultInstall"); File upgradeFromServerDir = new File(defaultInstallDir, "rhq-server"); - String[] args = {"--upgrade", upgradeFromServerDir.getAbsolutePath()}; + String[] args = { "--upgrade", upgradeFromServerDir.getAbsolutePath() }; CommandLine cmdLine = parser.parse(installer.getOptions(), args);
int status = installer.run(cmdLine); @@ -204,7 +205,7 @@ public class StorageInstallerTest { assertEquals(yamlEditor.getAuthenticator(), "org.apache.cassandra.auth.PasswordAuthenticator", "The authenticator property is wrong"); assertEquals(yamlEditor.getListenAddress(), address, "The listen_address property is wrong"); - assertEquals(yamlEditor.getNativeTransportPort(), (Integer) 9142, "The native_transport_port property is wrong"); + assertEquals(yamlEditor.getNativeTransportPort(), (Integer) 9142, "The native_transport_port property is wrong"); assertEquals(yamlEditor.getRpcAddress(), address, "The rpc_address property is wrong"); assertEquals(yamlEditor.getStoragePort(), (Integer) 7100, "The storage_port property is wrong");
@@ -221,7 +222,7 @@ public class StorageInstallerTest {
@Test public void performValidInstallWithOutputToStderr() throws Exception { - installer = new StorageInstaller() { + installer = new SafeStorageInstaller() { @Override protected void exec(Executor executor, org.apache.commons.exec.CommandLine cmdLine) throws IOException { executor.execute(cmdLine, ImmutableMap.of("JAVA_TOOL_OPTIONS", "-Dfile.encoding=UTF8")); @@ -247,7 +248,8 @@ public class StorageInstallerTest { serverSocket.bind(new InetSocketAddress(address, 7799));
CommandLineParser parser = new PosixParser(); - CommandLine cmdLine = parser.parse(installer.getOptions(), new String[] {"--jmx-port", "7799"}); + CommandLine cmdLine = parser.parse(installer.getOptions(), + new String[] { "--rhq.storage.jmx-port", "7799" });
int status = installer.run(cmdLine);
@@ -268,7 +270,8 @@ public class StorageInstallerTest { serverSocket.bind(new InetSocketAddress(address, 9342));
CommandLineParser parser = new PosixParser(); - CommandLine cmdLine = parser.parse(installer.getOptions(), new String[] {"--client-port", "9342"}); + CommandLine cmdLine = parser.parse(installer.getOptions(), + new String[] { "--rhq.storage.cql-port", "9342" });
int status = installer.run(cmdLine);
@@ -284,15 +287,11 @@ public class StorageInstallerTest { public void performValidInstall() throws Exception { CommandLineParser parser = new PosixParser();
- String[] args = { - "--dir", storageDir.getAbsolutePath(), - "--commitlog", new File(storageDir, "commit_log").getAbsolutePath(), - "--data", new File(storageDir, "data").getAbsolutePath(), - "--saved-caches", new File(storageDir, "saved_caches").getAbsolutePath(), - "--heap-size", "256M", - "--heap-new-size", "64M", - "--hostname", "127.0.0.1" - }; + String[] args = { "--dir", storageDir.getAbsolutePath(), "--rhq.storage.commitlog", + new File(storageDir, "commit_log").getAbsolutePath(), "--rhq.storage.data", + new File(storageDir, "data").getAbsolutePath(), "--rhq.storage.saved-caches", + new File(storageDir, "saved_caches").getAbsolutePath(), "--rhq.storage.heap-size", "256M", + "--rhq.storage.heap-new-size", "64M", "--rhq.storage.hostname", "127.0.0.1" };
CommandLine cmdLine = parser.parse(installer.getOptions(), args); int status = installer.run(cmdLine); @@ -331,19 +330,16 @@ public class StorageInstallerTest { File oldLog4JFile = new File(rhq48StorageConfDir, "log4j-server.properties");
rhq48StorageConfDir.mkdirs(); - StreamUtil.copy(getClass().getResourceAsStream("/rhq48/storage/conf/cassandra.yaml"), - new FileOutputStream(oldCassandraYamlFile), true); - StreamUtil.copy(getClass().getResourceAsStream("/rhq48/storage/conf/cassandra-env.sh"), - new FileOutputStream(oldCassandraEnvFile)); + StreamUtil.copy(getClass().getResourceAsStream("/rhq48/storage/conf/cassandra.yaml"), new FileOutputStream( + oldCassandraYamlFile), true); + StreamUtil.copy(getClass().getResourceAsStream("/rhq48/storage/conf/cassandra-env.sh"), new FileOutputStream( + oldCassandraEnvFile)); StreamUtil.copy(getClass().getResourceAsStream("/rhq48/storage/conf/log4j-server.properties"), new FileOutputStream(oldLog4JFile));
CommandLineParser parser = new PosixParser();
- String[] args = { - "--upgrade", rhq48ServerDir.getAbsolutePath(), - "--dir", storageDir.getAbsolutePath() - }; + String[] args = { "--upgrade", rhq48ServerDir.getAbsolutePath(), "--dir", storageDir.getAbsolutePath() };
CommandLine cmdLine = parser.parse(installer.getOptions(), args); int status = installer.run(cmdLine); @@ -383,8 +379,8 @@ public class StorageInstallerTest {
// If this check fails, make sure that the expected value matches the value in // src/test/resources/rhq48/storage/conf/cassandra-env.sh - assertEquals(properties.getProperty("jmx_port"), "7399", "Failed to update the JMX port in " + - cassandraJvmPropsFile); + assertEquals(properties.getProperty("jmx_port"), "7399", "Failed to update the JMX port in " + + cassandraJvmPropsFile);
File yamlFile = new File(confDir, "cassandra.yaml"); ConfigEditor newYamlEditor = new ConfigEditor(yamlFile); @@ -395,8 +391,8 @@ public class StorageInstallerTest {
assertEquals(newYamlEditor.getInternodeAuthenticator(), "org.rhq.cassandra.auth.RhqInternodeAuthenticator", "Failed to set the internode_authenticator property in " + yamlFile); - assertEquals(newYamlEditor.getAuthenticator(), oldYamlEditor.getAuthenticator(), "The authenticator property " + - "is wrong"); + assertEquals(newYamlEditor.getAuthenticator(), oldYamlEditor.getAuthenticator(), "The authenticator property " + + "is wrong"); assertEquals(newYamlEditor.getCommitLogDirectory(), oldYamlEditor.getCommitLogDirectory(), "The commit_log property is wrong"); assertEquals(newYamlEditor.getDataFileDirectories(), oldYamlEditor.getDataFileDirectories(), @@ -405,8 +401,7 @@ public class StorageInstallerTest { "The listen_address property is wrong"); assertEquals(newYamlEditor.getNativeTransportPort(), oldYamlEditor.getNativeTransportPort(), "The native_transport_port property is wrong"); - assertEquals(newYamlEditor.getRpcAddress(), oldYamlEditor.getRpcAddress(), - "The rpc_address property is wrong"); + assertEquals(newYamlEditor.getRpcAddress(), oldYamlEditor.getRpcAddress(), "The rpc_address property is wrong"); assertEquals(newYamlEditor.getSavedCachesDirectory(), oldYamlEditor.getSavedCachesDirectory(), "The saved_caches_directory property is wrong"); assertEquals(newYamlEditor.getStoragePort(), oldYamlEditor.getStoragePort(), @@ -439,4 +434,24 @@ public class StorageInstallerTest { assertEquals(properties.getProperty("rhq.storage.cql-port"), "9142"); }
+ private static class SafeStorageInstaller extends StorageInstaller { + + @Override + protected Deployer getDeployer() { + return new SafeDeployer(); + } + } + + private static class SafeDeployer extends Deployer { + + @Override + public void applyChangesToWindowsServiceWrapper(File deployDir) throws DeploymentException { + // Not every test env will have this file set up. If it doesn't exist just skip this. + File wrapperDir = new File(deployDir, "../bin/wrapper"); + File wrapperEnvFile = new File(wrapperDir, "rhq-storage-wrapper.env"); + if (wrapperEnvFile.isFile()) { + super.applyChangesToWindowsServiceWrapper(deployDir); + } + } + } } 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 1f28f14..41e8931 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 @@ -818,8 +818,8 @@ rhq.storage.nodes= # and used by the RHQ server(s) to communicate with the cluster. # Both properties are required. # -rhq.storage.cql-port=${rhq.cassandra.native-transport-port} -rhq.storage.gossip-port=${rhq.cassandra.storage.port} +rhq.storage.cql-port=${rhq.storage.cql-port} +rhq.storage.gossip-port=${rhq.storage.gossip-port}
# If enabled data sent to and from storage nodes will be compressed using # snappy (https://code.google.com/p/snappy) compression. Note that this is an @@ -832,7 +832,7 @@ rhq.storage.gossip-port=${rhq.cassandra.storage.port} # # Please make sure you do not find the above log statement in your storage logs # before you enable client compression. -# rhq.cassandra.client.compression-enabled=false +# rhq.storage.client.compression-enabled=false </echo>
<echo file="${rhq.bin.dir}/rhq-storage.properties">#################### RHQ Storage Configuration Properties #################### @@ -847,7 +847,7 @@ rhq.storage.gossip-port=${rhq.cassandra.storage.port} ############################################################################# # Data Directory Settings # ----------------- -# Note, the RHQ_HOME directory as used below is the parent directory +# The RHQ_HOME directory as used below is the parent directory # of the RHQ server installation. It is recommended that RHQ be installed # under an umbrella "rhq" directory. For example, if using a home directory # of /opt/rhq then the default installation structure would be: @@ -860,81 +860,99 @@ rhq.storage.gossip-port=${rhq.cassandra.storage.port} # /opt/rhq/rhq-data/storage/data # /opt/rhq/rhq-data/storage/saved_caches # -# commitlog The directory where the storage node keeps commit log files. +# IMPORTANT: Always use forward slashes in the directory path names, even +# on Windows! +# +# IMPORTANT: If using non-default settings for the data, commitlog, and/or +# saved-caches directories, each directory should be unique, +# typically under a common parent. +# +# rhq.storage.commitlog +# The directory where the storage node keeps commit log files. # Defaults to: RHQ_HOME/rhq-data/storage/commitlog -# data The directory where the storage node keeps data files. +# rhq.storage.data +# The directory where the storage node keeps data files. # Defaults to: RHQ_HOME/rhq-data/storage/data -# saved-caches The directory where the storage node keeps saved cache files. +# rhq.storage.saved-caches +# The directory where the storage node keeps saved cache files. # Defaults to: RHQ_HOME/rhq-data/storage/saved_caches ############################################################################# -${comment}commitlog=${rhq.storage.commitlog} -${comment}data=${rhq.storage.data} -${comment}saved-caches=${rhq.storage.saved-caches} +${comment}rhq.storage.commitlog=${rhq.storage.commitlog} +${comment}rhq.storage.data=${rhq.storage.data} +${comment}rhq.storage.saved-caches=${rhq.storage.saved-caches}
############################################################################# # Heap/Memory Settings # ----------------- # -# heap-size The value to use for both the min and max heap. This value is +# rhq.storage.heap-size +# The value to use for both the min and max heap. This value is # passed directly to the -Xms and -Xmx options of the Java # executable. # Defaults to 512M. -# heap-new-size The value to use for the new generation of the heap. This +# rhq.storage.heap-new-size +# The value to use for the new generation of the heap. This # value is passed directly to the -Xmn option of the Java # executable. -# Defaults to 256M. -# stack-size The value to use for the thread stack size. This value is +# Defaults to 128M. +# rhq.storage.stack-size +# The value to use for the thread stack size. This value is # passed directly to the -Xss option of the Java executable. # Defaults to 256k. ############################################################################# -${comment}heap-size=${rhq.storage.heap-size} -${comment}heap-new-size=${rhq.storage.heap-new-size} -#stack-size= +${comment}rhq.storage.heap-size=${rhq.storage.heap-size} +${comment}rhq.storage.heap-new-size=${rhq.storage.heap-new-size} +#rhq.storage.stack-size=
############################################################################# # Port Settings # ----------------- # -# client-port The port on which to listen for client requests. -# Defaults to 9142 -# jmx-port The port on which to listen for JMX connections. +# rhq.storage.cql-port +# The port on which to listen for client requests. +# Defaults to 9142. +# rhq.storage.jmx-port +# The port on which to listen for JMX connections. # Defaults to 7299. -# storage-port The port on which to listen for requests from other nodes. -# Defaults to 7100 -# ssl-storage-port The port on which to listen for encrypted requests from -# other nodes. Only used when encryption is enabled. -# Defaults to 7101 +# rhq.storage.gossip-port +# The port on which to listen for requests from other nodes. +# Defaults to 7100. ############################################################################# -#client-port= -${comment}jmx-port=${rhq.storage.jmx-port} -#storage-port= -#ssl-storage-port= +#rhq.storage.cql-port= +${comment}rhq.storage.jmx-port=${rhq.storage.jmx-port} +#rhq.storage.gossip-port=
############################################################################# # Address/Host Settings # ----------------- # -# hostname The hostname or IP address on which the node will listen +# rhq.storage.hostname +# The hostname or IP address on which the node will listen # for requests. -# Defaults to the hostname for localhost. -# seeds A comma-delimited list of hostnames or IP addresses that +# Defaults to this node's hostname. +# rhq.storage.seeds +# A comma-delimited list of hostnames or IP addresses that # serve as contact points. Nodes use this list to find each # other and to learn the cluster topology. It does not need # to specify all nodes in the cluster. # Defaults to this node's hostname. ############################################################################# -${comment}hostname=${rhq.storage.hostname} -${comment}seeds=${rhq.storage.seeds} +${comment}rhq.storage.hostname=${rhq.storage.hostname} +${comment}rhq.storage.seeds=${rhq.storage.seeds}
############################################################################# # Advanced Settings # ----------------- # -# verify-data-dirs-empty If true then allow installation only when the data -# directories are empty. Only upgrade is allowed. +# rhq.storage.verify-data-dirs-empty +# If true then allow installation only when the data +# directories are empty. Typically set true only in +# development environments when it may be useful to +# perform a clean installation while maintaining +# existing data. Defaults to true. # Defaults to true. ############################################################################# -${comment}verify-data-dirs-empty=${rhq.storage.verify-data-dirs-empty} +${comment}rhq.storage.verify-data-dirs-empty=${rhq.storage.verify-data-dirs-empty} </echo>
</target> diff --git a/modules/enterprise/server/appserver/src/main/scripts/storage_setup.groovy b/modules/enterprise/server/appserver/src/main/scripts/storage_setup.groovy index c20e0ed..7cdbf9e 100644 --- a/modules/enterprise/server/appserver/src/main/scripts/storage_setup.groovy +++ b/modules/enterprise/server/appserver/src/main/scripts/storage_setup.groovy @@ -89,15 +89,15 @@ def createStoragePropertiesFile(basedir, nodeId) {
propsFile.withWriter { writer -> writer.write("""# storage installer options for dev deployment -commitlog=${dataRootDir}/storage-$nodeId/commit_log -data=${dataRootDir}/storage-$nodeId/data -saved-caches=${dataRootDir}/storage-$nodeId/saved_caches -heap-size=${heapSize} -heap-new-size=${heapNewSize} -hostname=127.0.0.$nodeId -jmx-port=${defaultJmxPort + (nodeId - 1)} -seeds=${seeds} -verify-data-dirs-empty=false +rhq.storage.commitlog=${dataRootDir}/storage-$nodeId/commit_log +rhq.storage.data=${dataRootDir}/storage-$nodeId/data +rhq.storage.saved-caches=${dataRootDir}/storage-$nodeId/saved_caches +rhq.storage.heap-size=${heapSize} +rhq.storage.heap-new-size=${heapNewSize} +rhq.storage.hostname=127.0.0.$nodeId +rhq.storage.jmx-port=${defaultJmxPort + (nodeId - 1)} +rhq.storage.seeds=${seeds} +rhq.storage.verify-data-dirs-empty=false """ ) } diff --git a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Upgrade.java b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Upgrade.java index 1d2f817..1dc2758 100644 --- a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Upgrade.java +++ b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Upgrade.java @@ -485,6 +485,12 @@ public class Upgrade extends AbstractInstall { oldServerProps.setProperty("rhq.storage.cql-port", cqlPort); }
+ String storageCompression = oldServerProps.getProperty("rhq.cassandra.client.compression-enabled"); + if (storageCompression != null) { + oldServerProps.remove("rhq.cassandra.client.compression-enabled"); + oldServerProps.setProperty("rhq.storage.client.compression-enabled", storageCompression); + } + // copy the old key/truststore files from the old location to the new server configuration directory copyReferredFile(commandLine, oldServerProps, "rhq.server.tomcat.security.keystore.file"); copyReferredFile(commandLine, oldServerProps, "rhq.server.tomcat.security.truststore.file"); diff --git a/modules/plugins/rhq-storage/src/test/java/org/rhq/plugins/storage/StorageNodeComponentITest.java b/modules/plugins/rhq-storage/src/test/java/org/rhq/plugins/storage/StorageNodeComponentITest.java index f716ddb..bae3c1d 100644 --- a/modules/plugins/rhq-storage/src/test/java/org/rhq/plugins/storage/StorageNodeComponentITest.java +++ b/modules/plugins/rhq-storage/src/test/java/org/rhq/plugins/storage/StorageNodeComponentITest.java @@ -113,8 +113,8 @@ public class StorageNodeComponentITest { deploymentOptions.setSavedCachesDir(new File(basedir, "saved_caches").getAbsolutePath()); deploymentOptions.setCommitLogDir(new File(basedir, "logs").getAbsolutePath()); deploymentOptions.setLoggingLevel("DEBUG"); - deploymentOptions.setStoragePort(7200); - deploymentOptions.setNativeTransportPort(9142); + deploymentOptions.setGossipPort(7200); + deploymentOptions.setCqlPort(9142); deploymentOptions.setJmxPort(7399); deploymentOptions.setHeapSize("256M"); deploymentOptions.setHeapNewSize("64M"); @@ -309,8 +309,8 @@ public class StorageNodeComponentITest { deploymentOptions.setSavedCachesDir(new File(node2Basedir, "saved_caches").getAbsolutePath()); deploymentOptions.setCommitLogDir(new File(node2Basedir, "logs").getAbsolutePath()); deploymentOptions.setLoggingLevel("DEBUG"); - deploymentOptions.setStoragePort(7200); - deploymentOptions.setNativeTransportPort(9142); + deploymentOptions.setGossipPort(7200); + deploymentOptions.setCqlPort(9142); deploymentOptions.setJmxPort(7400); deploymentOptions.setHeapSize("256M"); deploymentOptions.setHeapNewSize("64M");
rhq-commits@lists.fedorahosted.org