Ejemplo n.º 1
0
def ec2_up(db):
    log('ec2_up on ' + db)
    include_management_node = get_db(db)['has_management_node']

    dbs = [('DB', host_counts['DB']), ('YCSB', host_counts['YCSB'])]

    if include_management_node:
        dbs += [('DB_MAN', 1)]

    log('booting nodes for tags %s' % ", ".join([x[0] for x in dbs]))

    # Start eveything up first (as slow)
    for tag in dbs:
        start(tag[0], tag[1])

    # Configure
    for tag in dbs:
        configure_machine_and_reboot(tag[0], tag[1])

    refresh_hosts_cache()

    # Check started
    print emphasis(
        "waiting for hosts to start after reboot - ctr-c if you don't want to wait"
    )
    for tag in dbs:
        helper.wait_for_tagged_hosts_to_start(tag[0], tag[1])
Ejemplo n.º 2
0
def configure_machine_and_reboot(tag, node_count):
    log('Executing pre-reboot-settings for %s' % tag)

    helper.wait_for_tagged_hosts_to_start(tag, node_count)

    # Add machine specific config such as ulimits
    if not helper.stage_complete(tag, "core_machine_settings"):
        execute(core_machine_settings, hosts=get_external_ips(tag).split())
        helper.reboot_instances(tag)
        helper.wait_for_tagged_hosts_to_start(tag, node_count)

    helper.record_stage(tag, "core_machine_settings")
Ejemplo n.º 3
0
def start(tag, node_count):
    """Starts defined database instances if they are not already running based on a tag and an expected count to be running"""
    current = len(get_external_ips(tag).split())

    log('Starting nodes for tag: "%s"' % tag)

    if current >= node_count:
        print "Not starting new %s nodes as there are already %s running." % (
            tag, current)
        return

    if node_count > current > 0:
        node_count = node_count - current
        print "There are already %s %s nodes running so we will only start %s additional ones" % (
            current, tag, node_count)

    start_db_ec2_instance(node_count, tag)
Ejemplo n.º 4
0
def db_up(db, force=False):
    force = bool(force)
    log('db_up: '+db)

    actions = get_db(db)['actions']

    if force or not amazon_helper.stage_complete("DB","db-install"):
        actions['install']()
        log('Installing %s' % db)
        amazon_helper.record_stage("DB","db-install")
    else :
        print 'Skipping install of '+db

    log('Starting %s' % db)
    actions['run']()
Ejemplo n.º 5
0
def db_down(db):
    log('db_down: '+db)
    get_db(db)['actions']['stop']()
Ejemplo n.º 6
0
def ec2_down():
    log('ec2_down')

    terminate_running_instances()
    wait_for_instance_shutdown()
    delete_all_volumes()