1,从 https://github.com/rantav/hector/downloads 下载hector-core-0.7.0-31
2,新建项目,将hector-core-0.7.0-31中的jar导入项目中
3,测试代码:
Cluster cluster = HFactory.getOrCreateCluster("Test Cluster", "10.10.246.122:9160");
Keyspace keyspace = HFactory.createKeyspace("myspace1", cluster);
ColumnFamilyDefinition cf = HFactory.createColumnFamilyDefinition("myspace1","user",ComparatorType.UTF8TYPE);
StringSerializer stringSerializer = StringSerializer.get();
Mutator<String> mutator = HFactory.createMutator(keyspace, stringSerializer);
mutator.insert("122", "user", HFactory.createStringColumn("first", "John"));
4,登陆服务器,命令查询:
use myspace1
get user['122']
显示刚插入的数据