Manage Cluster Segments
Please refer to the Storage Rules documentation.
When a data segment is complete, the server selects the host(s) to place the segment on by looking up a segment-related key in the storage partition table. The partitions map to a set of nodes. All of these nodes are then assigned as owners of the segment and will start getting their copy shortly after.
You can modify the storage partitions at any time. Any number of partitions larger than the number of nodes is allowed, but the recommended the number of storage partitions is 24 or a similar fairly low number. There is no benefit in having a large number of partitions.
Existing segments are not moved when re-assigning partitions. Partitions only affect segments completed after they are POST'ed.
Show Storage Partitions Assigned to Nodes
Description | List the segment partitions of a node in the cluster. | |
Method | GET /api/v1/clusterconfig/segments/partitions | |
Authentication Required | yes | |
Return Codes | ||
200 | Request complete | |
400 | Bad authentication | |
500 | Request failed |
GET /api/v1/clusterconfig/segments/partitions
To redirect the output to a JSON file, run the script like this:
$ script>$YOUR_FILE_NAME.json
You can then use this as the payload in further requests when updating the information.
curl -v -X GET $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/partitions \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
curl -v -X GET $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/partitions \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
curl -v -X GET $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/partitions ^
-H "Authorization: Bearer $TOKEN" ^
-H "Content-Type: application/json"
curl.exe -X GET
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/json"
#!/usr/bin/perl
use HTTP::Request;
use LWP;
my $INGEST_TOKEN = "TOKEN";
my $uri = '$YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/partitions';
my $req = HTTP::Request->new("GET", $uri );
$req->header("Authorization" => "Bearer $TOKEN");
$req->header("Content-Type" => "application/json");
my $lwp = LWP::UserAgent->new;
my $result = $lwp->request( $req );
print $result->{"_content"},"\n";
#! /usr/local/bin/python3
import requests
url = '$YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/partitions'
resp = requests.get(url,
headers = {
"Authorization" : "Bearer $TOKEN",
"Content-Type" : "application/json"
}
)
print(resp.text)
const https = require('https');
let request = https.get('$YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/partitions', (res) => {
if (res.statusCode !== 200) {
console.error(`Error from server. Code: ${res.statusCode}`);
res.resume();
return;
}
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('close', () => {
console.log('Response:');
console.log(JSON.parse(data));
});
});
return(undef,undef);
}
Assign Storage Partitions to Nodes
Description | Assign the segment partitions to nodes in the cluster. | |
Method | POST /api/v1/clusterconfig/segments/partitions | |
Request Data | ||
Authentication Required | yes | |
Return Codes | ||
200 | Request complete | |
400 | Bad authentication | |
500 | Request failed |
POST /api/v1/clusterconfig/segments/partitions
curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/partitions \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '@$YOUR_FILE_NAME.json'
curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/partitions \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '@$YOUR_FILE_NAME.json'
curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/partitions ^
-H "Authorization: Bearer $TOKEN" ^
-H "Content-Type: application/json" ^
-d '@$YOUR_FILE_NAME.json'
curl.exe -X POST
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/json"
-d '@$YOUR_FILE_NAME.json'
"$YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/partitions"
#!/usr/bin/perl
use HTTP::Request;
use LWP;
my $INGEST_TOKEN = "TOKEN";
my $uri = '$YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/partitions';
my $json = '@$YOUR_FILE_NAME.json';
my $req = HTTP::Request->new("POST", $uri );
$req->header("Authorization" => "Bearer $TOKEN");
$req->header("Content-Type" => "application/json");
$req->content( $json );
my $lwp = LWP::UserAgent->new;
my $result = $lwp->request( $req );
print $result->{"_content"},"\n";
#! /usr/local/bin/python3
import requests
url = '$YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/partitions'
mydata = r'''@$YOUR_FILE_NAME.json'''
resp = requests.post(url,
data = mydata,
headers = {
"Authorization" : "Bearer $TOKEN",
"Content-Type" : "application/json"
}
)
print(resp.text)
const https = require('https');
const data = JSON.stringify(
@$YOUR_FILE_NAME.json
);
const options = {
hostname: '$YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/partitions',
path: '/graphql',
port: 443,
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Content-Length': data.length,
Authorization: 'BEARER ' + process.env.TOKEN,
'User-Agent': 'Node',
},
};
const req = https.request(options, (res) => {
let data = '';
console.log(`statusCode: ${res.statusCode}`);
res.on('data', (d) => {
data += d;
});
res.on('end', () => {
console.log(JSON.parse(data).data);
});
});
req.on('error', (error) => {
console.error(error);
});
req.write(data);
req.end();
Apply Default Partition Settings
This is a shortcut to getting all members of a cluster to have the same share of the load on both Digest and Storage Partitions.
Description | Modify the segment partitions of a node in the cluster. | |
Method | POST /api/v1/clusterconfig/segments/partitions/setdefaults | |
Request Data | ||
Authentication Required | yes | |
Return Codes | ||
200 | Request complete | |
400 | Bad authentication | |
500 | Request failed |
POST /api/v1/clusterconfig/segments/partitions/setdefaults
curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/partitions/setdefaults \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/partitions/setdefaults \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/partitions/setdefaults ^
-H "Authorization: Bearer $TOKEN" ^
-H "Content-Type: application/json"
curl.exe -X POST
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/json"
"$YOUR_LOGSCALE_URL/api/v1/clusterconfig/partitions/setdefaults"
#!/usr/bin/perl
use HTTP::Request;
use LWP;
my $INGEST_TOKEN = "TOKEN";
my $uri = '$YOUR_LOGSCALE_URL/api/v1/clusterconfig/partitions/setdefaults';
my $json = '';
my $req = HTTP::Request->new("POST", $uri );
$req->header("Authorization" => "Bearer $TOKEN");
$req->header("Content-Type" => "application/json");
$req->content( $json );
my $lwp = LWP::UserAgent->new;
my $result = $lwp->request( $req );
print $result->{"_content"},"\n";
#! /usr/local/bin/python3
import requests
url = '$YOUR_LOGSCALE_URL/api/v1/clusterconfig/partitions/setdefaults'
mydata = r''
resp = requests.post(url,
data = mydata,
headers = {
"Authorization" : "Bearer $TOKEN",
"Content-Type" : "application/json"
}
)
print(resp.text)
const https = require('https');
const options = {
hostname: '$YOUR_LOGSCALE_URL/api/v1/clusterconfig/partitions/setdefaults',
path: '/graphql',
port: 443,
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Content-Length': data.length,
Authorization: 'BEARER ' + process.env.TOKEN,
'User-Agent': 'Node',
},
};
const req = https.request(options, (res) => {
let data = '';
console.log(`statusCode: ${res.statusCode}`);
res.on('data', (d) => {
data += d;
});
res.on('end', () => {
console.log(JSON.parse(data).data);
});
});
req.on('error', (error) => {
console.error(error);
});
req.write(data);
req.end();
Assign Default Storage Partitions to Nodes
When the set of nodes has been modified, you likely want to make the storage partitions distribute the storage load evenly among the current set of nodes. The following API allows doing that, while also selecting the number of replicas to use.
Any number of partitions larger than the number of nodes is allowed, but the recommended the number of storage partitions is 24 or similar fairly low number. There is no gain in having a large number of partitions.
The number of replicas must be at least one and at most the number of nodes in the cluster. The replicas select how many nodes should keep a copy of each completed segment.
Description | Modify the segment partitions of a node in the cluster. | |
Method | POST /api/v1/clusterconfig/segments/partitions/set-replication-defaults | |
Request Data | ||
Authentication Required | yes | |
Return Codes | ||
200 | Request complete | |
400 | Bad authentication | |
500 | Request failed |
POST /api/v1/clusterconfig/segments/partitions/set-replication-defaults
The format of the file should be a JSON object with partition count and replicas:
$ echo '{ "partitionCount": 7, "replicas": 2 }' > YOUR_FILE_NAME.json
curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/partitions/set-replication-defaults \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '@$YOUR_FILE_NAME.json'
curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/partitions/set-replication-defaults \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '@$YOUR_FILE_NAME.json'
curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/partitions/set-replication-defaults ^
-H "Authorization: Bearer $TOKEN" ^
-H "Content-Type: application/json" ^
-d '@$YOUR_FILE_NAME.json'
curl.exe -X POST
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/json"
-d '@$YOUR_FILE_NAME.json'
"$YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/partitions/set-replication-defaults"
#!/usr/bin/perl
use HTTP::Request;
use LWP;
my $INGEST_TOKEN = "TOKEN";
my $uri = '$YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/partitions/set-replication-defaults';
my $json = '@$YOUR_FILE_NAME.json';
my $req = HTTP::Request->new("POST", $uri );
$req->header("Authorization" => "Bearer $TOKEN");
$req->header("Content-Type" => "application/json");
$req->content( $json );
my $lwp = LWP::UserAgent->new;
my $result = $lwp->request( $req );
print $result->{"_content"},"\n";
#! /usr/local/bin/python3
import requests
url = '$YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/partitions/set-replication-defaults'
mydata = r'''@$YOUR_FILE_NAME.json'''
resp = requests.post(url,
data = mydata,
headers = {
"Authorization" : "Bearer $TOKEN",
"Content-Type" : "application/json"
}
)
print(resp.text)
const https = require('https');
const data = JSON.stringify(
@$YOUR_FILE_NAME.json
);
const options = {
hostname: '$YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/partitions/set-replication-defaults',
path: '/graphql',
port: 443,
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Content-Length': data.length,
Authorization: 'BEARER ' + process.env.TOKEN,
'User-Agent': 'Node',
},
};
const req = https.request(options, (res) => {
let data = '';
console.log(`statusCode: ${res.statusCode}`);
res.on('data', (d) => {
data += d;
});
res.on('end', () => {
console.log(JSON.parse(data).data);
});
});
req.on('error', (error) => {
console.error(error);
});
req.write(data);
req.end();
Prune Replicas when Reducing Replica Setting
If the number of replicas has been reduced, existing segments in the cluster do not get their replica count reduced. In order to reduce the number of replicas on existing segments, invoke this:
Description | Reduce the number of replicas on existing segments. | |
Method | POST /api/v1/clusterconfig/segments | |
Request Data | ||
Authentication Required | yes | |
Return Codes | ||
200 | Request complete | |
400 | Bad authentication | |
500 | Request failed |
POST /api/v1/clusterconfig/segments/prune-replicas
curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/prune-replicas \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/prune-replicas \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/prune-replicas ^
-H "Authorization: Bearer $TOKEN" ^
-H "Content-Type: application/json"
curl.exe -X POST
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/json"
"$YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/prune-replicas"
#!/usr/bin/perl
use HTTP::Request;
use LWP;
my $INGEST_TOKEN = "TOKEN";
my $uri = '$YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/prune-replicas';
my $json = '';
my $req = HTTP::Request->new("POST", $uri );
$req->header("Authorization" => "Bearer $TOKEN");
$req->header("Content-Type" => "application/json");
$req->content( $json );
my $lwp = LWP::UserAgent->new;
my $result = $lwp->request( $req );
print $result->{"_content"},"\n";
#! /usr/local/bin/python3
import requests
url = '$YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/prune-replicas'
mydata = r''
resp = requests.post(url,
data = mydata,
headers = {
"Authorization" : "Bearer $TOKEN",
"Content-Type" : "application/json"
}
)
print(resp.text)
const https = require('https');
const options = {
hostname: '$YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/prune-replicas',
path: '/graphql',
port: 443,
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Content-Length': data.length,
Authorization: 'BEARER ' + process.env.TOKEN,
'User-Agent': 'Node',
},
};
const req = https.request(options, (res) => {
let data = '';
console.log(`statusCode: ${res.statusCode}`);
res.on('data', (d) => {
data += d;
});
res.on('end', () => {
console.log(JSON.parse(data).data);
});
});
req.on('error', (error) => {
console.error(error);
});
req.write(data);
req.end();
Move Existing Segments Evenly Between Nodes
This endpoint moves segments so that all nodes have their fair share of the segments, as stated in the storage partitioning setting, but as much as possible leaving segments where they are. It's also possible to apply the current partitioning scheme to all existing segments, possibly moving every segment to a new node.
Description | Modify settings for segments in a cluster. | |
Method | POST /api/v1/clusterconfig/segments/distribute-evenly | |
Request Data | ||
Authentication Required | yes | |
Return Codes | ||
200 | Request complete | |
400 | Bad authentication | |
500 | Request failed |
POST /api/v1/clusterconfig/segments/distribute-evenly
curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/distribute-evenly \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/distribute-evenly \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/distribute-evenly ^
-H "Authorization: Bearer $TOKEN" ^
-H "Content-Type: application/json"
curl.exe -X POST
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/json"
"$YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/distribute-evenly"
#!/usr/bin/perl
use HTTP::Request;
use LWP;
my $INGEST_TOKEN = "TOKEN";
my $uri = '$YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/distribute-evenly';
my $json = '';
my $req = HTTP::Request->new("POST", $uri );
$req->header("Authorization" => "Bearer $TOKEN");
$req->header("Content-Type" => "application/json");
$req->content( $json );
my $lwp = LWP::UserAgent->new;
my $result = $lwp->request( $req );
print $result->{"_content"},"\n";
#! /usr/local/bin/python3
import requests
url = '$YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/distribute-evenly'
mydata = r''
resp = requests.post(url,
data = mydata,
headers = {
"Authorization" : "Bearer $TOKEN",
"Content-Type" : "application/json"
}
)
print(resp.text)
const https = require('https');
const options = {
hostname: '$YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/distribute-evenly',
path: '/graphql',
port: 443,
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Content-Length': data.length,
Authorization: 'BEARER ' + process.env.TOKEN,
'User-Agent': 'Node',
},
};
const req = https.request(options, (res) => {
let data = '';
console.log(`statusCode: ${res.statusCode}`);
res.on('data', (d) => {
data += d;
});
res.on('end', () => {
console.log(JSON.parse(data).data);
});
});
req.on('error', (error) => {
console.error(error);
});
req.write(data);
req.end();
Reshuffle All Existing Segments Between Nodes
This endpoint moves segments so that all nodes have their fair share of the segments, as stated in the storage partitioning setting, but as much as possible leaving segments where they are. It's also possible to apply the current partitioning scheme to all existing segments, possibly moving every segment to a new node.
Description | Reshuffle existing segments between nodes. | ||
Method | POST /api/v1/clusterconfig/segments/ | ||
Request Data | |||
Authentication Required | yes | ||
Path Arguments | Description | Data type | Required? |
percentage | Percentage of full set of data to which this action should be applied. | integer | optional |
Return Codes | |||
200 | Request complete | ||
400 | Bad authentication | ||
500 | Request failed |
POST /api/v1/clusterconfig/segments/distribute-evenly-reshuffle-all
curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/distribute-evenly-reshuffle-all \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/distribute-evenly-reshuffle-all \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/distribute-evenly-reshuffle-all ^
-H "Authorization: Bearer $TOKEN" ^
-H "Content-Type: application/json"
curl.exe -X POST
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/json"
"$YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/distribute-evenly-reshuffle-all"
#!/usr/bin/perl
use HTTP::Request;
use LWP;
my $INGEST_TOKEN = "TOKEN";
my $uri = '$YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/distribute-evenly-reshuffle-all';
my $json = '';
my $req = HTTP::Request->new("POST", $uri );
$req->header("Authorization" => "Bearer $TOKEN");
$req->header("Content-Type" => "application/json");
$req->content( $json );
my $lwp = LWP::UserAgent->new;
my $result = $lwp->request( $req );
print $result->{"_content"},"\n";
#! /usr/local/bin/python3
import requests
url = '$YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/distribute-evenly-reshuffle-all'
mydata = r''
resp = requests.post(url,
data = mydata,
headers = {
"Authorization" : "Bearer $TOKEN",
"Content-Type" : "application/json"
}
)
print(resp.text)
const https = require('https');
const options = {
hostname: '$YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/distribute-evenly-reshuffle-all',
path: '/graphql',
port: 443,
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Content-Length': data.length,
Authorization: 'BEARER ' + process.env.TOKEN,
'User-Agent': 'Node',
},
};
const req = https.request(options, (res) => {
let data = '';
console.log(`statusCode: ${res.statusCode}`);
res.on('data', (d) => {
data += d;
});
res.on('end', () => {
console.log(JSON.parse(data).data);
});
});
req.on('error', (error) => {
console.error(error);
});
req.write(data);
req.end();
Distribute Stored Data to a Node
If a new node is added, and you want it to take its fair share of the currently stored data, use "distribute-evenly-to-host".
Description | Move existing segments between nodes. | ||
Method | POST /api/v1/clusterconfig/segments/ | ||
Request Data | |||
Authentication Required | yes | ||
Path Arguments | Description | Data type | Required? |
id | ID of the node configuration | string | required |
percentage | Percentage of full set of data to which this action should be applied. | integer | optional |
Return Codes | |||
200 | Request complete | ||
400 | Bad authentication | ||
500 | Request failed |
POST /api/v1/clusterconfig/segments/distribute-evenly-to-host/$NODE_ID
curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/distribute-evenly-to-host/$NODE_ID \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/distribute-evenly-to-host/$NODE_ID \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/distribute-evenly-to-host/$NODE_ID ^
-H "Authorization: Bearer $TOKEN" ^
-H "Content-Type: application/json"
curl.exe -X POST
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/json"
"$YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/distribute-evenly-to-host/$NODE_ID"
#!/usr/bin/perl
use HTTP::Request;
use LWP;
my $INGEST_TOKEN = "TOKEN";
my $uri = '$YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/distribute-evenly-to-host/$NODE_ID';
my $json = '';
my $req = HTTP::Request->new("POST", $uri );
$req->header("Authorization" => "Bearer $TOKEN");
$req->header("Content-Type" => "application/json");
$req->content( $json );
my $lwp = LWP::UserAgent->new;
my $result = $lwp->request( $req );
print $result->{"_content"},"\n";
#! /usr/local/bin/python3
import requests
url = '$YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/distribute-evenly-to-host/$NODE_ID'
mydata = r''
resp = requests.post(url,
data = mydata,
headers = {
"Authorization" : "Bearer $TOKEN",
"Content-Type" : "application/json"
}
)
print(resp.text)
const https = require('https');
const options = {
hostname: '$YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/distribute-evenly-to-host/$NODE_ID',
path: '/graphql',
port: 443,
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Content-Length': data.length,
Authorization: 'BEARER ' + process.env.TOKEN,
'User-Agent': 'Node',
},
};
const req = https.request(options, (res) => {
let data = '';
console.log(`statusCode: ${res.statusCode}`);
res.on('data', (d) => {
data += d;
});
res.on('end', () => {
console.log(JSON.parse(data).data);
});
});
req.on('error', (error) => {
console.error(error);
});
req.write(data);
req.end();
Distribute Stored Data from a Node
It's possible to move all existing segments off a node. If that node is not assigned any partitions at all (both storage and ingest), this then relieves the node of all duties, preparing it to be deleted from the cluster.
Description | Move existing segments between nodes. | ||
Method | POST /api/v1/clusterconfig/segments/ | ||
Request Data | |||
Authentication Required | yes | ||
Path Arguments | Description | Data type | Required? |
id | ID of the node configuration | string | required |
percentage | Percentage of full set of data to which this action should be applied. | integer | optional |
Return Codes | |||
200 | Request complete | ||
400 | Bad authentication | ||
500 | Request failed |
POST /api/v1/clusterconfig/segments/distribute-evenly-from-host/$NODE_ID
curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/distribute-evenly-from-host/$NODE_ID \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/distribute-evenly-from-host/$NODE_ID \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/distribute-evenly-from-host/$NODE_ID ^
-H "Authorization: Bearer $TOKEN" ^
-H "Content-Type: application/json"
curl.exe -X POST
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/json"
"$YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/distribute-evenly-from-host/$NODE_ID"
#!/usr/bin/perl
use HTTP::Request;
use LWP;
my $INGEST_TOKEN = "TOKEN";
my $uri = '$YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/distribute-evenly-from-host/$NODE_ID';
my $json = '';
my $req = HTTP::Request->new("POST", $uri );
$req->header("Authorization" => "Bearer $TOKEN");
$req->header("Content-Type" => "application/json");
$req->content( $json );
my $lwp = LWP::UserAgent->new;
my $result = $lwp->request( $req );
print $result->{"_content"},"\n";
#! /usr/local/bin/python3
import requests
url = '$YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/distribute-evenly-from-host/$NODE_ID'
mydata = r''
resp = requests.post(url,
data = mydata,
headers = {
"Authorization" : "Bearer $TOKEN",
"Content-Type" : "application/json"
}
)
print(resp.text)
const https = require('https');
const options = {
hostname: '$YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/distribute-evenly-from-host/$NODE_ID',
path: '/graphql',
port: 443,
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Content-Length': data.length,
Authorization: 'BEARER ' + process.env.TOKEN,
'User-Agent': 'Node',
},
};
const req = https.request(options, (res) => {
let data = '';
console.log(`statusCode: ${res.statusCode}`);
res.on('data', (d) => {
data += d;
});
res.on('end', () => {
console.log(JSON.parse(data).data);
});
});
req.on('error', (error) => {
console.error(error);
});
req.write(data);
req.end();