Created
September 13, 2010 18:54
-
-
Save grantr/577798 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if node[:ec2][:ephemeral][:devices].include?("/dev/sdd") | |
# if we also have sdd and sde, raid0 them and put data there | |
data_raid_block_devs = [ "/dev/sdd", "/dev/sde" ] | |
data_raid_mountpoint = "/mnt/cassandra_data" | |
data_raid_dev = "/dev/md0" | |
data_file_dir = Array(node[:cassandra][:data_file_dirs]).first | |
package "mdadm" do | |
action :install | |
end | |
mdadm data_raid_dev do | |
devices data_raid_block_devs | |
level 0 | |
chunk 128 | |
action [ :create, :assemble ] | |
end | |
#TODO this doesn't work the first time, maybe mdadm needs a delay? | |
execute "mkfs.xfs -f #{data_raid_dev}" do | |
only_if "xfs_admin -l #{data_raid_dev} 2>&1 | grep -qx 'xfs_admin: #{data_raid_dev} is not a valid XFS filesystem (unexpected SB magic number 0x00000000)'" | |
end | |
#TODO this doesn't get the proper perms, its root/root for some reason | |
directory data_raid_mountpoint do | |
owner "cassandra" | |
group "nogroup" | |
mode 0755 | |
end | |
mount data_raid_mountpoint do | |
device data_raid_dev | |
fstype "xfs" | |
options "noatime" | |
action :mount | |
end | |
directory data_file_dir do | |
owner "cassandra" | |
group "nogroup" | |
mode 0755 | |
end | |
mount data_file_dir do | |
device data_raid_mountpoint | |
fstype "none" | |
options "bind,rw" | |
action :mount | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment