Ejemplo n.º 1
0
 def _get_loadbalancing_policy(self, policy):
     # NOTE(nick-ma-z): http://datastax.github.io/python-driver/
     # api/cassandra/policies.html
     if policy == 'rr':
         return policies.RoundRobinPolicy()
     elif policy == 'dc_rr':
         return policies.DCAwareRoundRobinPolicy(
             cfg.CONF.df_cassandra.local_dc_name,
             cfg.CONF.df_cassandra.used_hosts_per_remote_dc)
     elif policy == 'wl_rr':
         return policies.WhiteListRoundRobinPolicy(
             cfg.CONF.df_cassandra.whitelist_hosts)
     elif policy == 'token_rr':
         return policies.TokenAwarePolicy(policies.RoundRobinPolicy())
     else:
         # by default
         return policies.RoundRobinPolicy()
Ejemplo n.º 2
0
            n.start()
    start_master = Thread(target=start_cluster, args=[master_nodes])
    start_replica = Thread(target=start_cluster, args=[replica_nodes])
    start_master.start()
    start_replica.start()
    start_master.join()
    start_replica.join()

    #Hardcoded in gemini:
    KS_NAME = 'ks1'
    TABLE_NAMES = ['table1']

    if use_cql:
        TABLE_NAMES = [os.path.splitext(f)[0] for f in os.listdir('./cql/') if os.path.isfile(os.path.join('./cql/', f))]
    
    profile = ExecutionProfile(load_balancing_policy = policies.TokenAwarePolicy(policies.DCAwareRoundRobinPolicy()))
    cm = Cluster([n.ip() for n in master_nodes], protocol_version = 4, execution_profiles={EXEC_PROFILE_DEFAULT: profile})
    cr = Cluster([n.ip() for n in replica_nodes], protocol_version = 4, execution_profiles={EXEC_PROFILE_DEFAULT: profile})

    w = tmux_sess.windows[0]
    w.split_window(start_directory = run_path, attach = False)
    w.split_window(start_directory = run_path, attach = False)
    w.select_layout('even-vertical')
    w.panes[0].send_keys('tail -F stressor.log -n +1')
    w.panes[1].send_keys('tail -F replicator.log -n +1')
    w.panes[2].send_keys('tail -F migrate.log -n +1')

    logger.info('Waiting for the latest CDC generation to start...')
    time.sleep(15)

    with ExitStack() as stack: