Skip to content

Instantly share code, notes, and snippets.

View rsds143's full-sized avatar

rsds143

View GitHub Profile
@rsds143
rsds143 / cleanup_dse.sh
Last active August 29, 2015 14:05
clean up cassandra data direction on all nodes
#!/bin/bash
hosts = 10.1.10.200,10.1.10.201,10.1.10.202
dse_location = "/opt/dse-4.5.1"
for HOST in $hosts
do
ssh root@%HOST '$dse_location/bin/dse cassandra-stop'
ssh root@$HOST 'rm -fr /var/lib/cassandra'
done
@rsds143
rsds143 / Vagrantfile
Last active August 29, 2015 14:05
Vagrantfile add provisioning joy
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
# Configurate the virtual machine to use 4GB of RAM
@rsds143
rsds143 / fix_rpc_address.sh
Last active August 29, 2015 14:05
script to fix broken cassandra.yaml
#!/bin/bash
hostList=($(cat hostfile_from_csshx))
for host in $hostList
do
ssh $host "sed -i s/0.0.0.0/$host/g /opt/dse-4.5.1/resources/cassandra/conf/cassandra.yaml"
done
@rsds143
rsds143 / Vagrant_file_dse_spark
Last active August 29, 2015 14:06
Vagrant file to inline configure a 2 node dse spark cluster.
VAGRANTFILE_API_VERSION = "2"
# -*- mode: ruby -*-
# # vi: set ft=ruby :
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
@rsds143
rsds143 / counter_replacement.scala
Last active August 29, 2015 14:07
counter replacement
/*
* Copyright 2014 Ryan Svihla
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
log-slow-queries=/var/log/whereever/slow_queries.log
long_query_time = 1 #one second
log-queries-not-using-indexes
@rsds143
rsds143 / c3p0.hibernate.cfg.xml
Created June 26, 2010 13:44
java jdbc c3po config with connection provider
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
@rsds143
rsds143 / default_build.xml
Created June 26, 2010 15:03
default apache ivy setup
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="whatever">
<property name="hibernate.version" value="3.5.6-Final"/>
<!-- =================================
target: resolve
================================= -->
<target name="resolve" description="--> retrieve dependencies with ivy">
<ivy:retrieve />
</target>
</project>
#!/usr/bin/env ruby
f = File.new ARGV[0]
lineend = ARGV[1].to_i
counter = 0
while(line = f.gets and counter<lineend)
puts line
counter += 1
end
f.close()
INSERT INTO work_queue (work_id, work, status) values ( 100898, 'data to process', 'PENDING')
--against a bunch of separate servers because of sharding and probably done in a batch job
-- not at write time as that may take minutes
SELECT count(*) FROM work_queue where status='PENDING'
--against yet another server again because of sharding
INSERT INTO work_counts ( status, count) values ( 'PENDING', 1298008)