Loading TOC...

POST /manage/v2/databases/{id|name}/partitions

Summary

Add a partition to the database.

URL Parameters
format The format of the data in the request body. Can be either json, or xml. Use this parameter to override the Content-type header.
Request Headers
Content-type The MIME type of the data in the request body. If the format parameter is present, it takes precedence over this header. Accepted values: application/xml, application/json.
Response Headers
Location A reference to the newly created partition with which you can construct a URL for the resource that is usable in subsequent requests. For example, /manage/v2/databases/your-db-id/partitions/your-partition-name.

Response

Upon success, MarkLogic server returns status code 201 (Created).

Required Privileges

This operation requires the manage-admin role, or the following privilege:

http://marklogic.com/xdmp/privileges/manage-admin

Usage Notes

You must define the partition key and assignment policy of the database before creating a partition. For details, see Configuring a Database to Participate in Tiered Storage in the Administrator's Guide.

The partition configuration in the POST body must contain at least the partition-name, lower-bound, upper-bound, forests-per-host, and host elements or keys. For more details and a list of available options, see tieredstorage:partition-create.

The structure of the data in the request body is as follows:

partition-name

Name of the partition.

upper-bound

The upper bound of the range on the forest.

lower-bound

The lower bound of the range on the forest.

forests-per-host

Number of forests to distribute per host.

hosts

A list of hosts.

This is a complex structure with the following children:

host

A host name or id.

replicas

Number of forests to allocate to each host for partition creation.

data-directory

The optional public directory for forests.

large-data-directory

The optional directory for large objects in a forest.

fast-data-directory

The optional smaller but faster directory for forests.

options

A list of options.

This is a complex structure with the following children:

option

An option.

Example


The following configuration shows all possible fields.

$ cat add-partition.xml
==> 
<partition xmlns="http://marklogic.com/manage">
  <partition-name>2011</partition-name>
  <lower-bound>2011-01-01</lower-bound>
  <upper-bound>2011-12-31</upper-bound>
  <forests-per-host>1</forests-per-host>
  <hosts>
     <host>host-1</host>
     <host>host-2</host>
  </hosts>
  <data-directory></data-directory>
  <large-data-directory></large-data-directory>
  <fast-data-directory></fast-data-directory>
  <options>
    <option>failover=none</option>
  </options>
</partition>

$ curl --anyauth --user user:password -X POST -d @./add-partition.xml \
    -i -H "Content-type: application/xml" \
    http://localhost:8002/manage/v2/databases/example-db/partitions

==> A new partition named "2011" is created for example-db.
    Forests 2011-0001 and 2011-0002 are created, one on each
    named host. MarkLogic Server responds with headers similar to
    the following.

HTTP/1.1 201 Created
Cache-Control: no-cache
Expires: -1
Location: /manage/v2/databases/13475778675412262560/partitions/2011
Server: MarkLogic
Set-Cookie: SessionID=d647d71d2ffc55d6; path=/
Content-Length: 0
Connection: Keep-Alive
Keep-Alive: timeout=5
    

Example


$ cat add-partition.json
==> 
{
  "partition-name": "2012",
  "lower-bound": "2012-01-01",
  "upper-bound": "2012-12-31",
  "forests-per-host": 1,
  "host": [ "host-1", "host-2" ],
  "option": [ "failover=none" ]
}

$ curl --anyauth --user user:passowrd -X POST -d @./add-partition.json \
    -i -H "Content-type: application/json" 
    http://localhost:8002/manage/v2/databases/example-db/partitions

==> A new partition named "2012" is created for example-db.
    Forests 2012-0001 and 2012-0002 are created, one on each
    named host. MarkLogic Server responds with headers similar to
    the following.

HTTP/1.1 201 Created
Cache-Control: no-cache
Expires: -1
Location: /manage/v2/databases/13475778675412262560/partitions/2012
Server: MarkLogic
Set-Cookie: SessionID=53f1ed9b18ed7196; path=/
Content-Length: 0
Connection: Keep-Alive
Keep-Alive: timeout=5
    

Comments

    Powered by MarkLogic Server 7.0-4.1 and rundmc | Terms of Use | Privacy Policy