Fabric中LevelDB转CouchDB

一、介绍

在 Hyperledger Fabric 项目中,目前可以支持的状态数据库有两种:

  • LevelDB:LevelDB 是嵌入在 Peer 中的默认键值对(key-value)状态数据库。
  • CouchDB:CouchDB 是一种可选的替代 LevelDB 的状态数据库。与 LevelDB 键值存储一样,CouchDB 不仅可以根据 key 进行相应的查询,还可以根据不同的应用场景需求实现复杂查询。

F&Q

1、在 Fabric 中,状态数据库使用 LevelDB 与 CouchDB 有什么区别?

如果状态数据库使用 CouchDB 的话,具有最大的一个特点:可以使用富查询实现对状态的检索,但是需要自定义富查询字符串,该字符串必须符合 CouchDB 查询语法结构。

2、如何使用 CouchDB?

在 Hyperledger Fabric 环境中,如果需要使用 CouchDB,那么必须在 docker-compose.yml/docker-compose.yaml或自定义的配置文件中声明 CouchDB 容器,然后在各个 peer 容器中 environment 属性中声明相关环境内容,且在 depends_on 属性中指定声明的 CouchDB 容器的名称。

二、实现

本文环境:centos7,fabric1.4

  • 声明couchdb容器
    在 docker-compose.yml/docker-compose.yaml或自定义的配置文件中添加如下声明
  • 1
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
Title: Node Patterns – Databases: Volume I – LevelDB, Redis and CouchDB Author: Pedro Teixeira Length: 149 pages Edition: 1 Language: English Publication Date: 2015-04-08 ISBN-10: B00VV93SV2 Node.js has been designed to do quick and efficient network I/O. It's event-driven streams make it ideal to be used as a kind of smart proxy, often working as the glue between back-end systems and clients. Node was originally designed with that intention in mind, but meanwhile it also has been successfully used to build traditional web applications: an HTTP server that serves HTML pages or replies JSON messages and uses a database to store the data. Even though web frameworks in other platforms and languages have preferred to stick with traditional open-source relational databases like MySQL or PostgreSQL, most of the existing Node web frameworks (like Express, Hapi and others) don't impose any database or even any type of database at all. This bring-your-own-database approach has been in part fed by the explosion in the variety of database servers now available, but also by the ease with which the Node module system and NPM allow you to install and use third-party libraries. In this book we will analyze some of the existing solutions for interacting with some types of databases and what interesting uses can you give them. This first short book on databases starts with some of my favourites: LevelDB, Redis and CouchDB. Table of Contents Chapter 1. The source code Chapter 2. Introduction Chapter 3. An embedded database using LevelDB Chapter 4. Redis Chapter 5. CouchDB

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值