def format_xfs(devices): # Make sure the device is umounted, then run fdisk on the device logger.info( 'Clear "invalid flag 0x0000 of partition table 4" by issuing a write, then running fdisk on the device...' ) formatCommands = "echo 'd\nn\np\n1\n\n\nt\n83\nw'" logger.exe('sudo umount {0}'.format(devices[0]), expectError=True) logger.pipe("echo 'w'", 'sudo fdisk -c -u {0}'.format(devices[0])) logger.pipe(formatCommands, 'sudo fdisk -c -u {0}'.format(devices[0])) # Create a list of partitions to RAID logger.exe('sudo fdisk -l') partitions = glob.glob('/dev/xvd*[0-9]') if '/dev/xvda1' in partitions: partitions.remove('/dev/xvda1') partitions.sort() logger.info('Formatting the new partition:') logger.exe('sudo mkfs.xfs -f {0}'.format(partitions[0])) # Configure fstab and mount the new formatted device mnt_point = '/mnt' create_cassandra_directories(mnt_point=mnt_point, device=partitions[0]) return mnt_point
def setup_repos(): # Add repos if conf.get_config("AMI", "Type") == "Enterprise": logger.pipe( 'echo "deb http://{0}:{1}@debian.datastax.com/enterprise stable main"' .format(options.username, options.password), 'sudo tee /etc/apt/sources.list.d/datastax.sources.list') else: logger.pipe( 'echo "deb http://debian.datastax.com/community stable main"', 'sudo tee /etc/apt/sources.list.d/datastax.sources.list') # Add repokeys logger.exe( 'sudo apt-key add /home/ubuntu/datastax_ami/repo_keys/DataStax.key') # Perform the install logger.exe('sudo apt-get update') while True: output = logger.exe('sudo apt-get update') if not output[1] and not 'err' in output[0].lower( ) and not 'failed' in output[0].lower(): break time.sleep(5)
def initial_configurations(): # Begin configuration this is only run once in Public Packages if conf.get_config("AMI", "CurrentStatus") != "Complete!": # Configure DataStax variables try: import ds2_configure ds2_configure.run() except: conf.set_config( "AMI", "Error", "Exception seen in %s. Please check ~/datastax_ami/ami.log for more info." % 'ds1_launcher.py') logger.exception('ds1_launcher.py') # Set ulimit hard limits logger.pipe('echo "* soft nofile 32768"', 'sudo tee -a /etc/security/limits.conf') logger.pipe('echo "* hard nofile 32768"', 'sudo tee -a /etc/security/limits.conf') logger.pipe('echo "root soft nofile 32768"', 'sudo tee -a /etc/security/limits.conf') logger.pipe('echo "root hard nofile 32768"', 'sudo tee -a /etc/security/limits.conf') # Change permission back to being ubuntu's and cassandra's logger.exe('sudo chown -hR ubuntu:ubuntu /home/ubuntu') logger.exe('sudo chown -hR cassandra:cassandra /raid0/cassandra', False) logger.exe('sudo chown -hR cassandra:cassandra /mnt/cassandra', False) else: logger.info('Skipping initial configurations.')
def format_xfs(devices): # Make sure the device is umounted, then run fdisk on the device logger.info( 'Clear "invalid flag 0x0000 of partition table 4" by issuing a write, then running fdisk on the device...' ) formatCommands = "echo 'd\nn\np\n1\n\n\nt\n83\nw'" logger.exe('sudo umount {0}'.format(devices[0])) logger.pipe("echo 'w'", 'sudo fdisk -c -u {0}'.format(devices[0])) logger.pipe(formatCommands, 'sudo fdisk -c -u {0}'.format(devices[0])) # Create a list of partitions to RAID logger.exe('sudo fdisk -l') partitions = glob.glob('/dev/xvd*[0-9]') partitions.remove('/dev/xvda1') partitions.sort() logger.info('Formatting the new partition:') logger.exe('sudo mkfs.xfs -f {0}'.format(partitions[0])) # Configure fstab and mount the new formatted device mnt_point = '/mnt' logger.pipe( "echo '{0}\t{1}\txfs\tdefaults,nobootwait,noatime\t0\t0'".format( partitions[0], mnt_point), 'sudo tee -a /etc/fstab') logger.exe('sudo mkdir {0}'.format(mnt_point), False) logger.exe('sudo mount -a') logger.exe('sudo mkdir -p {0}'.format(os.path.join(mnt_point, 'cassandra'))) logger.exe('sudo chown -R cassandra:cassandra {0}'.format( os.path.join(mnt_point, 'cassandra'))) return mnt_point
def mount_raid(devices): # Make sure the devices are umounted, then run fdisk on each device logger.info( 'Clear "invalid flag 0x0000 of partition table 4" by issuing a write, then running fdisk on each device...' ) formatCommands = "echo 'n\np\n1\n\n\nt\nfd\nw'" for device in devices: logger.info('Confirming devices are not mounted:') logger.exe('sudo umount {0}'.format(device), expectError=True) logger.pipe("echo 'w'", 'sudo fdisk -c -u {0}'.format(device)) logger.pipe(formatCommands, 'sudo fdisk -c -u {0}'.format(device)) # Create a list of partitions to RAID logger.exe('sudo fdisk -l') partitions = glob.glob('/dev/xvd*[0-9]') if '/dev/xvda1' in partitions: partitions.remove('/dev/xvda1') partitions.sort() logger.info( 'Partitions about to be added to RAID0 set: {0}'.format(partitions)) # Make sure the partitions are umounted and create a list string partion_list = '' for partition in partitions: logger.info('Confirming partitions are not mounted:') logger.exe('sudo umount ' + partition, expectError=True) partion_list = ' '.join(partitions).strip() logger.info('Creating the RAID0 set:') time.sleep(3) # was at 10 conf.set_config("AMI", "CurrentStatus", "Raid creation") # Continuously create the Raid device, in case there are errors raid_created = False while not raid_created: logger.exe( 'sudo mdadm --create /dev/md0 --chunk=256 --level=0 --raid-devices={0} {1}' .format(len(partitions), partion_list), expectError=True) raid_created = True logger.pipe('echo DEVICE {0}'.format(partion_list), 'sudo tee /etc/mdadm/mdadm.conf') time.sleep(5) # New parsing and elimination of the name= field due to 12.04's new RAID'ing methods response = logger.exe('sudo mdadm --examine --scan')[0] response = ' '.join(response.split(' ')[0:-1]) with open('/etc/mdadm/mdadm.conf', 'a') as f: f.write(response) logger.exe('sudo update-initramfs -u') time.sleep(10) conf.set_config('AMI', 'raid_readahead', 128) logger.exe('sudo blockdev --setra %s /dev/md0' % (conf.get_config('AMI', 'raid_readahead'))) logger.info('Formatting the RAID0 set:') time.sleep(10) raidError = logger.exe('sudo mkfs.xfs -f /dev/md0', expectError=True)[1] if raidError: logger.exe('sudo mdadm --stop /dev/md_d0', expectError=True) logger.exe('sudo mdadm --zero-superblock /dev/sdb1', expectError=True) raid_created = False # Configure fstab and mount the new RAID0 device mnt_point = '/raid0' logger.exe('sudo mkdir {0}'.format(mnt_point)) create_cassandra_directories(mnt_point=mnt_point, device='/dev/md0') logger.info('Showing RAID0 details:') logger.exe('cat /proc/mdstat') logger.exe('sudo mdadm --detail /dev/md0') # http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/InstanceStorage.html logger.pipe('echo "30720"', 'sudo tee /proc/sys/dev/raid/speed_limit_min') return mnt_point
def create_cassandra_directories(mnt_point, device): logger.pipe( "echo '{0}\t{1}\txfs\tdefaults,nobootwait\t0\t0'".format( device, mnt_point), 'sudo tee -a /etc/fstab') logger.exe('sudo mount -a') if conf.get_config("AMI", "RaidOnly"): output = logger.exe('id cassandra', expectError=True) if output[1] or 'no such user' in output[0].lower(): logger.pipe( 'yes', 'sudo adduser --no-create-home --disabled-password cassandra') while True: output = logger.exe('id cassandra', expectError=True) if not output[1] and not 'no such user' in output[0].lower(): break time.sleep(1) output = logger.exe('id opscenter-agent', expectError=True) if output[1] or 'no such user' in output[0].lower(): logger.pipe( 'yes', 'sudo adduser --no-create-home --disabled-password opscenter-agent' ) while True: output = logger.exe('id opscenter-agent', expectError=True) if not output[1] and not 'no such user' in output[0].lower(): break time.sleep(1) logger.exe('sudo mkdir -p {0}'.format( os.path.join(mnt_point, 'cassandra', 'logs'))) logger.exe('sudo chown -R cassandra:cassandra {0}'.format( os.path.join(mnt_point, 'cassandra'))) # Create symlink for Cassandra data logger.exe('sudo rm -rf /var/lib/cassandra') logger.exe('sudo ln -s {0} /var/lib/cassandra'.format( os.path.join(mnt_point, 'cassandra'))) logger.exe('sudo chown -R cassandra:cassandra /var/lib/cassandra') # Create symlink for Cassandra logs logger.exe('sudo rm -rf /var/log/cassandra') logger.exe('sudo ln -s {0} /var/log/cassandra'.format( os.path.join(mnt_point, 'cassandra', 'logs'))) logger.exe('sudo chown -R cassandra:cassandra /var/log/cassandra') # Create symlink for OpsCenter logs if instance_data['launchindex'] == 0 and options.opscenter != "no": logger.exe('sudo mkdir -p {0}'.format( os.path.join(mnt_point, 'opscenter', 'logs'))) logger.exe('sudo rm -rf /var/log/opscenter') logger.exe('sudo ln -s {0} /var/log/opscenter'.format( os.path.join(mnt_point, 'opscenter', 'logs'))) logger.exe('sudo chown -R root:root /var/log/opscenter') logger.exe('sudo chown -R root:root {0}'.format( os.path.join(mnt_point, 'opscenter'))) # Create symlink for DataStax Agent logs logger.exe('sudo mkdir -p {0}'.format( os.path.join(mnt_point, 'datastax-agent', 'logs'))) logger.exe('sudo rm -rf /var/log/datastax-agent') logger.exe('sudo ln -s {0} /var/log/datastax-agent'.format( os.path.join(mnt_point, 'datastax-agent', 'logs'))) logger.exe( 'sudo chown -R opscenter-agent:opscenter-agent /var/log/datastax-agent' ) logger.exe('sudo touch /var/log/datastax-agent/agent.log') logger.exe('sudo touch /var/log/datastax-agent/startup.log') logger.exe('sudo chown -R cassandra:cassandra {0}'.format( os.path.join(mnt_point, 'cassandra'))) logger.exe('sudo chown -R opscenter-agent:opscenter-agent {0}'.format( os.path.join(mnt_point, 'datastax-agent')))
def mountRAID(): # Only create raid0 once. Mount all times in init.d script. if not conf.getConfig("AMI", "RAIDCreated"): # Remove EC2 default /mnt from fstab fstab = '' fileToOpen = '/etc/fstab' logger.exe('sudo chmod 777 ' + fileToOpen) with open(fileToOpen, 'r') as f: for line in f: if not "/mnt" in line: fstab += line with open(fileToOpen, 'w') as f: f.write(fstab) logger.exe('sudo chmod 644 ' + fileToOpen) # Create a list of devices devices = glob.glob("/dev/sd*") devices.remove('/dev/sda1') devices.sort() logger.info('Unformatted devices: ' + str(devices)) # Check if there are enough drives to start a RAID set if len(devices) > 1: # Make sure the devices are umounted, then run fdisk on each device logger.info('Clear "invalid flag 0x0000 of partition table 4" by issuing a write, then running fdisk on each device...') formatCommands = """echo 'n p 1 t fd w'""" for device in devices: logger.info('Confirming devices are not mounted:') logger.exe('sudo umount ' + device, False) logger.pipe("echo 'w'", 'sudo fdisk -c -u ' + device) logger.pipe(formatCommands, 'sudo fdisk -c -u ' + device) # Create a list of partitions to RAID logger.exe('sudo fdisk -l') partitions = glob.glob("/dev/sd*[0-9]") partitions.remove('/dev/sda1') partitions.sort() logger.info('Partitions about to be added to RAID0 set: ' + str(partitions)) # Make sure the partitions are umounted and create a list string partionList = '' for partition in partitions: logger.info('Confirming partitions are not mounted:') logger.exe('sudo umount ' + partition, False) partionList += partition + ' ' partionList = partionList.strip() logger.info('Creating the RAID0 set:') time.sleep(5) logger.pipe('yes', 'sudo mdadm --create /dev/md0 --chunk=256 --level=0 --raid-devices=' + str(len(devices)) + ' ' + partionList, False) logger.pipe('echo DEVICE ' + partionList, 'sudo tee /etc/mdadm/mdadm.conf') logger.pipe('mdadm --detail --scan', 'sudo tee -a /etc/mdadm/mdadm.conf') time.sleep(5) logger.exe('blockdev --setra 65536 /dev/md0') logger.info('Formatting the RAID0 set:') time.sleep(5) logger.exe('sudo mkfs.xfs -f /dev/md0') # Configure fstab and mount the new RAID0 device raidMnt = '/raid0' logger.pipe("echo '/dev/md0\t" + raidMnt + "\txfs\tdefaults,nobootwait,noatime\t0\t0'", 'sudo tee -a /etc/fstab') logger.exe('sudo mkdir ' + raidMnt) logger.exe('sudo mount -a') logger.exe('sudo mkdir -p ' + raidMnt + '/cassandra/') logger.exe('sudo chown -R ubuntu:ubuntu ' + raidMnt + '/cassandra') logger.info('Showing RAID0 details:') logger.exe('cat /proc/mdstat') logger.exe('echo "15000" > /proc/sys/dev/raid/speed_limit_min') logger.exe('sudo mdadm --detail /dev/md0') else: # Make sure the device is umounted, then run fdisk on the device logger.info('Clear "invalid flag 0x0000 of partition table 4" by issuing a write, then running fdisk on the device...') formatCommands = """echo 'd n p 1 t 83 w'""" logger.exe('sudo umount ' + devices[0]) logger.pipe("echo 'w'", 'sudo fdisk -c -u ' + devices[0]) logger.pipe(formatCommands, 'sudo fdisk -c -u ' + devices[0]) # Create a list of partitions to RAID logger.exe('sudo fdisk -l') partitions = glob.glob("/dev/sd*[0-9]") partitions.remove('/dev/sda1') partitions.sort() logger.info('Formatting the new partition:') logger.exe('sudo mkfs.xfs -f ' + partitions[0]) # Configure fstab and mount the new formatted device mntPoint = '/mnt' logger.pipe("echo '" + partitions[0] + "\t" + mntPoint + "\txfs\tdefaults,nobootwait,noatime\t0\t0'", 'sudo tee -a /etc/fstab') logger.exe('sudo mkdir ' + mntPoint, False) logger.exe('sudo mount -a') logger.exe('sudo mkdir -p ' + mntPoint + '/cassandra') logger.exe('sudo chown -R cassandra:cassandra ' + mntPoint + '/cassandra') # Change cassandra.yaml to point to the new data directories with open(confPath + 'cassandra.yaml', 'r') as f: yaml = f.read() if len(partitions) > 1: yaml = yaml.replace('/var/lib/cassandra/data', raidMnt + '/cassandra/data') yaml = yaml.replace('/var/lib/cassandra/saved_caches', raidMnt + '/cassandra/saved_caches') yaml = yaml.replace('/var/lib/cassandra/commitlog', raidMnt + '/cassandra/commitlog') else: yaml = yaml.replace('/var/lib/cassandra/data', mntPoint + '/cassandra/data') yaml = yaml.replace('/var/lib/cassandra/saved_caches', mntPoint + '/cassandra/saved_caches') yaml = yaml.replace('/var/lib/cassandra/commitlog', mntPoint + '/cassandra/commitlog') with open(confPath + 'cassandra.yaml', 'w') as f: f.write(yaml) # Remove the old cassandra folders subprocess.Popen("sudo rm -rf /var/log/cassandra/*", shell=True) subprocess.Popen("sudo rm -rf /var/lib/cassandra/*", shell=True) logger.exe('sudo chown -R cassandra:cassandra /var/lib/cassandra') logger.exe('sudo chown -R cassandra:cassandra /var/log/cassandra') # Never create raid array again conf.setConfig("AMI", "RAIDCreated", True) logger.info("Mounted Raid.\n")
if isDEV: if options.smokeurl and options.smokefile: logger.info('Retrieving smoke testing tarball: ' + options.smokeurl) logger.info('Executing smoke testing file: ' + options.smokefile) conf.setConfig("AMI", "SmokeURL", options.smokeurl) conf.setConfig("AMI", "SmokeFile", options.smokefile) elif options.smokeurl or options.smokefile: logger.warn('Both -u and -f have to be set together in order for smoke tests to run.') conf.setConfig("AMI", "Type", "Cassandra") if options and options.deployment: options.deployment = options.deployment.lower() # Setup the repositories if options.deployment == "07x": logger.pipe('echo "deb http://www.apache.org/dist/cassandra/debian 07x main"', 'sudo tee -a /etc/apt/sources.list.d/datastax.sources.list') elif options.deployment == "08x": logger.pipe('echo "deb http://www.apache.org/dist/cassandra/debian 08x main"', 'sudo tee -a /etc/apt/sources.list.d/datastax.sources.list') elif options.deployment == "brisk": logger.pipe('echo "deb http://debian.datastax.com/maverick maverick main"', 'sudo tee -a /etc/apt/sources.list.d/datastax.sources.list') conf.setConfig("AMI", "Type", "Brisk") global confPath confPath = os.path.expanduser("/etc/brisk/cassandra/") else: logger.warn('Unable to parse Deployment Type. Defaulting to 0.8.x.') logger.pipe('echo "deb http://www.apache.org/dist/cassandra/debian 08x main"', 'sudo tee -a /etc/apt/sources.list.d/datastax.sources.list') else: logger.info('Installing the latest version of Cassandra.') logger.pipe('echo "deb http://www.apache.org/dist/cassandra/debian 08x main"', 'sudo tee -a /etc/apt/sources.list.d/datastax.sources.list') # Perform the install
def mount_raid(devices): # Make sure the devices are umounted, then run fdisk on each device logger.info( 'Clear "invalid flag 0x0000 of partition table 4" by issuing a write, then running fdisk on each device...' ) formatCommands = "echo 'n\np\n1\n\n\nt\nfd\nw'" for device in devices: logger.info('Confirming devices are not mounted:') logger.exe('sudo umount {0}'.format(device), False) logger.pipe("echo 'w'", 'sudo fdisk -c -u {0}'.format(device)) logger.pipe(formatCommands, 'sudo fdisk -c -u {0}'.format(device)) # Create a list of partitions to RAID logger.exe('sudo fdisk -l') partitions = glob.glob('/dev/xvd*[0-9]') partitions.remove('/dev/xvda1') partitions.sort() logger.info( 'Partitions about to be added to RAID0 set: {0}'.format(partitions)) # Make sure the partitions are umounted and create a list string partion_list = '' for partition in partitions: logger.info('Confirming partitions are not mounted:') logger.exe('sudo umount ' + partition, False) partion_list = ' '.join(partitions).strip() logger.info('Creating the RAID0 set:') time.sleep(3) # was at 10 conf.set_config("AMI", "CurrentStatus", "Raid creation") # Continuously create the Raid device, in case there are errors raid_created = False while not raid_created: logger.exe( 'sudo mdadm --create /dev/md0 --chunk=256 --level=0 --raid-devices={0} {1}' .format(len(partitions), partion_list), expectError=True) raid_created = True logger.pipe('echo DEVICE {0}'.format(partion_list), 'sudo tee /etc/mdadm/mdadm.conf') time.sleep(5) # New parsing and elimination of the name= field due to 12.04's new RAID'ing methods response = logger.exe('sudo mdadm --examine --scan')[0] response = ' '.join(response.split(' ')[0:-1]) with open('/etc/mdadm/mdadm.conf', 'a') as f: f.write(response) logger.exe('sudo update-initramfs -u') time.sleep(10) conf.set_config('AMI', 'raid_readahead', 512) logger.exe('sudo blockdev --setra %s /dev/md0' % (conf.get_config('AMI', 'raid_readahead'))) logger.info('Formatting the RAID0 set:') time.sleep(10) raidError = logger.exe('sudo mkfs.xfs -f /dev/md0', expectError=True)[1] if raidError: logger.exe('sudo mdadm --stop /dev/md_d0', expectError=True) logger.exe('sudo mdadm --zero-superblock /dev/sdb1', expectError=True) raid_created = False # Configure fstab and mount the new RAID0 device mnt_point = '/raid0' logger.pipe( "echo '/dev/md0\t{0}\txfs\tdefaults,nobootwait,noatime\t0\t0'".format( mnt_point), 'sudo tee -a /etc/fstab') logger.exe('sudo mkdir {0}'.format(mnt_point)) logger.exe('sudo mount -a') logger.exe('sudo mkdir -p {0}'.format(os.path.join(mnt_point, 'cassandra'))) if conf.get_config("AMI", "RaidOnly"): logger.pipe( 'yes', 'sudo adduser --no-create-home --disabled-password cassandra') while True: output = logger.exe('id cassandra') if not output[1] and not 'no such user' in output[0].lower(): break time.sleep(1) logger.exe('sudo chown -R cassandra:cassandra {0}'.format( os.path.join(mnt_point, 'cassandra'))) # Create symlink for Cassandra logger.exe('sudo rm -rf /var/lib/cassandra') logger.exe('sudo ln -s {0} /var/lib/cassandra'.format( os.path.join(mnt_point, 'cassandra'))) logger.exe('sudo chown -R cassandra:cassandra /var/lib/cassandra') logger.info('Showing RAID0 details:') logger.exe('cat /proc/mdstat') logger.exe('echo "15000" > /proc/sys/dev/raid/speed_limit_min') logger.exe('sudo mdadm --detail /dev/md0') return mnt_point
def setup_repos(): # Clear repo when filled, primarily for debugging purposes logger.exe('sudo rm /etc/apt/sources.list.d/datastax.sources.list', log=False, expectError=True) # Add repos if conf.get_config("AMI", "Type") == "Enterprise": logger.pipe( 'echo "deb http://{0}:{1}@debian.datastax.com/enterprise stable main"' .format(options.username, options.password), 'sudo tee -a /etc/apt/sources.list.d/datastax.sources.list') else: logger.pipe( 'echo "deb http://debian.datastax.com/community stable main"', 'sudo tee -a /etc/apt/sources.list.d/datastax.sources.list') # Add repokeys logger.pipe( 'curl -s http://installer.datastax.com/downloads/ubuntuarchive.repo_key', 'sudo apt-key add -') logger.pipe('curl -s http://opscenter.datastax.com/debian/repo_key', 'sudo apt-key add -') logger.pipe('curl -s http://debian.datastax.com/debian/repo_key', 'sudo apt-key add -') if options.dev: logger.pipe( 'echo "deb {0} maverick main"'.format(options.dev.split(',')[0]), 'sudo tee -a /etc/apt/sources.list.d/datastax.sources.list') logger.pipe('curl -s {0}'.format(options.dev.split(',')[1]), 'sudo apt-key add -') # Perform the install logger.exe('sudo apt-get update') while True: output = logger.exe('sudo apt-get update') if not output[1] and not 'err' in output[0].lower( ) and not 'failed' in output[0].lower(): break time.sleep(5)
def additional_pre_configurations(): logger.exe('gpg --keyserver pgp.mit.edu --recv-keys 40976EAF437D05B5', expectError=True) logger.pipe('gpg --export --armor 40976EAF437D05B5', 'sudo apt-key add -') pass
# Try reading from the authenticated connection try: opener.open(repo_url) global confPath confPath = os.path.expanduser("/etc/dse/cassandra/") except Exception as inst: # Print error message if failed if "401" in str(inst): exitPath('Authentication for DataStax Enterprise failed. Please confirm your username and password.\n') elif options and (options.username or options.password): exitPath("Both --username (-u) and --password (-p) required for DataStax Enterprise.") # Add repos if conf.getConfig("AMI", "Type") == "Enterprise": logger.pipe('echo "deb http://' + options.username + ':' + options.password + '@debian.datastax.com/enterprise stable main"', 'sudo tee -a /etc/apt/sources.list.d/datastax.sources.list') else: logger.pipe('echo "deb http://debian.datastax.com/community stable main"', 'sudo tee -a /etc/apt/sources.list.d/datastax.sources.list') logger.pipe('curl -s http://installer.datastax.com/downloads/ubuntuarchive.repo_key', 'sudo apt-key add -') logger.pipe('curl -s http://opscenter.datastax.com/debian/repo_key', 'sudo apt-key add -') logger.pipe('curl -s http://debian.datastax.com/debian/repo_key', 'sudo apt-key add -') if options and options.dev: logger.pipe('echo "deb ' + options.dev.split(',')[0] + ' maverick main"', 'sudo tee -a /etc/apt/sources.list.d/datastax.sources.list') logger.pipe('curl -s ' + options.dev.split(',')[1], 'sudo apt-key add -') # Perform the install logger.exe('sudo apt-get update') logger.exe('sudo apt-get update') time.sleep(5)
# Configure DataStax variables read = logger.exe('python ds2_configure.py', False) stderr = read[1] stderr = stderr.replace('yes: standard output: Broken pipe', '').strip() stderr = stderr.replace('yes: write error', '').strip() if len(stderr) > 0: # TODO: later # logger.error("DEBUG") # logger.error(stderr) # logger.error("/DEBUG") pass # Set ulimit hard limits logger.pipe('echo "* soft nofile 32768"', 'sudo tee -a /etc/security/limits.conf') logger.pipe('echo "* hard nofile 32768"', 'sudo tee -a /etc/security/limits.conf') logger.pipe('echo "root soft nofile 32768"', 'sudo tee -a /etc/security/limits.conf') logger.pipe('echo "root hard nofile 32768"', 'sudo tee -a /etc/security/limits.conf') # Create /raid0 logger.exe('sudo mount -a') # Disable swap logger.exe('sudo swapoff --all') # Change permission back to being ubuntu's and cassandra's logger.exe('sudo chown -hR ubuntu:ubuntu /home/ubuntu') logger.exe('sudo chown -hR cassandra:cassandra /raid0/cassandra', False) logger.exe('sudo chown -hR cassandra:cassandra /mnt/cassandra', False)