solr-zkcli
A node.js wrapper for the Solr's ZooKeeper CLI zkcli.sh to manage SolrCloud configuration parameters
Installation
Step 1: Prerequisites
The docker command line tool must be installed and accessible in the path.
Step 2: Get solr image
docker pull solr:7.2.0
Step 3: Installation
npm install solr-zkcli
Then:
var solrZkcli = require('solr-zkcli');
Usage
With promise
const solrZkcliOptions = new solrZkcli.SolrZkcliOptions(
'upconfig',
undefined,
'127.0.0.1:2181',
'my_new_config',
'server/solr/configsets/basic_configs/conf',
undefined,
undefined,
undefined,
'localhost',
'host',
);
solrZkcli.SolrZkCliCommand( options ).then( (data) => {
console.log('data = ', data);
});
With callback:
solrZkcli.SolrZkCliCommand( options, function (err, data) {
console.log('data = ', data);
});
typescript
import { SolrZkcliOptions, SolrZkCliCommand, SolrZkcliResult } from 'solr-zkcli';
const solrZkcliOptions = new SolrZkcliOptions(
'upconfig',
undefined,
'127.0.0.1:2181',
'my_new_config',
'server/solr/configsets/basic_configs/conf',
undefined
);
SolrZkCliCommand(solrZkcliOptions).then((data: SolrZkcliResult) => {
console.log('data = ', data);
});
var options = {
zkhost: '127.0.0.1:9983/fmlogging',
cmd: 'bootstrap',
solrhome: 'server/solr/'
};
solrZkcli( options ).then(function (data) {
console.log('data = ', data);
});
var options = {
zkhost: '127.0.0.1:9983',
cmd: 'put /my_zk_file.txt \'some data\''
};
solrZkcli( options ).then(function (data) {
console.log('data = ', data);
});
var options = {
zkhost: '127.0.0.1:9983',
cmd: 'putfile /my_zk_file.txt /tmp/my_local_file.txt'
};
solrZkcli( options ).then(function (data) {
console.log('data = ', data);
});
var options = {
zkhost: '127.0.0.1:9983',
cmd: 'makepath /solr'
};
solrZkcli( options ).then(function (data) {
console.log('data = ', data);
});
var options = {
zkhost: '127.0.0.1:' + config.zkport,
cmd: 'clusterprop',
name: 'urlScheme',
val: 'https'
};
solrZkcli( options ).then(function (data) {
console.log('data = ', data);
});
var options = {
zkhost: '127.0.0.1:9983',
cmd: 'downconfig',
confname: 'my_new_config',
confdir: '/var/download'
};
solrZkcli( options ).then(function (data) {
console.log('data = ', data);
});
var options = {
zkhost: '127.0.0.1:' + config.zkport,
cmd: 'get /my_zk_file.txt'
};
solrZkcli( options ).then(function (data) {
console.log('data = ', data);
});
var options = {
zkhost: '127.0.0.1:' + config.zkport,
cmd: 'get /my_zk_file.txt /path/to/return.txt'
};
solrZkcli( options ).then(function (data) {
console.log('data = ', data);
});
var options = {
zkhost: '127.0.0.1:' + config.zkport,
cmd: 'list'
};
solrZkcli( options ).then(function (data) {
console.log('data = ', data);
});
var options = {
zkhost: '127.0.0.1:' + config.zkport,
cmd: 'clear /solr'
};
solrZkcli( options ).then(function (data) {
console.log('data = ', data);
});
License
MIT