1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| import Redis from 'ioredis'
let cluster = [ {host: 'localhost', port: 7000}, {host: 'localhost', port: 7001}, {host: 'localhost', port: 7002}, {host: 'localhost', port: 7003}, {host: 'localhost', port: 7004}, {host: 'localhost', port: 7005} ] let options = { natMap: { '172.20.0.2:7000': {host: 'localhost', port: 7000}, '172.20.0.4:7001': {host: 'localhost', port: 7001}, '172.20.0.5:7002': {host: 'localhost', port: 7002}, '172.20.0.6:7003': {host: 'localhost', port: 7003}, '172.20.0.3:7004': {host: 'localhost', port: 7004}, '172.20.0.7:7005': {host: 'localhost', port: 7005} } } const client = new Redis.Cluster(cluster, options)
|