datahike

tvaughan 2024-03-22T12:26:54.978569Z

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!

timo 2024-03-27T07:14:39.052149Z

BTW, we are very happy for help improving documentation

whilo 2024-03-27T19:17:59.833929Z

@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.

tvaughan 2024-03-28T00:37:59.918439Z

@whilo Thanks. That’s very helpful. At the moment the services in question are read-only, but this won’t be true forever

timo 2024-03-27T06:59:54.678719Z

You can find some documentation there. You need to build the datahike server yourself unfortunately or run from sources.

timo 2024-03-25T08:36:39.322329Z

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.

timo 2024-03-25T08:37:18.409489Z

You can not run one backend with multiple Datahike instances without the server

tvaughan 2024-03-25T12:03:20.828399Z

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.

tvaughan 2024-03-25T12:04:20.566289Z

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?

tvaughan 2024-03-25T12:04:50.410319Z

No rush on any of this. I appreciate your help. Enjoy your holiday!