I have a couple of apps that share a datahike db (with a file backend). This works when the apps are run natively on the host, and when they are both running inside the same container. However, when they're run in separate containers and share the datahike db via a volume, datahike says the database is corrupt. Is this a known problem? Should I avoid the file backend completely in this scenario? These are embedded apps so I'd like to avoid additional services on the device because there isn't much CPU and memory to spare. Should I run the datahike http server with a file backend? Or what would be a better backend choice in this scenario? Thanks!
BTW, we are very happy for help improving documentation
@tvaughan You can share a file backend for reading (queries etc.) and it should work even with a volume, but you cannot transact (write) into the database from multiple processes at the same time. This is true independently of the storage backend.
@whilo Thanks. That’s very helpful. At the moment the services in question are read-only, but this won’t be true forever
@tvaughan have you seen https://cljdoc.org/d/io.replikativ/datahike/0.6.1558/doc/distribution?
You can find some documentation there. You need to build the datahike server yourself unfortunately or run from sources.
Hi @tvaughan, sorry for waiting that long. I am on holiday. So you are using one Datahike instance with multiple apps? Are these apps running inside one JVM? Or are you sharing the backend only? Sharing a backend is not supported the way I assume you are doing. If you want to share Datahike between multiple instances of one app or between different apps you will have to use the Datahike server. Sorry, that there is not that much documentation currently available but if you want to use it I can try to help you.
You can not run one backend with multiple Datahike instances without the server
Thanks @timok. These are two completely separate apps that both use the file backend and share the same path setting running simultaneously on the same machine. This "works" when the apps run natively on the same host, or inside the same container. This does not work when the two apps run in different containers and share the database path via a volume.
I tried to search through the docs to find instructions for setting up a Datahike server, however I'm still lost on how to do this. Where should I look exactly?
No rush on any of this. I appreciate your help. Enjoy your holiday!