Skip to content

Instantly share code, notes, and snippets.

View jsanda's full-sized avatar

John Sanda jsanda

View GitHub Profile
@jsanda
jsanda / module.xml
Created October 23, 2012 01:53
module file for cassandra jdbc driver
<module xmlns="urn:jboss:module:1.0" name="org.apache-extras.cassandra-jdbc">
<resources>
<resource-root path="cassandra-jdbc-1.2.0-SNAPSHOT.jar"/>
<resource-root path="cassandra-clientutil-1.2.0-beta1.jar"/>
<resource-root path="cassandra-thrift-1.2.0-beta1.jar"/>
<resource-root path="libthrift-0.7.0.jar"/>
<resource-root path="jsr305-1.3.9.jar"/>
<resource-root path="guava-12.0.jar"/>
</resources>
// A Thrift slice query using Hector
SliceQuery<Integer, Long, Double> query = HFactory.createSliceQuery(keyspace, IntegerSerializer.get(),
LongSerializer.get(), DoubleSerializer.get());
query.setColumnFamily(RAW_METRIC_DATA_CF);
query.setKey(scheduleId);
query.setRange(null, null, false, 10);
`
QueryResult<ColumnSlice<Long, Double>> queryResult = query.execute();
List<HColumn<Long, Double>> actual = queryResult.get().getColumns();
@jsanda
jsanda / MyTest.java
Created October 17, 2012 14:10
Automating cassandra cluster deployment for automated testing
@Listeners({CassandraClusterManager.class})
public class MyTest {
@BeforeClass
@DeployCluster(numNodes = 4) // installs, and starts 4 node cluster
public void initCluster() {
...
}
@AfterClass
@jsanda
jsanda / gist:3902258
Created October 16, 2012 21:47
CQL table definition for raw_metrics table
CREATE TABLE raw_metrics (
schedule_id int,
time timestamp,
value double,
PRIMARY KEY (schedule_id, time)
);
CREATE TABLE raw_metrics (
schedule_id int,
time timestamp,
value double,
PRIMARY KEY (schedule_id, time)
);
<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:infinispan:config:5.2 http://www.infinispan.org/schemas/infinispan-config-5.2.xsd"
xmlns="urn:infinispan:config:5.2">
<global>
<transport>
<properties>
<property name="configurationFile" value="jgroups-tcp.xml"/>
</properties>
</transport>
@jsanda
jsanda / gist:3003925
Created June 27, 2012 12:57
/etc/sysctl.conf settings for rhq dev box
# Kernel sysctl configuration file
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.
# Controls IP packet forwarding
net.ipv4.ip_forward = 0
# Controls source route verification
net.ipv4.conf.default.rp_filter = 1
create column family metrics_aggregates_index
with comparator = 'CompositeType(DateType, Int32Type)' and
default_validation_class = Int32Type and
key_validation_class = UTF8Type;
[default@rhq] get one_hour_metric_data[10261];
=> (column=2012-06-14 16:00:00-0400:0, value=8528.610195208777, timestamp=1339707619159001, ttl=1209600)
=> (column=2012-06-14 16:00:00-0400:1, value=7914.6, timestamp=1339707619159002, ttl=1209600)
=> (column=2012-06-14 16:00:00-0400:2, value=8221.605097604388, timestamp=1339707619159000, ttl=1209600)
=> (column=2012-06-14 17:00:00-0400:0, value=80320.63306613911, timestamp=1339711200084005, ttl=1209600)
create column family one_hour_metric_data
with comparator = 'CompositeType(DateType, Int32Type)' and
default_validation_class = DoubleType and
key_validation_class = Int32Type;