示例#1
0
def stage7_container_zookeeper():
    metadata = Config(os.environ["CONFIGFILE"])

    if cuisine.file_exists("/tmp/.%s.lck" % sys._getframe().f_code.co_name):
        return

    puts(green("installing zookeeper on %s" % env.host_string))

    zk = []

    zkid = 1
    myid = 1

    for zkhost in sorted(metadata.roles["container_zookeeper"]):
        zk.append("{'id' => '%s', 'host' => '%s'}" %
                  (zkid, metadata.containers[zkhost]['ip']))

        if env.host_string == zkhost:
            # then this is our id
            myid = zkid

        zkid = zkid + 1

    args = {}

    args['servers'] = "[%s]" % ",".join(zk)
    args['server_id'] = "%s" % myid

    Puppet.apply('midonet::zookeeper', args, metadata)

    run("service zookeeper stop; service zookeeper start")

    Daemon.poll('org.apache.zookeeper.server.quorum', 600)

    for zkhost in sorted(metadata.roles['container_zookeeper']):
        run("""
IP="%s"

echo ruok | nc "${IP}" 2181 | grep imok

""" % metadata.containers[zkhost]['ip'])

    #
    # TODO status check for 'not serving requests'
    #

    cuisine.file_write("/tmp/.%s.lck" % sys._getframe().f_code.co_name, "xoxo")
示例#2
0
def stage7_container_zookeeper():
    metadata = Config(os.environ["CONFIGFILE"])

    if cuisine.file_exists("/tmp/.%s.lck" % sys._getframe().f_code.co_name):
        return

    puts(green("installing zookeeper on %s" % env.host_string))

    zk = []

    zkid = 1
    myid = 1

    for zkhost in sorted(metadata.roles["container_zookeeper"]):
        zk.append("{'id' => '%s', 'host' => '%s'}" % (zkid, metadata.containers[zkhost]['ip']))

        if env.host_string == zkhost:
            # then this is our id
            myid = zkid

        zkid = zkid + 1

    args = {}

    args['servers'] = "[%s]" % ",".join(zk)
    args['server_id'] = "%s" % myid

    Puppet.apply('midonet::zookeeper', args, metadata)

    run("service zookeeper stop; service zookeeper start")

    Daemon.poll('org.apache.zookeeper.server.quorum', 600)

    for zkhost in sorted(metadata.roles['container_zookeeper']):
        run("""
IP="%s"

echo ruok | nc "${IP}" 2181 | grep imok

""" % metadata.containers[zkhost]['ip'])

    #
    # TODO status check for 'not serving requests'
    #

    cuisine.file_write("/tmp/.%s.lck" % sys._getframe().f_code.co_name, "xoxo")
示例#3
0
def stage7_container_cassandra():
    metadata = Config(os.environ["CONFIGFILE"])

    if cuisine.file_exists("/tmp/.%s.lck" % sys._getframe().f_code.co_name):
        return

    puts(green("installing cassandra on %s" % env.host_string))

    cs = []

    for cshost in metadata.roles['container_cassandra']:
        cs.append("'%s'" % metadata.containers[cshost]['ip'])

    args = {}

    args['seeds'] = "[%s]" % ",".join(cs)
    args['seed_address'] = "'%s'" % metadata.containers[env.host_string]['ip']

    Puppet.apply('midonet::cassandra', args, metadata)

    Daemon.poll('org.apache.cassandra.service.CassandraDaemon', 600)

    cuisine.file_write("/tmp/.%s.lck" % sys._getframe().f_code.co_name, "xoxo")
示例#4
0
def stage7_container_cassandra():
    metadata = Config(os.environ["CONFIGFILE"])

    if cuisine.file_exists("/tmp/.%s.lck" % sys._getframe().f_code.co_name):
        return

    puts(green("installing cassandra on %s" % env.host_string))

    cs = []

    for cshost in metadata.roles['container_cassandra']:
        cs.append("'%s'" % metadata.containers[cshost]['ip'])

    args = {}

    args['seeds'] = "[%s]" % ",".join(cs)
    args['seed_address'] = "'%s'" % metadata.containers[env.host_string]['ip']

    Puppet.apply('midonet::cassandra', args, metadata)

    Daemon.poll('org.apache.cassandra.service.CassandraDaemon', 600)

    cuisine.file_write("/tmp/.%s.lck" % sys._getframe().f_code.co_name, "xoxo")