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

ishare-test

v0.1.0

Published

nodejs client for service coodernation with zookeeper

Downloads

8

Readme

介绍

ishare是一个nodejs客户端,其配合zookeeper来提供服务协调的功能。用户可以使用此客户端在zookeeper上方便的注册服务或者获取服务。服务注册注销和服务之间的相互调用变得非常便捷。

使用场景

经常会有这样的一些场景:

  • 多个服务之间存在依赖,即服务需要调用服务。然而服务的获取往往通过配置文件得知其他服务的信息。如果被依赖服务出现问题,主动或者被迫下线,则需要手工修改配置文件或者发送系统信号的方式来通知依赖下线服务的服务。
  • 同样,如果被依赖服务添加机器,调用此服务的服务也需要人工参与获得信息。
  • 服务新版本上线往往无法做到完全平滑。
  • 服务更新版本,重新在一些机器上布置或者以新端口方式提供服务(旧服务不下线可能是因为方便回滚或者作比较等),此时调用此服务的服务方也需要人工干预。

上述四种为常见情况,如果服务很多,相互之间的调用关系复杂,那么上述问题造成的麻烦会以指数级增长,一个失误就会引起线上的故障。怎么办?ishare帮你搞定一切。

功能

  • 将服务注册到zookeeper上:调用此服务的服务可以通过名字直接获取此服务信息,并且在获取后,如果此服务发生变化,会收到通知。
  • 注销服务,服务下线:调用此服务的服务会收到相应通知。
  • 获取服务:直接通过约定好的服务名字获取服务,并且此服务发生变化时会得到通知。

进阶

  • 服务选择:获取服务时,除了指定服务名称,还可以指定需要获取的服务版本,提供范围控制。还可以设置获得当前服务的最新版本,无需知道服务的具体版本号。
  • 心跳监测:nodejs客户端会对请求到的服务维持心跳监测。
  • 版本控制:版本节点自动添加

接口

见interface.md文件

安装

$ npm install ishare 

使用

var iShare = require('ishare').createClient({
  zookeeper:'',//zk地址
  username:'',//用户名(暂无用)
  password:'',//密码(暂无用)
  cachepath:''//本地化文件路径
});

测试

修改test/test_config目录中的zk地址,然后在根目录下运行make就可以进行单元测试

问题

IShare详细的使用方式可以参考test目录下单元测试,如有问题欢迎和我联系,见下面联系方式。

联系方式

[email protected] / [email protected]