Vitaly Repin wrote:
> Hello,
>
> I have a question about usage of the same lmdb database in different
> containers and in the host machine.
>
> So far I just mapped lmdp file in docker-compose.yml:
>
> volumes:
> - "/var/spool/lmdbenv/:/var/spool/lmdbenv/"
>
> And I'm reading/writing to/from the database from different containers.
>
> Everything seems to work at a first glance.
>
> Example of adding an element to lmdb:
>
> /usr/bin/python -mlmdb --env /var/spool/lmdbenv edit \
> --set "client"="{
> \"client_ip\" : \"$client_ip\",
> \"client_data\" : \"$client_data\"
> }"
>
> Is it the proper use case for lmdb? Is there any special "flush" API which I
> have to use to make sure that the record inserted in one container becomes
> visible
> in another?
LMDB requires every process using it to have a unique PID. Usually containers
all run their job as PID number 1, you'll have to make sure
they all use unique PIDs.
> Thanks in advance!
>
> --
> WBR & WBW, Vitaly
--
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/