Skip to content

Commit

Permalink
Merge pull request #245 from metlos/bug/HWKMETRICS-120
Browse files Browse the repository at this point in the history
[HWKMETRICS-120] Start Thrift Server in embedded Cassandra service.
  • Loading branch information
Stefan Negrea committed Jun 5, 2015
2 parents 4fadd57 + 167f7a8 commit cd8e2b3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
6 changes: 0 additions & 6 deletions embedded-cassandra/embedded-cassandra-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@
<groupId>org.apache.cassandra</groupId>
<artifactId>cassandra-all</artifactId>
<version>2.1.1</version>
<exclusions>
<exclusion>
<groupId>com.thinkaurelius.thrift</groupId>
<artifactId>thrift-server</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- Wildfly provided -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,8 @@
*/
package org.hawkular.metrics.embedded;

import static java.util.Arrays.asList;
import static org.hawkular.metrics.embedded.EmbeddedConstants.CASSANDRA_CONFIG;
import static org.hawkular.metrics.embedded.EmbeddedConstants.CASSANDRA_LISTEN_ADDRESS_DEFAULT;
import static org.hawkular.metrics.embedded.EmbeddedConstants.CASSANDRA_NATIVE_PORT_DEFAULT;
import static org.hawkular.metrics.embedded.EmbeddedConstants.CASSANDRA_YAML;
import static org.hawkular.metrics.embedded.EmbeddedConstants.JBOSS_DATA_DIR;
import static org.hawkular.metrics.embedded.EmbeddedConstants.HAWKULAR_METRICS;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;

import java.io.File;
import java.io.FileInputStream;
Expand All @@ -32,8 +27,13 @@
import java.util.List;
import java.util.Map;

import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
import static java.util.Arrays.asList;
import static org.hawkular.metrics.embedded.EmbeddedConstants.CASSANDRA_CONFIG;
import static org.hawkular.metrics.embedded.EmbeddedConstants.CASSANDRA_LISTEN_ADDRESS_DEFAULT;
import static org.hawkular.metrics.embedded.EmbeddedConstants.CASSANDRA_NATIVE_PORT_DEFAULT;
import static org.hawkular.metrics.embedded.EmbeddedConstants.CASSANDRA_YAML;
import static org.hawkular.metrics.embedded.EmbeddedConstants.HAWKULAR_METRICS;
import static org.hawkular.metrics.embedded.EmbeddedConstants.JBOSS_DATA_DIR;

/**
* @author Stefan Negrea
Expand Down Expand Up @@ -101,7 +101,7 @@ public void initEmbeddedConfiguration() throws Exception {
this.setKeyCacheSizeMb(getDefaultKeyCacheSize());
this.setNativeTransportMaxThreads(4);
this.setCompactionThroughputMbPerSec(0);
this.setStartRpc(false);
this.setStartRpc(true);
this.setHintedHandoffEnabled(false);
this.setNumTokens(1);
this.setRpcServerType("hsha");
Expand Down Expand Up @@ -136,7 +136,7 @@ public void initEmbeddedConfiguration() throws Exception {
// set system properties
System.setProperty(CASSANDRA_CONFIG, yamlFile.toURI().toURL().toString());
System.setProperty("cassandra.skip_wait_for_gossip_to_settle", "0");
System.setProperty("cassandra.start_rpc", "false");
System.setProperty("cassandra.start_rpc", "true");
}

public void save() throws IOException {
Expand Down Expand Up @@ -287,4 +287,4 @@ private int getDefaultKeyCacheSize() {
// cache size defaults to min(1% of Heap (in MB), 10 MB)
return Math.min(Math.max(1, (int) (Runtime.getRuntime().totalMemory() * 0.01 / 1024 / 1024)), 10);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ rpc_address: 127.0.0.1
rpc_keepalive: true
rpc_port: 9160
rpc_server_type: sync
# these 2 are important for hsha - with the max threads unset, there is a likelihood of OOMs because the
# thrift server tries to start an ungodly number of threads (MAX_INT / number of cores)
rpc_min_threads: 16
rpc_max_threads: 1024
seed_provider:
- class_name: org.apache.cassandra.locator.SimpleSeedProvider
parameters:
Expand Down

0 comments on commit cd8e2b3

Please sign in to comment.