All Projects → koalazak → redis-registry

koalazak / redis-registry

Licence: MIT license
Service registry and discovery for Node.js on top of Redis

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to redis-registry

Vutils
Vutils or Vic Utilities is an utility library written in Modern C++ and for Modern C++. It helps your programming go easier, faster, and simpler.
Stars: ✭ 16 (-38.46%)
Mutual labels:  registry, service
ssdp-client
The most lightweight asynchronous Java SSDP (Simple Service Discovery Protocol) Client
Stars: ✭ 46 (+76.92%)
Mutual labels:  service, discovery
Nupdate
A comfortable update solution for .NET-applications.
Stars: ✭ 394 (+1415.38%)
Mutual labels:  registry, service
prometheus-hetzner-sd
Prometheus Service Discovery for Hetzner
Stars: ✭ 15 (-42.31%)
Mutual labels:  service, discovery
S
a go web freamwork for micro service, very very easy to create and deploy, with auto service registry and discover, high performance and based on http/2 no ssl
Stars: ✭ 67 (+157.69%)
Mutual labels:  registry, service
Verdaccio
📦🔐 A lightweight Node.js private proxy registry
Stars: ✭ 12,667 (+48619.23%)
Mutual labels:  registry
Registry
npm registry documentation
Stars: ✭ 202 (+676.92%)
Mutual labels:  registry
Proton
Proton Framework is a Windows post-exploitation framework similar to other Windows post-exploitation frameworks. The major difference is that the Proton Framework does most of its operations using Windows Script Host, with compatibility in the core to support a default installation of Windows 2000 with no service packs all the way through Windows 10.
Stars: ✭ 142 (+446.15%)
Mutual labels:  registry
Docker Registry Pruner
Tool to apply retention logic to docker images in a Docker Registry
Stars: ✭ 122 (+369.23%)
Mutual labels:  registry
react-native-redux-boilerplate
React Native Redux Boiler Plate
Stars: ✭ 38 (+46.15%)
Mutual labels:  service
Datbase
[DEPRECATED] Open data sharing powered by Dat
Stars: ✭ 251 (+865.38%)
Mutual labels:  registry
Meuse
A private Cargo crate registry, for Rust
Stars: ✭ 173 (+565.38%)
Mutual labels:  registry
Hub Tool
🧪 Docker Hub experimental CLI tool
Stars: ✭ 147 (+465.38%)
Mutual labels:  registry
Harbor
An open source trusted cloud native registry project that stores, signs, and scans content.
Stars: ✭ 16,320 (+62669.23%)
Mutual labels:  registry
Verdaccio Gitlab
private npm registry (Verdaccio) using gitlab-ce as authentication and authorization provider
Stars: ✭ 142 (+446.15%)
Mutual labels:  registry
Alexandrie
An alternative crate registry, implemented in Rust.
Stars: ✭ 251 (+865.38%)
Mutual labels:  registry
Store
Official Function and Template Store for OpenFaaS
Stars: ✭ 136 (+423.08%)
Mutual labels:  registry
Beachball
The Sunniest Semantic Version Bumper
Stars: ✭ 158 (+507.69%)
Mutual labels:  registry
Registry
The registry of type definitions for TypeScript
Stars: ✭ 235 (+803.85%)
Mutual labels:  registry
Login Action
GitHub Action to login against a Docker registry
Stars: ✭ 149 (+473.08%)
Mutual labels:  registry

redis-registry

Build Status npm version

Service registry and discovery for distributed systems on top of redis and node.js

Install

npm install redis-registry

Usage

Computer 1

const registry = require('redis-registry');

const redisConfig = {
  host: '192.168.1.50',
  port: 6379
}
const services = registry(redisConfig);

// Join the registry
services.join('my-service-name', {port:8080});

Computer 2

const registry = require('redis-registry');

const redisConfig = {
  host: '192.168.1.50',
  port: 6379
}
const services = registry(redisConfig);

// Do a lookup
services.lookup('my-service-name', function(err, service) {
  console.log('Found the following service:');
  console.log(service);
});

Running the above example will produce the following output

Found the following service:
{
  name: 'my-service-name',
  port: 8080,
  hostname: '192.168.1.10',
  host: '192.168.1.10:8080',
  url: 'http://192.168.1.10:8080'
}

Note: If no hostname is passed to the join function, it will pickup the main interface IP as the hostname. If you need to use the IP of a non-primary interface, set the environment variable REGISTRY_INTERFACE to the name of the device of your choice (eth1, en1, etc)

Full api

  • services = registry(redisConfig) Create a new registry client
  • services.join(name, service, [cb]) Join the registry with a new service
  • services.leave([name], [cb]) Leave the registry.
  • services.lookup(name, cb) Lookup a single service
  • services.list([name], cb) List all services as an array. Omit the name to list all services

Services

Services are just JSON documents. redis-registry will add a default hostname and a couple of other properties. An example of a service document could be:

{
  name: 'my-service',
  port: 8080,
  hostname: '192.168.1.10',       // added by redis-registry
  host: '192.168.1.10:8080',      // added by redis-registry
  url: 'http://192.168.1.10:8080' // added by redis-registry
}

These documents are saved in redis with a TTL of 10s. Every 5s redis-registry will send an update for each service to the registry which resets the expiration counter keeping the service record. If possible you should call services.leave() before exiting your service process. Otherwise your service will be garbage collected after (at most) 10s. If your process goes down, it will automatically leave the registry (due to the TTL) and will not be discovered from other process.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].