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

标签 docker marklogic

我想在 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/

相关文章:

mysql - docker 建立 : error: ER_NOT_SUPPORTED_AUTH_MODE: MySQL client

mysql - 仅向用户提供 GRANT EXECUTE 'procedure'(无选择或插入权限)

neo4j - 快速查询上的三元组与 native 图数据库

sparql - 如何区分 SQL 三元组和显式三元组?

docker - 如何使用 buildspec.yml 从 AWS CodePipeline 中的 Dockerfile 构建镜像,然后推送到 ECR?

python - 从已卸载的wheel生成requirements.txt

xquery - 如何使用 MarkLogic cts :query() 进行 "begins with"查询

xquery - 使用 MarkLogic 时不要在构面中包含重复数据

javascript - Marklogic 异常处理

docker - Docker Compose给出无效的环境类型错误