infinity icon indicating copy to clipboard operation
infinity copied to clipboard

[Question]: multiple infinity-embedded instances connect to the same database,can it work?

Open chenk-gd opened this issue 1 year ago • 4 comments

Describe your problem

Planning to use infinity on k8s, not going to use server version of infinity for some reason. However, since there are more than 1 pod copy, I am considering mounting distributed file system on the pod, so that infinity instances on different pods can access the same directory/database, and if simultaneous writes will conflict, I am considering using file locks, etc. to solve the problem, is this approach feasible?

chenk-gd avatar Nov 25 '24 08:11 chenk-gd

I think it's not possible. Infinity is not a file 'opener'. In fact, every write to a file brings about a change in the memory state of the write instance. We wrote on instance A, and the file has changed. At this point, if you go to instance B to read, there is a high probability that you will not be able to read the content, because B will first determine whether there is an update based on the current state in memory.

JinHai-CN avatar Nov 26 '24 03:11 JinHai-CN

I strongly recommend using the Infinity server version, as the new feature of Infinity 0.5.0 includes the ability to use minio as shared storage with read / write node replication capabilities, which can solve the issues with Kubernetes on Infinity

JinHai-CN avatar Nov 26 '24 03:11 JinHai-CN

Thank you for reply. So the Infinity server version can have multiple copies of the pod at the same time, using the same minio shared storage?

chenk-gd avatar Nov 27 '24 03:11 chenk-gd

Thank you for reply. So the Infinity server version can have multiple copies of the pod at the same time, using the same minio shared storage?

Yes, you can set one of them as the write node, others are read nodes.

JinHai-CN avatar Nov 28 '24 08:11 JinHai-CN