如何使用MarkLogic API在MarkLogic集群中添加多个引导主机?

如何使用MarkLogic API在MarkLogic集群中添加多个引导主机?,marklogic,marklogic-9,Marklogic,Marklogic 9,在使用ml gradle部署期间,我必须使用marklogic API在集群中创建多个引导主机 我知道我可以通过管理控制台(8001端口)进行配置,但我不知道如何使用MarkLogic API在MarkLogic集群中添加多个引导主机 我假定您指的是。如果是这种情况,那么您可以针对hosts端点进行POST,以定义引导主机 引导主机->dh5a 目标加入主机->dh5b 将dh5b config另存为dh5b-config.xml 将dh5b配置作为cluster-config.zip发送到d

在使用ml gradle部署期间,我必须使用marklogic API在集群中创建多个引导主机

我知道我可以通过管理控制台(8001端口)进行配置,但我不知道如何使用MarkLogic API在MarkLogic集群中添加多个引导主机


我假定您指的是。如果是这种情况,那么您可以针对hosts端点进行POST,以定义引导主机


引导主机->dh5a

目标加入主机->dh5b

  • 将dh5b config另存为dh5b-config.xml
  • 将dh5b配置作为cluster-config.zip发送到dh5a
  • 将cluster-config.zip发送到dh5b并完成加入过程
  • 对于生产部署:

    1) 如果允许使用Gradle,请使用Gradle部署其他主机

    2) 编写/执行Shell脚本以包含上述API操作

    (这种方法有很多乐趣:旧Shell和现代API的结合)

    然后可以使用自动化工具调用Shell或Gradle


    以下案例在《邮差》工作:

    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
    }  
    

    获取错误状态:405方法不允许“REST-UNSUPPORTEDMETHOD:(错误:FOER0000)终结点不支持方法:POST”
    curl -o dh5b-config.xml --user {authen-user:passwd} \
    -X GET -H "Content-type:application/xml" \
    http://dh5b:8001/admin/v1/server-config
    
    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
    
    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
    
    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
    }