Manish Narang
Manish Narang

Reputation: 87

How can I add multiple bootstrap hosts in the MarkLogic cluster using MarkLogic API?

I have to create multiple bootstrap hosts in the clusters using marklogic API during deployment using ml-gradle.

I know I can configure it by admin console (8001 port) but I am not able to figure out how can I add multiple bootstrap hosts in the MarkLogic cluster using MarkLogic API?

Edit Local Cluster Configuration

Upvotes: 3

Views: 136

Answers (3)

Manish Narang
Manish Narang

Reputation: 87

Following case worked in 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
}  

Upvotes: 3

Fiona Chen
Fiona Chen

Reputation: 1368

Bootstrap host -> dh5a

Target joining host -> dh5b

  1. Save dh5b config as 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
  1. Send dh5b config to dh5a as cluster-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
  1. Send cluster-config.zip to dh5b and complete the joining process
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

For production deployment:

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)

You can then use automation tool to invoke Shell or Gradle.

Upvotes: 1

Mike Gardner
Mike Gardner

Reputation: 6651

I will assume you are referring to the Management API. If that's the case, then you can POST against the hosts endpoint to define bootstrap hosts

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. 

Upvotes: 3

Related Questions