Key/Value 存儲系統:etcd

jopen 11年前發布 | 31K 次閱讀 etcd NoSQL數據庫

etcd 是一個高可用的 Key/Value 存儲系統,主要用于分享配置和服務發現。etcd 的靈感來自于 ZooKeeper 和 Doozer,側重于:

  • 簡單:支持 curl 方式的用戶 API (HTTP+JSON)
  • 安全:可選 SSL 客戶端證書認證
  • 快速:單實例可達每秒 1000 次寫操作
  • 可靠:使用 Raft 實現分布式

Jetcd 是 etcd 的簡單 Java 客戶端開發包。etcd 是 CoreOS 中的高可用 Key/Value 存儲和

示例代碼:

EtcdClient client = new EtcdClient(URI.create("http://127.0.0.1:4001/"));

String key = "/watch";

EtcdResult result = this.client.set(key, "hello");
Assert.assertEquals("hello", result.value);

result = this.client.get(key);
Assert.assertEquals("hello", result.value);

ListenableFuture<EtcdResult> watchFuture = this.client.watch(key, result.index + 1);
Assert.assertFalse(watchFuture.isDone());

result = this.client.set(key, "world");
Assert.assertEquals("world", result.value);

EtcdResult watchResult = watchFuture.get(100, TimeUnit.MILLISECONDS);
Assert.assertNotNull(result);
Assert.assertEquals("world", result.value);

項目主頁:http://www.baiduhome.net/lib/view/home/1378365077671

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!