Skip to content

Commit

Permalink
Add doc for Password in cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
luin committed Oct 24, 2015
1 parent 80ae5fa commit fcc3031
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,27 @@ var Redis = require('ioredis');
var cluster = new Redis.Cluster(nodes, { readOnly: true });
```

### Password
Setting the `password` option to access password-proctected clusters:

```javascript
var Redis = require('ioredis');
var cluster = new Redis.Cluster(nodes, { password: 'your-cluster-password' });
```

If some of nodes in the cluster using a different password, you should specify them in the first parameter:

```javascript
var Redis = require('ioredis');
var cluster = new Redis.Cluster([
// Use password "password-for-30001" for 30001
{ port: 30001, password: 'password-for-30001'},
// Don't use password when accessing 30002
{ port: 30002 }
// Other nodes will use "fallback-password"
], { password: 'fallback-password' });
```

## Native Parser
If [hiredis](https://github.com/redis/hiredis-node) is installed (by `npm install hiredis`),
ioredis will use it by default. Otherwise, a pure JavaScript parser will be used.
Expand Down

0 comments on commit fcc3031

Please sign in to comment.