Esempio n. 1
0
def create_cql_ks_and_table(docker_scylla):
    if running_in_docker():
        address = f'{docker_scylla.internal_ip_address}:9042'
    else:
        address = docker_scylla.get_port('9042')
    node_ip, port = address.split(':')
    port = int(port)

    from cassandra.cluster import Cluster  # pylint: disable=no-name-in-module,import-outside-toplevel
    cluster_driver = Cluster([node_ip], port=port)
    session = cluster_driver.connect()
    session.execute(
        """create keyspace ycsb WITH REPLICATION = {'class' : 'SimpleStrategy', 'replication_factor': 1 };"""
    )
    session.execute("""CREATE TABLE ycsb.usertable (
                        y_id varchar primary key,
                        field0 varchar,
                        field1 varchar,
                        field2 varchar,
                        field3 varchar,
                        field4 varchar,
                        field5 varchar,
                        field6 varchar,
                        field7 varchar,
                        field8 varchar,
                        field9 varchar);""")
Esempio n. 2
0
 def create_endpoint_url(node):
     if running_in_docker():
         endpoint_url = f'http://{node.internal_ip_address}:{ALTERNATOR_PORT}'
     else:
         address = node.get_port(f'{ALTERNATOR_PORT}')
         endpoint_url = f'http://{address}'
     return endpoint_url