Пример #1
0
    rmgr = RedisMgmt()
    if len(sys.argv) == 1:
        # New cluster case

        # (Re)start the mgmt db, set as master, initialize this node as node_id=1, and launch monaco
        rmgr.restart_instance(app_id='mgmt')
        r = StrictRedis(port=config.config['mgmt_port'])
        r.slaveof()
        r.set(MONACO_NEXT_APP_ID, MIN_APP_ID)
        r.set(MONACO_NEXT_TWEM_ID, MIN_TWEM_ID)
        monaco = Monaco()
        node = MonacoNode(node_id='1')
        node.refresh(r)  # not expecting anything
        node.hostname = config.config['hostname']
        node.FQDN = config.config['IP']
        node.write(r)
        monaco.new_node(node, r)

        proc = subprocess.Popen(
            ['start', 'monaco'],
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
        )
        (out, err) = proc.communicate()
        if proc.wait() != 0:
            print out, err
            sys.exit(1)

        print 'The node details should be edited from the Web Interface to set memory capacity before use'

    elif len(sys.argv) == 3:
Пример #2
0
Файл: new.py Проект: hulu/monaco
    rmgr = RedisMgmt()
    if len(sys.argv) == 1:
        # New cluster case

        # (Re)start the mgmt db, set as master, initialize this node as node_id=1, and launch monaco
        rmgr.restart_instance(app_id="mgmt")
        r = StrictRedis(port=config.config["mgmt_port"])
        r.slaveof()
        r.set(MONACO_NEXT_APP_ID, MIN_APP_ID)
        r.set(MONACO_NEXT_TWEM_ID, MIN_TWEM_ID)
        monaco = Monaco()
        node = MonacoNode(node_id="1")
        node.refresh(r)  # not expecting anything
        node.hostname = config.config["hostname"]
        node.FQDN = config.config["IP"]
        node.write(r)
        monaco.new_node(node, r)

        proc = subprocess.Popen(["start", "monaco"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        (out, err) = proc.communicate()
        if proc.wait() != 0:
            print out, err
            sys.exit(1)

        print "The node details should be edited from the Web Interface to set memory capacity before use"

    elif len(sys.argv) == 3:
        # New member case

        # (Re)start mgmt db, sync to member, and on completion launch monaco
        rmgr.restart_instance(app_id="mgmt")