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 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.
Show:
Mac OS or Linux (curl) Mac OS or Linux (curl) One-line Windows Cmd and curl Windows Powershell and curl Perl Python Node.js
Mac OS or Linux (curl) curl -v -X GET $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/partitions \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
Mac OS or Linux (curl) One-line curl -v -X GET $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/partitions \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
Windows Cmd and curl curl -v -X GET $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/partitions ^
-H "Authorization: Bearer $TOKEN" ^
-H "Content-Type: application/json"
Windows Powershell and curl curl.exe -X GET
-H "Authorization: Bearer $TOKEN "
-H "Content-Type: application/json"
"$YOUR_LOGSCALE_URL /api/v1/clusterconfig/segments/partitions"
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" ;
Python
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)
Node.js 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 POST /api/v1/clusterconfig/segments/partitions
Show:
Mac OS or Linux (curl) Mac OS or Linux (curl) One-line Windows Cmd and curl Windows Powershell and curl Perl Python Node.js
Mac OS or Linux (curl) 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'
Mac OS or Linux (curl) One-line 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'
Windows Cmd and curl 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'
Windows Powershell and curl 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"
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" ;
Python
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)
Node.js 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 .
POST /api/v1/clusterconfig/segments/partitions/setdefaults
Show:
Mac OS or Linux (curl) Mac OS or Linux (curl) One-line Windows Cmd and curl Windows Powershell and curl Perl Python Node.js
Mac OS or Linux (curl) curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/partitions/setdefaults \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
Mac OS or Linux (curl) One-line curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/partitions/setdefaults \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
Windows Cmd and curl curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/partitions/setdefaults ^
-H "Authorization: Bearer $TOKEN" ^
-H "Content-Type: application/json"
Windows Powershell and curl curl.exe -X POST
-H "Authorization: Bearer $TOKEN "
-H "Content-Type: application/json"
"$YOUR_LOGSCALE_URL /api/v1/clusterconfig/partitions/setdefaults"
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" ;
Python
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)
Node.js 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.
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
Show:
Mac OS or Linux (curl) Mac OS or Linux (curl) One-line Windows Cmd and curl Windows Powershell and curl Perl Python Node.js
Mac OS or Linux (curl) 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'
Mac OS or Linux (curl) One-line 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'
Windows Cmd and curl 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'
Windows Powershell and curl 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"
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" ;
Python
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)
Node.js 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:
POST /api/v1/clusterconfig/segments/prune-replicas
Show:
Mac OS or Linux (curl) Mac OS or Linux (curl) One-line Windows Cmd and curl Windows Powershell and curl Perl Python Node.js
Mac OS or Linux (curl) curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/prune-replicas \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
Mac OS or Linux (curl) One-line curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/prune-replicas \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
Windows Cmd and curl curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/prune-replicas ^
-H "Authorization: Bearer $TOKEN" ^
-H "Content-Type: application/json"
Windows Powershell and curl curl.exe -X POST
-H "Authorization: Bearer $TOKEN "
-H "Content-Type: application/json"
"$YOUR_LOGSCALE_URL /api/v1/clusterconfig/segments/prune-replicas"
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" ;
Python
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)
Node.js 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.
POST /api/v1/clusterconfig/segments/distribute-evenly
Show:
Mac OS or Linux (curl) Mac OS or Linux (curl) One-line Windows Cmd and curl Windows Powershell and curl Perl Python Node.js
Mac OS or Linux (curl) curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/distribute-evenly \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
Mac OS or Linux (curl) One-line curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/distribute-evenly \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
Windows Cmd and curl curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/distribute-evenly ^
-H "Authorization: Bearer $TOKEN" ^
-H "Content-Type: application/json"
Windows Powershell and curl curl.exe -X POST
-H "Authorization: Bearer $TOKEN "
-H "Content-Type: application/json"
"$YOUR_LOGSCALE_URL /api/v1/clusterconfig/segments/distribute-evenly"
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" ;
Python
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)
Node.js 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.
POST /api/v1/clusterconfig/segments/distribute-evenly-reshuffle-all
Show:
Mac OS or Linux (curl) Mac OS or Linux (curl) One-line Windows Cmd and curl Windows Powershell and curl Perl Python Node.js
Mac OS or Linux (curl) curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/distribute-evenly-reshuffle-all \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
Mac OS or Linux (curl) One-line curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/distribute-evenly-reshuffle-all \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
Windows Cmd and curl curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/clusterconfig/segments/distribute-evenly-reshuffle-all ^
-H "Authorization: Bearer $TOKEN" ^
-H "Content-Type: application/json"
Windows Powershell and curl curl.exe -X POST
-H "Authorization: Bearer $TOKEN "
-H "Content-Type: application/json"
"$YOUR_LOGSCALE_URL /api/v1/clusterconfig/segments/distribute-evenly-reshuffle-all"
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" ;
Python
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)
Node.js 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".
POST /api/v1/clusterconfig/segments/distribute-evenly-to-host/$NODE_ID
Show:
Mac OS or Linux (curl) Mac OS or Linux (curl) One-line Windows Cmd and curl Windows Powershell and curl Perl Python Node.js
Mac OS or Linux (curl) 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"
Mac OS or Linux (curl) One-line 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"
Windows Cmd and curl 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"
Windows Powershell and curl 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 "
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" ;
Python
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)
Node.js 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.
POST /api/v1/clusterconfig/segments/distribute-evenly-from-host/$NODE_ID
Show:
Mac OS or Linux (curl) Mac OS or Linux (curl) One-line Windows Cmd and curl Windows Powershell and curl Perl Python Node.js
Mac OS or Linux (curl) 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"
Mac OS or Linux (curl) One-line 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"
Windows Cmd and curl 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"
Windows Powershell and curl 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 "
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" ;
Python
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)
Node.js 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 ();