簡單的hector連線casssandra測試
import me.prettyprint.cassandra.serializers.StringSerializer;
import me.prettyprint.cassandra.service.CassandraHostConfigurator;
import me.prettyprint.hector.api.Cluster;
import me.prettyprint.hector.api.Keyspace;
import me.prettyprint.hector.api.factory.HFactory;
import me.prettyprint.hector.api.mutation.Mutator;
public class ExampleClient {
public static void main(String[] args) throws IllegalStateException,Exception {
CassandraHostConfigurator cassandraHostConfigurator=new CassandraHostConfigurator("192.168.100.108:9160,192.168.100.110:9160");
cassandraHostConfigurator.setMaxActive(20);
cassandraHostConfigurator.setMaxIdle(5);
cassandraHostConfigurator.setCassandraThriftSocketTimeout(3000);
cassandraHostConfigurator.setMaxWaitTimeWhenExhausted(4000);
StringSerializer stringSerializer=new StringSerializer();
Cluster cluster=HFactory.createCluster("cluster_name", cassandraHostConfigurator);
Keyspace ks=HFactory.createKeyspace("OBS", cluster);
String columnFamily = "bucket";
Mutator
mutator.insert("bucket_key", columnFamily, HFactory.createStringColumn("object_name", "object_value"));
System.out.println("testHetor");
cluster.getConnectionManager().shutdown();
}
}
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/23937368/viewspace-1052468/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- mysql的JDBC架包下載及簡單測試連線MySqlJDBC
- 測試連線
- dedicated server連線測試Server
- 測試 mysql 的最大連線數MySql
- 自然連線的一個測試
- 簡單的 ping 測試
- spring 簡單的使用 Hikari連線池 和 jdbc連線mysql 的一個簡單例子SpringJDBCMySql單例
- 測試rss與navicat連線
- python連線redis測試PythonRedis
- sqlplus連線數的測試SQL
- 【JDBC】java連線池模擬測試 連線oracleJDBCJavaOracle
- java Jdbc連線oracle資料庫連線測試JavaJDBCOracle資料庫
- 一個簡單的反射連線程式反射線程
- 讓 API 測試變的簡單API
- Linux的OOMkiller簡單測試LinuxOOM
- Oracle RAC的TAF簡單測試Oracle
- mysql簡單效能測試MySql
- sql trace 簡單測試SQL
- 看了四個小時hector guide,借用一個hector的使用清單來總結下hector的使用GUIIDE
- php連線mssql測試檔案PHPSQL
- 簡單談談服務間的連線
- 最簡單的JAVA連線資料庫Java資料庫
- 簡單的神經網路測試神經網路
- ios最簡單的測試打包方式iOS
- MySQL Profile在5.7的簡單測試MySql
- 閃迴歸檔的簡單測試
- 關於oracle session的簡單測試OracleSession
- pl/sql中的forall簡單測試SQL
- 簡單的鍵值儲存測試
- 最簡單的jquery測試程式碼jQuery
- js字串連線簡單介紹JS字串
- Oracle logmnr簡單測試Oracle
- mysqlimport匯入簡單測試MySqlImport
- (一)Jmeter簡單介面測試JMeter
- Windows IO 效能簡單測試Windows
- Windows 10 TechPreview簡單測試WindowsView
- Jmeter效能測試簡單使用JMeter
- 經驗分享丨功能測試漲薪路線,記一次簡單的效能測試實踐!