#!/usr/bin/ruby
require 'fileutils'
mybasedir = '/var/lib/cass'
mydatadir = mybasedir + '/data'
mysnapshotlinksdir = mybasedir + '/snapshots'
FileUtils.remove_dir(mysnapshotlinksdir) if File.exists?(mysnapshotlinksdir)
Dir.chdir mydatadir
mysnapshotdirs = Dir.glob("**/*/")
mysnapshotdirs = mysnapshotdirs.grep(/snapshots\/.+/)
#p mysnapshotdirs
mysnapshots = {}
mysnapshotdirs.each do |mydir|
mysnapshot = {}
myparts = mydir.split('/')
mysnapshot['keyspace'] = myparts[0]
mysnapshot['cf'] = myparts[1]
mysnapshot['tag'] = myparts[3]
mysnapshot['linkdir'] = [mysnapshotlinksdir, mysnapshot['tag'], mysnapshot['keyspace']].join('/')
mysnapshot['link'] = [mysnapshotlinksdir, mysnapshot['tag'], mysnapshot['keyspace'], mysnapshot['cf']].join('/')
mysnapshot['target'] = [mydatadir, mydir].join('/')
#p mysnapshot
FileUtils.mkpath mysnapshot['linkdir'] unless File.exists?(mysnapshot['linkdir'])
File.symlink(mysnapshot['target'], mysnapshot['link']) unless File.symlink?(mysnapshot['link'])
end
Showing posts with label cassandra. Show all posts
Showing posts with label cassandra. Show all posts
Tuesday, 27 January 2015
Cassandra: links to snapshots in one place
Use rsync with '-L' to copy elsewhere.
Tuesday, 31 December 2013
cassandra sstable version in filename
Look in the filename of the sstable, you'll see some letters between hyphens/dashes, ie "-"; these are the version of your sstable, see below for possible values.
See: https://github.com/QwertyManiac/cassandra-cdh4/blob/master/src/java/org/apache/cassandra/io/sstable/Descriptor.java
Btw, cassandra "support" loves to send you to look at code, so download the code and get familiar with the basic structure (somehow).
See: https://github.com/QwertyManiac/cassandra-cdh4/blob/master/src/java/org/apache/cassandra/io/sstable/Descriptor.java
Btw, cassandra "support" loves to send you to look at code, so download the code and get familiar with the basic structure (somehow).
public static final Version LEGACY = new Version("a"); // "pre-history"
// b (0.7.0): added version to sstable filenames
// c (0.7.0): bloom filter component computes hashes over raw key bytes instead of strings
// d (0.7.0): row size in data component becomes a long instead of int
// e (0.7.0): stores undecorated keys in data and index components
// f (0.7.0): switched bloom filter implementations in data component
// g (0.8): tracks flushed-at context in metadata component
// h (1.0): tracks max client timestamp in metadata component
// hb (1.0.3): records compression ration in metadata component
// hc (1.0.4): records partitioner in metadata component
// hd (1.0.10): includes row tombstones in maxtimestamp
// he (1.1.3): includes ancestors generation in metadata component
// hf (1.1.6): marker that replay position corresponds to 1.1.5+ millis-based id (see CASSANDRA-4782)
// ia (1.2.0): column indexes are promoted to the index file
// records estimated histogram of deletion times in tombstones
// bloom filter (keys and columns) upgraded to Murmur3
// ib (1.2.1): tracks min client timestamp in metadata component
Labels:
cassandra,
sstable,
version,
versioning
Friday, 5 July 2013
apache-cassandra11 conflicts with apache-cassandra11-1.1.11-1.noarch
The Error:
Running rpm_check_debug
ERROR with rpm_check_debug vs depsolve:
apache-cassandra11 conflicts with apache-cassandra11-1.1.11-1.noarch
Solution:
- wget http://rpm.riptano.com/community/noarch/apache-cassandra11-1.1.11-1.noarch.rpm
- rpm -i apache-cassandra11-1.1.11-1.noarch.rpm --nodeps
This might be necessary before step 2, but make sure you back up your data first, even this should not delete it, you never know:
- yum remove apache-cassandra11
Thursday, 16 May 2013
Double looping with bash
Neat:
- for ITEM in $(find /cassandra/data -type d -name snapshots)
- do for DIR in $(find ${ITEM} -maxdepth 1 -mindepth 1 -type d -mtime -1)
- do echo $ITEM $DIR
- done
- done
Friday, 12 April 2013
Cassandra in 30 seconds
- writes
- writes entries directly to disk without checking if they already exist
- does fancy indexing of entries
- returns a write "OK" to the writing client after a quorum of nodes have confirmed
- reads
- tries to return the newest entry when client does a read
- has methods to eventually get the newest entry to return even if old ones still around
- replication
- stores entries to multiple nodes if replication is turned on
- deletes
- doesn't offically delete, just marks dead entries with a "tombstone"
- compaction is what gets rid of old versions of entries and dead entries
- balancing
- automatically fills in data holes if a node disappears
- automatically spreads data if new nodes are added
- resurrection
- 3-nodes: X, Y, Z, all replicate all data
- server X goes down
- delete goes to Y and Z for key A
- Y and Z are "compacted"
- i.e., redundant keys & tombstones cleaned up / removed
- key A is completely gone as far as Y and Z know
- X comes up and has value for key A
- A is back! resurrected from the dead! life sucks.
- NOTE: if Y and Z didn't have tombstones removed, they would have had a date that was more recent than X's key A entry, so they would have invalidated X's key A. But, they are gone after a compaction or cleanup.
Saturday, 23 February 2013
JMX ports to open in firewall for jconsole to Cassandra
- Port 7199
- Used for about a dozen packets when JMX connection first made
- A handshake of sorts
- Probably sets up the agreement on which high port to connect to, used below
- Similar to SIP
- Similar to old FTP
- Not used again after initial handshake
- Port range 55000 to 55999
- To see these packets, on JVM server
- tcpdump -nn ! port 22 and host <jconsole client IP> (not literal, replace this)
- If jconsole starts showing graphs, you are connected
Tricks and Tips
- If you don't want to expose 1000 ports to the world for some reason
- Open all ports on firewall in front of JVM server
- On JVM server: tcpdump -nn ! port 22 and host <jconsole client IP>
- Start jconsole connection on client machine
- Watch to see which port JVM server is trying to reach jconsole client via
- Close all but that port in the firewall, will be between 55000-55999
- Do a local experiment to a local JVM JMX-able application if unsure of good jconsole connection result
- Get your external IP from where you are running jconsole client
- CLI: curl http://ipaddr.me
- Or web browser: http://ipaddr.me
Subscribe to:
Posts (Atom)
Interview questions: 2020-12
Terraform provider vs provisioner Load balancing Network Load Balancer vs Application Load Balancer Networking Layer 1 vs Layer 4 haproxy u...
-
CRITICAL: AWS now offers internal VPC DNS! Below is no longer necessary AFAIK. Woo hoo! http://aws.amazon.com/about-aws/whats-new/2014/...
-
build sudo apt-get install git gcc sudo apt-get install automake autoconf git clone git://github.com/rriley/tsunami-udp.git cd tsunam...
-
From: https://bugs.eclipse.org/bugs/show_bug.cgi?id=382972#c4 Assumptions: jEdit was installed into /Applications directory. Close any...