gpt4 book ai didi

docker - 在docker中安装MarkLogic的2节点集群

转载 作者:行者123 更新时间:2023-12-02 18:18:45 49 4
gpt4 key购买 nike

我想在 docker 中安装 MarkLogic 并形成一个集群,即在同一台机器上运行的两个或多个 ML 节点实例。如何做到这一点?

最佳答案

Building a MarkLogic Docker Container博客条目,它描述了如何创建和初始化运行 MarkLogic 的 Docker 镜像。

在文章底部附近,它描述了如何使用 --link 链接多个容器。开关和 docker-compose协助管理 Docker 容器集群:

链接容器

You are the one who tells Docker how containers should communicate! When using the docker run command, you can also pass in a --link flag.

Consider the following examples:


docker run -d --name=marklogic1 --hostname=marklogic1.local -p 8000-8002:8000-8002 marklogic:8.05-preinitialized

docker run -d --name=marklogic2 --hostname=marklogic2.local --link marklogic1:marklogic1 -p 18000-18002:8000-8002 marklogic:8.05-preinitialized

The above creates two MarkLogic containers. The second has the --link flag. Docker networking sets environment variables and the /etc/hosts file inside each container being linked along and also the linking container. This sets up the ability for Docker containers to communicate over the internal Docker network. The --hostname flag is used to be consistent with MarkLogic, which uses the full domain name when contacting other MarkLogic servers in the cluster. So we simply add the .local domain to the name of the container.

Finally, note the -p flag on the second container exposes the MarkLogic’s ports in the range of 8000 to 8002 to the host computer’s ports of 18000 to 18002. Why not use the host computer’s ports of 8000 to 8002? Because the first container is already using them. Remember, Docker shares networking with the host computer! But of course, you can choose any range of open ports on your host computer to map the container’s MarkLogic ports.

Now, simply point your browser to port 8001 in the first container (marklogic1) and go through the post-installation steps. Skip joining a cluster. When finished, point your browser to port 18001 for the second container (marklogic2) and go through the post-installation steps. When asked to join a cluster, simply use the host name of localhost and leave the port number at 8001. MarkLogic in the second container will contact MarkLogic in the first container. The configuration will be updated such that the marklogic2 joins the cluster with marklogic1. Create and add a third MarkLogic container, also linking it to marklogic1:marklogic1 and marklogic2:marklogic2 and you’ll soon have a proper 3-node MarkLogic cluster!



使用 docker-compose

Docker has created another tool to aid in managing clusters of Docker containers. docker-compose has commands to create multiple containers and network them together. You can then create them, start them and stop them using docker-compose commands. Docker uses a file called Dockerfile to build containers. docker-compose uses a file called docker-compose.yml to build networks of containers.


docker-compose可用作 separate download .

关于docker - 在docker中安装MarkLogic的2节点集群,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59250086/

49 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com