#!/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
Tuesday, 27 January 2015
Cassandra: links to snapshots in one place
Use rsync with '-L' to copy elsewhere.
Subscribe to:
Post Comments (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...
-
kubectl --cert=/tmp/tls.crt --key=/tmp/tls.key create secret tls tls-wc-ingress
-
apt-get install exim4 dpkg-reconfigure exim4-config Select: internet site; mail is sent and received directly using SMTP IP-addresses...
-
NOTE: unbound is now available via epel repo on Amazon Linux install requirements yum groupinstall "Development Tools" yum i...
No comments:
Post a Comment
Note: only a member of this blog may post a comment.