示例#1
0
def get_workload_ports(parsed_opts, namespace, processes):
    for process in processes:
        assert isinstance(process, (driver.Process, driver.ProxyProcess))
    process = random.choice(processes)
    assert namespace.protocol == parsed_opts["protocol"]
    if parsed_opts["protocol"] == "memcached":
        return workload_runner.MemcachedPorts(host="localhost",
                                              http_port=process.http_port,
                                              memcached_port=namespace.port +
                                              process.port_offset)
    else:
        return workload_runner.RDBPorts(host="localhost",
                                        http_port=process.http_port,
                                        rdb_port=28015 + process.port_offset,
                                        table_name=namespace.name,
                                        db_name="test")
示例#2
0
            log_path = "serve-output-%d" % i,
            executable_path = driver.find_rethinkdb_executable())
        for i in xrange(num_nodes)]
    time.sleep(10)
    print "Creating namespace..."
    http = http_admin.ClusterAccess([("localhost", p.http_port) for p in processes])
    dc = http.add_datacenter()
    for machine_id in http.machines:
        http.move_server_to_datacenter(machine_id, dc)
    ns = http.add_namespace(protocol = "memcached", primary = dc)
    time.sleep(10)
    host, port = driver.get_namespace_host(ns.port, processes)
    cluster.check()

    workload_ports = workload_runner.MemcachedPorts(
        "localhost",
        processes[0].http_port,
        ns.port + processes[0].port_offset)
    workload_runner.run("memcached", opts["workload"], workload_ports, opts["timeout"])
    cluster.check()

    print "Splitting into two shards..."
    http.add_namespace_shard(ns, "t")
    time.sleep(10)
    cluster.check()

    print "Merging shards together again..."
    http.remove_namespace_shard(ns, "t")
    time.sleep(10)
    cluster.check()

    cluster.check_and_stop()