Hyperledger Fabric节点文件系统中账本及状态数据库存储位置咨询
Hyperledger Fabric: LevelDB & CouchDB Storage Locations
Great question! When working through Hyperledger Fabric samples, it’s super common to wonder where all that underlying data lives—especially since LevelDB and CouchDB handle state storage in such different ways. Let’s break down their storage locations based on how you’re running your Fabric nodes:
LevelDB Storage Location
LevelDB is the embedded default state database, so its data is tightly tied to the peer node’s file system:
- Docker container deployment (most Fabric samples use this):
Each peer container mounts a Docker volume to store persistent data at/var/hyperledger/productioninside the container. LevelDB’s state data lives specifically in theledgersData/stateLeveldbsubdirectory of this path.
To find the corresponding host machine path, list your Docker volumes withdocker volume ls, then inspect the specific peer’s volume (e.g.,peer0.org1.example.com) using:
Thedocker volume inspect peer0.org1.example.comMountpointfield in the output will show you exactly where the data lives on your host. - Bare-metal deployment (running peer binaries directly):
By default, LevelDB data is stored in$FABRIC_CFG_PATH/production/ledgersData/stateLeveldb. The$FABRIC_CFG_PATHenvironment variable defaults to/etc/hyperledger/fabricunless you’ve modified it. You can also check thecore.yamlconfiguration file for theledger.dataDirandledger.state.leveldb.pathsettings to confirm the exact path.
CouchDB Storage Location
CouchDB runs as an external service (even when containerized), so its storage is separate from the peer node:
- Docker container deployment (sample setup):
Fabric samples typically spin up CouchDB containers with a dedicated volume mounted to/opt/couchdb/datainside the container—this is where CouchDB stores all its database files.
Similar to LevelDB, you can inspect the CouchDB volume (e.g.,couchdb0) withdocker volume inspect couchdb0to get the host machine’s mount path.
Note: The peer node itself doesn’t store CouchDB data; it just connects to the CouchDB instance via the settings incore.yamlunderledger.state.couchDBConfig. - Bare-metal CouchDB deployment:
If you’ve installed CouchDB directly on your host, the default storage path is/opt/couchdb/data. You can customize this by editing CouchDB’slocal.iniconfiguration file, modifying thedatabase_dirparameter under the[couchdb]section.
内容的提问来源于stack exchange,提问作者Skadoosh
相关产品推荐
相关产品推荐

