@frmnt/hydra-server

0.0.1 • Public • Published

Hydra Server

The Hydra Server is a core service for registering and looking up services by name. Every new Service sends a registry entry (describing its name, hostname, port, protocol), which a Client can then look up to create a Connection.

Usage

A single Hydra Server should be running on each machine using Hydra. By default the Hydra Server binds to 127.0.0.1:8420, and by default every Service and Client will connect to the same.

$ hydra-server
[Hydra Server] Bound to 127.0.0.1:8420

Keep it running in the background with your process manager of choice, e.g. pm2:

$ pm2 start hydra-server

Options

Using the --host, --port, and --proto flags you can change where the Hydra Server binds:

$ hydra-server --port 48822
[Hydra Server] Bound to 0.0.0.0:48822

Joining

A Hydra Server can "join" to another Hydra Server to share registered service information. Clients can then ask their local Hydra Server for remotely registered services.

$ hydra-server --join 192.168.0.44
[Hydra Server] Bound to 0.0.0.0:8420
[Hydra Server] Joined with 192.168.0.44:8420

Joining is more bandwidth-efficient and fault-tolerant than tunneling, as clients make direct connections to the remote services. However this only really works on trusted internal networks where machines are directly accessible via multiple ports (which services are bound to).

Tunneling

A Hydra Server can "tunnel" to another Hydra Server to share service info while also tunneling all messages through the same connection. A tunnel goes from a "local" machine to a "remote" machine

A tunnel uses a single local → remote connection, so Clients don't need access to every port a Service is on. The local machine only makes outbound connections, while the remote one needs to be accessible by the Hydra Server port.

Installation

Hydra Server depends on ZeroMQ:

$ sudo apt-get install libzmq-dev

Install the NPM module globally:

$ sudo npm install -g @frmnt/hydra-server

Package Sidebar

Install

npm i @frmnt/hydra-server

Weekly Downloads

0

Version

0.0.1

License

MIT

Unpacked Size

11.7 kB

Total Files

3

Last publish

Collaborators