Examples of CassandraClient


Examples of org.apache.cassandra.stress.util.CassandraClient

            counterSuperCfDef.setCompaction_strategy(compactionStrategy);
        }

        keyspace.setCf_defs(new ArrayList<CfDef>(Arrays.asList(standardCfDef, superCfDef, counterCfDef, counterSuperCfDef)));

        CassandraClient client = getClient(false);

        try
        {
            client.system_add_keyspace(keyspace);

            /* CQL3 counter cf */
            client.set_cql_version("3.0.0"); // just to create counter cf for cql3

            client.set_keyspace(KEYSPACE_NAME);
            client.execute_cql3_query(createCounterCFStatementForCQL3(), Compression.NONE, ConsistencyLevel.ONE);

            if (enable_cql)
                client.set_cql_version(cqlVersion);
            /* end */

            System.out.println(String.format("Created keyspaces. Sleeping %ss for propagation.", nodes.length));
            Thread.sleep(nodes.length * 1000); // seconds
        }
View Full Code Here

Examples of org.apache.cassandra.stress.util.CassandraClient

        // random node selection for fake load balancing
        String currentNode = nodes[Stress.randomizer.nextInt(nodes.length)];

        TSocket socket = new TSocket(currentNode, port);
        TTransport transport = transportFactory.getTransport(socket);
        CassandraClient client = new CassandraClient(new TBinaryProtocol(transport));

        try
        {
            if(!transport.isOpen())
                transport.open();

            if (enable_cql)
                client.set_cql_version(cqlVersion);

            if (setKeyspace)
            {
                client.set_keyspace("Keyspace1");
            }
        }
        catch (InvalidRequestException e)
        {
            throw new RuntimeException(e.getWhy());
View Full Code Here

Examples of org.apache.cassandra.stress.util.CassandraClient

            items = toConsume;
        }

        public void run()
        {
            CassandraClient connection = client.getClient();

            for (int i = 0; i < items; i++)
            {
                if (stop)
                    break;
View Full Code Here

Examples of org.apache.cassandra.stress.util.CassandraClient

                    }
                }
            }
            else
            {
                CassandraClient connection = client.getClient();

                for (int i = 0; i < items; i++)
                {
                    if (stop)
                        break;
View Full Code Here

Examples of org.apache.cassandra.stress.util.CassandraClient

            counterSuperCfDef.setCompaction_strategy(compactionStrategy);
        }

        keyspace.setCf_defs(new ArrayList<CfDef>(Arrays.asList(standardCfDef, superCfDef, counterCfDef, counterSuperCfDef)));

        CassandraClient client = getClient(false);

        try
        {
            client.system_add_keyspace(keyspace);

            /* CQL3 counter cf */
            client.set_cql_version("3.0.0"); // just to create counter cf for cql3

            client.set_keyspace(KEYSPACE_NAME);
            client.execute_cql3_query(createCounterCFStatementForCQL3(), Compression.NONE, ConsistencyLevel.ONE);

            if (enable_cql)
                client.set_cql_version(cqlVersion);
            /* end */

            System.out.println(String.format("Created keyspaces. Sleeping %ss for propagation.", nodes.length));
            Thread.sleep(nodes.length * 1000); // seconds
        }
View Full Code Here

Examples of org.apache.cassandra.stress.util.CassandraClient

        // random node selection for fake load balancing
        String currentNode = nodes[Stress.randomizer.nextInt(nodes.length)];

        TSocket socket = new TSocket(currentNode, port);
        TTransport transport = transportFactory.getTransport(socket);
        CassandraClient client = new CassandraClient(new TBinaryProtocol(transport));

        try
        {
            if (!transport.isOpen())
                transport.open();

            if (enable_cql)
                client.set_cql_version(cqlVersion);

            if (setKeyspace)
                client.set_keyspace("Keyspace1");

            if (username != null && password != null)
            {
                Map<String, String> credentials = new HashMap<String, String>();
                credentials.put(IAuthenticator.USERNAME_KEY, username);
                credentials.put(IAuthenticator.PASSWORD_KEY, password);
                AuthenticationRequest authenticationRequest = new AuthenticationRequest(credentials);
                client.login(authenticationRequest);
            }
        }
        catch (AuthenticationException e)
        {
            throw new RuntimeException(e.getWhy());
View Full Code Here

Examples of org.apache.cassandra.stress.util.CassandraClient

            items = toConsume;
        }

        public void run()
        {
            CassandraClient connection = client.getClient();

            for (int i = 0; i < items; i++)
            {
                if (stop)
                    break;
View Full Code Here

Examples of org.apache.cassandra.stress.util.CassandraClient

            counterSuperCfDef.setCompaction_strategy(compactionStrategy);
        }

        keyspace.setCf_defs(new ArrayList<CfDef>(Arrays.asList(standardCfDef, superCfDef, counterCfDef, counterSuperCfDef)));

        CassandraClient client = getClient(false);

        try
        {
            client.system_add_keyspace(keyspace);

            /* CQL3 counter cf */
            client.set_cql_version("3.0.0"); // just to create counter cf for cql3

            client.set_keyspace(KEYSPACE_NAME);
            client.execute_cql3_query(createCounterCFStatementForCQL3(), Compression.NONE, ConsistencyLevel.ONE);

            if (enable_cql)
                client.set_cql_version(cqlVersion);
            /* end */

            System.out.println(String.format("Created keyspaces. Sleeping %ss for propagation.", nodes.length));
            Thread.sleep(nodes.length * 1000); // seconds
        }
View Full Code Here

Examples of org.apache.cassandra.stress.util.CassandraClient

        // random node selection for fake load balancing
        String currentNode = nodes[Stress.randomizer.nextInt(nodes.length)];

        TSocket socket = new TSocket(currentNode, port);
        TTransport transport = transportFactory.getTransport(socket);
        CassandraClient client = new CassandraClient(new TBinaryProtocol(transport));

        try
        {
            if(!transport.isOpen())
                transport.open();

            if (enable_cql)
                client.set_cql_version(cqlVersion);

            if (setKeyspace)
            {
                client.set_keyspace("Keyspace1");
            }
        }
        catch (InvalidRequestException e)
        {
            throw new RuntimeException(e.getWhy());
View Full Code Here

Examples of org.apache.cassandra.stress.util.CassandraClient

                    }
                }
            }
            else
            {
                CassandraClient connection = client.getClient();

                for (int i = 0; i < items; i++)
                {
                    if (stop)
                        break;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.