Thanks. I got it running.
On Thu, Aug 2, 2012 at 3:51 PM, John Armstrong <[email protected]> wrote: > On 08/02/2012 03:37 PM, Edmon Begoli wrote: >> >> I am looking at the official example of how to write data and I do not >> see where is >> table created. >> >> Text rowID = new Text("row1"); >> Text colFam = new Text("myColFam"); >> Text colQual = new Text("myColQual"); >> ColumnVisibility colVis = new ColumnVisibility("public"); >> long timestamp = System.currentTimeMillis(); >> Value value = new Value("myValue".getBytes()); >> Mutation mutation = new Mutation(rowID); >> mutation.put(colFam, colQual, colVis, timestamp, value); > > > Start with > > String accInstance; // Accumulo instance name > String[] zookeepers; // list of zookeepers > String user; // Accumulo username > String password; // Accumulo password > String tableName; > long bwMem; // memory for BatchWriters to use, in B > long bwLat; // latency for BatchWriters, in ms > int bwTheads; // number of threads for BatchWriters to use > > First you need a ZooKeeperInstance: > > ZooKeeperInstance zk = new ZooKeeperInstance(accInstance, zookeepers) > > Next you need a Connector: > > Connector conn = zk.getConnector(user, password.getBytes()); > > Now you can make a table: > > conn.tableOperations().create(tableName); > > Given that, you can make a BatchWriter: > > BatchWriter bw = conn.createBatchWriter(tableName, > bwMem, > bwLat, > bwThreads); > > And THEN you can add your mutations: > > bw.addMutation(mutation); > > Don't forget to close! > > bw.close(); > > hth
