# redis-watchtower

> A client library for Redis Sentinel

Latest version **0.0.5** (published 2013-06-10) · 0 weekly downloads

## Install

```sh
npm install redis-watchtower
pnpm add redis-watchtower
yarn add redis-watchtower
bun add redis-watchtower
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2013-06-10 |
| First published | 2013-05-23 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Andrew Williams |
| Maintainers | andywilliams |
| Keywords | redis, redis-sentinel |

## Links

- npm: https://www.npmjs.com/package/redis-watchtower
- Repository: https://github.com/FutureAdLabs/redis-watchtower
- npm.io page: https://npm.io/package/redis-watchtower

## Dependencies (1)

- [redis](https://npm.io/package/redis.md) 0.8.*

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 0.0.5 (latest) — 2013-06-10
- 0.0.4 — 2013-05-28
- 0.0.3 — 2013-05-28
- 0.0.2 — 2013-05-26
- 0.0.1 — 2013-05-23

## README

# Redis-Watchtower

A node.js client library for [Redis Sentinel](http://redis.io/topics/sentinel)

install
------
    npm install redis-watchtower

dependancies
------

Redis-Watchtower is dependant upon [node_redis](https://github.com/DocuSignDev/node_redis).  In order to use Redis-Watchtower, however, you will need to make a slight modification to node_redis.

Because [Redis Sentinel](http://redis.io/topics/sentinel) is still on the unstable branch, the sentinel redis command is not included in node_redis, thankfully, it is very easy to eanble this command.

To enable the sentinel command in node_redis, simply open up index.js in the node_redis module, navigate to the command which assigns redis commands to the 'commands' variable (around line number 888) and add "sentinel" to the list.  Alternitively, add "sentinel" to the list in the file 'lib/commands.js' in node_redis.

usage
------
First of all reference redis-watchtower as follows:

```javascript
var watchtower = require('redis-watchtower');
```

Connect to Redis Sentinel, passing in details of your sentinel servers:

```javascript
var settings = {
	masterName: 'mastername',
	sentinels: [{
		host: '127.0.0.1',
		port: 26379
	}]
};

watchtower.connect(settings, function(err) {
	if(err) {
		console.log(err.message);
	} else {
		console.log('Connected to Sentinel');
	}	
});
```

You may now create redis clients, and use them as normal:

```javascript
var client = watchtower.createClient();

client.get('key1', function(err, data) {
	console.log('key1: ' + data);
	client.quit();
});
```

Client objects are standard Redis clients, with the added benefit that if the master server is replaced, the client is updated as required.

---
_Source: https://npm.io/package/redis-watchtower · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
