npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

solr-zkcli

v3.2.3

Published

A node.js wrapper for the Solr's ZooKeeper CLI zkcli.sh to manage SolrCloud configuration parameters

Downloads

14

Readme

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(
  /* cmd */ 'upconfig',
  /* currentWorkingDirectory */ undefined,
  /* zkhost */ '127.0.0.1:2181',
  /* confname */ 'my_new_config',
  /* confdir */ 'server/solr/configsets/basic_configs/conf',
  /* clusterprop*/ undefined,
  /* solrhome */ undefined,
  /* solrdockerimage */ undefined,
  /* machineName */ 'localhost',
  /* network */ 'host',
);


solrZkcli.SolrZkCliCommand( options ).then( (data) => {
  console.log('data = ', data);
});

//data =  { ok: true }

With callback:


solrZkcli.SolrZkCliCommand( options, function (err, data) {
  console.log('data = ', data);
});

typescript

import { SolrZkcliOptions, SolrZkCliCommand, SolrZkcliResult } from 'solr-zkcli';

const solrZkcliOptions = new SolrZkcliOptions(
  /* cmd */ 'upconfig',
  /* currentWorkingDirectory */  undefined,
  /* zkhost */ '127.0.0.1:2181',
  /* confname */ 'my_new_config',
  /* confdir */ 'server/solr/configsets/basic_configs/conf',
  /* clusterprop*/ undefined
);


SolrZkCliCommand(solrZkcliOptions).then((data: SolrZkcliResult) => {
  console.log('data = ', data);
});
  • bootstrap

var options = {
  zkhost: '127.0.0.1:9983/fmlogging',
  cmd: 'bootstrap',
  solrhome: 'server/solr/'
};

solrZkcli( options ).then(function (data) {
  console.log('data = ', data);
});

//data =  { ok: true }
  • put

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);
});

//data =  { ok: true }
  • putfile

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);
});

//data =  { ok: true }
  • makepath

var options = {
  zkhost: '127.0.0.1:9983',
  cmd: 'makepath /solr'
};

solrZkcli( options ).then(function (data) {
  console.log('data = ', data);
});

//data =  { ok: true }
  • clusterprop

var options = {
  zkhost: '127.0.0.1:' + config.zkport,
  cmd: 'clusterprop',
  name: 'urlScheme',
  val: 'https'
};

solrZkcli( options ).then(function (data) {
  console.log('data = ', data);
});

//data =  { ok: true }
  • downconfig

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);
});

//data =  { ok: true }
  • get

var options = {
  zkhost: '127.0.0.1:' + config.zkport,
  cmd: 'get /my_zk_file.txt'
};

solrZkcli( options ).then(function (data) {
  console.log('data = ', data);
});

//data =  data =  { ok: true, returnedData: 'some data' }
  • getfile

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);
});

//data =  data =  { ok: true }
  • list

var options = {
  zkhost: '127.0.0.1:' + config.zkport,
  cmd: 'list'
};

solrZkcli( options ).then(function (data) {
  console.log('data = ', data);
});

//data = {
//  ok: true,
//  returnedData:
//   ['/ (2)',
//     'DATA:',
//     '    ',
//     ' /my_zk_file.txt (0)',
//     ' DATA: ...supressed...',
//     ' /zookeeper (1)',
//     ' DATA:']
//}
  • clear

var options = {
  zkhost: '127.0.0.1:' + config.zkport,
  cmd: 'clear /solr'
};

solrZkcli( options ).then(function (data) {
  console.log('data = ', data);
});

//data =  { ok: true }

License

MIT