跨Docker容器共享内存 [英] Shared memory across docker containers
问题描述
如果使用Java MQ类(而不是JTA,Java应用程序和WMQ)将Websphere MQ用作XA(分布式事务)事务管理器,则两者都必须驻留在同一主机上。有人告诉我这是因为共享内存被用作进程间通信机制。 Java应用程序和Websphere MQ都需要访问共享内存才能使XA工作。
If Websphere MQ is used as a XA(Distributed Transaction) Transaction Manager using Java MQ classes, not JTA, the Java application and the WMQ, both need to reside on the same host machine. I have been told this is because shared memory is used as Inter Process Communication mechanism. The Java application and the Websphere MQ both need access to shared memory to make XA work.
如果我们将WMQ部署在Docker容器中并将Java应用程序保留在另一个Docker容器中,都是在同一主机上,我们能否将WMQ用作XA协调器?
If we deploy WMQ in a docker container and keep our Java application in another docker container, both on the same host, will we be able to use the WMQ as a XA coordinator?
我们将必须使用容器的某些特殊配置来使其正常工作?我们可以允许两个容器使用公共共享内存吗?
Will we have to use certain special configuration of the container to get it working? Can we allow the two containers to use common shared memory?
问候,
Yash
Regards,
Yash
推荐答案
您可以通过-ipc
选项使用常见的IPC名称空间进行运行
和 create
You can use common IPC name spaces via the --ipc
option for run
and create
docker run -d --name=wmq wmq
docker run -d --ipc=container:wmq app
安全主机ipc
docker run -d --ipc=host wmq
docker run -d --ipc=host app
我不确定MQ明确支持XA的任何一种设置,但是IBM确实支持MQ in Docker。
I'm not sure of MQ's explicit support for either setup for XA but IBM do support MQ in Docker.
这篇关于跨Docker容器共享内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!