如何使用 MarkLogic API 在 MarkLogic 集群中添加多个 bootstrap 主机?
How can I add multiple bootstrap hosts in the MarkLogic cluster using MarkLogic API?
我必须在使用 ml-gradle.
部署期间使用 marklogic API 在集群中创建多个 bootstrap 主机
我知道我可以通过管理控制台(8001 端口)配置它,但我不知道如何使用 MarkLogic API 在 MarkLogic 集群中添加多个 bootstrap 主机?
我假设您指的是 Management API。如果是这种情况,那么您可以 POST 针对主机端点来定义 bootstrap 主机
https://docs.marklogic.com/REST/POST/manage/v2/hosts
cat myHost.json
==>
{
"host-name": "hostname1",
"group": "",
"bind-port": 8090,
"foreign-bind-port": 9091,
"zone": "",
"bootstrap-host": true
}
curl -X POST --digest -u admin:admin -H "Content-type: application/json" \
-d @myHost.json http://localhost:8002/manage/v2/hosts
==> Defines the host, named "hostname1," as the bootstrap host in
the cluster.
Bootstrap 主机 -> dh5a
目标加入主机->dh5b
- 将 dh5b 配置保存为 dh5b-config.xml
curl -o dh5b-config.xml --user {authen-user:passwd} \
-X GET -H "Content-type:application/xml" \
http://dh5b:8001/admin/v1/server-config
- 将 dh5b 配置作为集群发送到 dh5a-config.zip
curl --digest --user {authen-user:passwd} -X POST -o cluster-config.zip -d "group=Default" \
--data-urlencode "server-config@./dh5b-config.xml" \
-H "Content-type: application/x-www-form-urlencoded" \
http://dh5a:8001/admin/v1/cluster-config
- 发送集群-config.zip到dh5b并完成加入过程
curl --anyauth --user {authen-user:passwd} -X POST -H "Content-type: application/zip" \
--data-binary @./cluster-config.zip \
http://dh5b:8001/admin/v1/cluster-config
对于生产部署:
1) Use Gradle to deploy additional hosts if Gradle is permitted
2) Write/Execute Shell script to include above API operations
(This approach has a lot more fun: combination of old Shell and modern API)
然后您可以使用自动化工具调用 Shell 或 Gradle。
以下案例在 Postman 中工作:
HTTP Verb:
PUT
Authorization:
Digest Auth admin:admin
Header:
Content-Type application/json
URI:
{ml-host}:8002/manage/v2/hosts/{new-bootstrap-host}/properties
Body:
{
"bootstrap-host": true
}
我必须在使用 ml-gradle.
部署期间使用 marklogic API 在集群中创建多个 bootstrap 主机我知道我可以通过管理控制台(8001 端口)配置它,但我不知道如何使用 MarkLogic API 在 MarkLogic 集群中添加多个 bootstrap 主机?
我假设您指的是 Management API。如果是这种情况,那么您可以 POST 针对主机端点来定义 bootstrap 主机
https://docs.marklogic.com/REST/POST/manage/v2/hosts
cat myHost.json
==>
{
"host-name": "hostname1",
"group": "",
"bind-port": 8090,
"foreign-bind-port": 9091,
"zone": "",
"bootstrap-host": true
}
curl -X POST --digest -u admin:admin -H "Content-type: application/json" \
-d @myHost.json http://localhost:8002/manage/v2/hosts
==> Defines the host, named "hostname1," as the bootstrap host in
the cluster.
Bootstrap 主机 -> dh5a
目标加入主机->dh5b
- 将 dh5b 配置保存为 dh5b-config.xml
curl -o dh5b-config.xml --user {authen-user:passwd} \
-X GET -H "Content-type:application/xml" \
http://dh5b:8001/admin/v1/server-config
- 将 dh5b 配置作为集群发送到 dh5a-config.zip
curl --digest --user {authen-user:passwd} -X POST -o cluster-config.zip -d "group=Default" \
--data-urlencode "server-config@./dh5b-config.xml" \
-H "Content-type: application/x-www-form-urlencoded" \
http://dh5a:8001/admin/v1/cluster-config
- 发送集群-config.zip到dh5b并完成加入过程
curl --anyauth --user {authen-user:passwd} -X POST -H "Content-type: application/zip" \
--data-binary @./cluster-config.zip \
http://dh5b:8001/admin/v1/cluster-config
对于生产部署:
1) Use Gradle to deploy additional hosts if Gradle is permitted
2) Write/Execute Shell script to include above API operations
(This approach has a lot more fun: combination of old Shell and modern API)
然后您可以使用自动化工具调用 Shell 或 Gradle。
以下案例在 Postman 中工作:
HTTP Verb:
PUT
Authorization:
Digest Auth admin:admin
Header:
Content-Type application/json
URI:
{ml-host}:8002/manage/v2/hosts/{new-bootstrap-host}/properties
Body:
{
"bootstrap-host": true
}