Giter Site home page Giter Site logo

Comments (9)

bigbes avatar bigbes commented on June 17, 2024

Using the Cassandra library

The included code works with Cassandra versions 0.5, 0.6 and 0.7. To use YCSB with Cassandra:

  1. Use the com.yahoo.ycsb.db.CassandraClientX class for the DB layer (where X is 5, 6 or 7 for version 0.5, 0.6 or 0.7 respectively)
  2. Make sure to define the "hosts" property, either in the configuration properties file (-P on the command line) or on the command line itself (-p on the command line.) Hosts should be a comma separated list of Cassandra server hostnames. Be sure to list all the hostnames, so that the client can load balance its connections among all of the servers.
  3. Make sure that the Cassandra jars are available on your classpath, in addition to ycsb.jar.
  4. In Cassandra, create a keyspace called "usertable" that includes a column family called "data". (!!!)

https://github.com/brianfrankcooper/YCSB/wiki/Using-the-Database-Libraries

from ycsb.

 avatar commented on June 17, 2024

Hi bigbes92,

Thank you for your advice here too! =)
However, correct me if I am mistaken but I am aware that the latest build includes the patch for Cassandra v1.0.6?

Kind regards,
Cornelius

from ycsb.

bigbes avatar bigbes commented on June 17, 2024

I'm not sure, but in init code there's no create keyspace.
https://github.com/brianfrankcooper/YCSB/blob/master/cassandra/src/main/java/com/yahoo/ycsb/db/CassandraClient10.java

  public void init() throws DBException
  {
    String hosts = getProperties().getProperty("hosts");
    if (hosts == null)
    {
      throw new DBException("Required property \"hosts\" missing for CassandraClient");
    }

    column_family = getProperties().getProperty(COLUMN_FAMILY_PROPERTY, COLUMN_FAMILY_PROPERTY_DEFAULT);
    parent = new ColumnParent(column_family);

    ConnectionRetries = Integer.parseInt(getProperties().getProperty(CONNECTION_RETRY_PROPERTY,
        CONNECTION_RETRY_PROPERTY_DEFAULT));
    OperationRetries = Integer.parseInt(getProperties().getProperty(OPERATION_RETRY_PROPERTY,
        OPERATION_RETRY_PROPERTY_DEFAULT));

    String username = getProperties().getProperty(USERNAME_PROPERTY);
    String password = getProperties().getProperty(PASSWORD_PROPERTY);

    readConsistencyLevel = ConsistencyLevel.valueOf(getProperties().getProperty(READ_CONSISTENCY_LEVEL_PROPERTY, READ_CONSISTENCY_LEVEL_PROPERTY_DEFAULT));
    writeConsistencyLevel = ConsistencyLevel.valueOf(getProperties().getProperty(WRITE_CONSISTENCY_LEVEL_PROPERTY, WRITE_CONSISTENCY_LEVEL_PROPERTY_DEFAULT));
    scanConsistencyLevel = ConsistencyLevel.valueOf(getProperties().getProperty(SCAN_CONSISTENCY_LEVEL_PROPERTY, SCAN_CONSISTENCY_LEVEL_PROPERTY_DEFAULT));
    deleteConsistencyLevel = ConsistencyLevel.valueOf(getProperties().getProperty(DELETE_CONSISTENCY_LEVEL_PROPERTY, DELETE_CONSISTENCY_LEVEL_PROPERTY_DEFAULT));


    _debug = Boolean.parseBoolean(getProperties().getProperty("debug", "false"));

    String[] allhosts = hosts.split(",");
    String myhost = allhosts[random.nextInt(allhosts.length)];

    Exception connectexception = null;

    for (int retry = 0; retry < ConnectionRetries; retry++)
    {
      tr = new TFramedTransport(new TSocket(myhost, 9160));
      TProtocol proto = new TBinaryProtocol(tr);
      client = new Cassandra.Client(proto);
      try
      {
        tr.open();
        connectexception = null;
        break;
      } catch (Exception e)
      {
        connectexception = e;
      }
      try
      {
        Thread.sleep(1000);
      } catch (InterruptedException e)
      {
      }
    }
    if (connectexception != null)
    {
      System.err.println("Unable to connect to " + myhost + " after " + ConnectionRetries
          + " tries");
      throw new DBException(connectexception);
    }

    if (username != null && password != null)
    {
        Map<String,String> cred = new HashMap<String,String>();
        cred.put("username", username);
        cred.put("password", password);
        AuthenticationRequest req = new AuthenticationRequest(cred);
        try
        {
            client.login(req);
        }
        catch (Exception e)
        {
            throw new DBException(e);
        }
    }
  }

from ycsb.

 avatar commented on June 17, 2024

Yes, there is a ycsb driver for Cassandra 1.0.6.

I'm guessing you probably need to create the keyspace manually before running YCSB. It would be cool if you can patch it so that the keyspace gets created in init().

--Michi

from ycsb.

 avatar commented on June 17, 2024

Thank you for you advice,m1ch1...
I will take a look now,...as i was busy with redisDB,.=)

from ycsb.

 avatar commented on June 17, 2024

Hi bigbes92,

I am now verifying that m1ch1 is right.
The latest build includes the patch for Cassandra v1.0.6 and it works with including the following in the workload files you want to run:

hosts=127.0.0.1

Kind regards,
Cornelius

from ycsb.

 avatar commented on June 17, 2024

Hi m1ch1 and everyone here,

Firstly, a very Merry Christmas to all from Singapore.

Secondly, with my few cents worth of discovery, I would like to highlight that the java class binding for Hypertable in the latest build of ycsb v0.1.4 is not the latest.

This because I was unable to load a simple workloada successfully.
Hence, I came across enixon and his/her update version of the java class binding:

https://github.com/enixon/YCSB/blob/hypertable_plugin_final/hypertable/src/main/java/com/yahoo/ycsb/db/HypertableClient.java

I hope this will help with whoever has encountered the little bug that ycsb v0.1.4 client only loads 1 record from workloada instead of all 1000 records.

Hope this helps everyone in the community.

Happy Holidays,
Cornelius

from ycsb.

namaggarwal avatar namaggarwal commented on June 17, 2024

anything on cassandra 2.1

from ycsb.

busbey avatar busbey commented on June 17, 2024

closing as stale. @cornelius80 if you are still having problems please try with the current README and reopen.

@namaggarwal we currently have CQL support added, if that's not sufficient to work against a cassandra 2.x cluster please open a new issue. (not that we still have a large number of outstanding cassandra changes to merge in)

from ycsb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.