I think fabric had two parts to persist data:
1.storing transaction data on ledger as blockfiles .
i can set as the follow
sbt “run --port 6865 --role provision,time,ledger” -J-DfabricConfigFile=config-local.yaml
2.storing contract template and index in leveldb(like postgresql ,couchdb) .
while how to set the leveldb in daml ?
and all of my mind is right ?
Hi Hui Xin (apologies in advance on any misspellings of your name)
In terms of databases involved in the DAML on Fabric setup, there are two of concern
- The database used as the Fabric key/value store
- the database used as the DAML-specific index database.
For #1 the default Fabric key value store is LevelDB and that is what is used in the default daml-on-fabric setup. We have opted for this as we have found it to be more performant than CouchDB. If you want to use CouchDB instead the instructions on how to do this are documented in the more detailed README.md in the src/test/fixture directory daml-on-fabric/README.md at 98dcdd98570180c00ee98615c0556c7276515f6f · digital-asset/daml-on-fabric · GitHub
For #2 the default local indexDB used for CI and in the default configuration is in-memory H2 – this can be switched to be a persistent Postgres instance by changing the jdbcUrl connection string passed at startup
Default (H2 in memory)
jdbc:h2:mem:daml_on_fabric;db_close_delay=-1;db_close_on_exit=false
To use Postgres instead
jdbc:postgresql://{PG_HOST}:{PG_PORT}/${PG_DATABASE}"
where PG_HOST is your Postgres database hostname, PG_PORT is the port of the database and PG_DATABASE is the database name.
jdbcUrl can be passed as a parameter as part of the set run command so something like
sbt “run --port 6865 --role provision,time,ledger --jdbcUrl=jdbc:postgresql://{PG_HOST}:{PG_PORT}/${PG_DATABASE}” -J-DfabricConfigFile=config-local.yaml
Hope this helps