{"_id":"haredis","_rev":"39-53a0933b1d7036bd1fb1c8a2beb96c5e","name":"haredis","description":"High-availability redis in Node.js","dist-tags":{"latest":"0.2.15"},"versions":{"0.1.4":{"author":{"name":"Carlos Rodriguez","email":"carlos@s8f.org","url":"http://s8f.org/"},"name":"haredis","description":"High-availability redis in Node.js","version":"0.1.4","repository":{"type":"git","url":"git://github.com/carlos8f/haredis.git"},"main":"./lib","scripts":{"test":"make test"},"dependencies":{"redis":"~0.7.2","async":"~0.1.22"},"devDependencies":{},"optionalDependencies":{},"engines":{"node":"*"},"_npmUser":{"name":"carlos8f","email":"carlos@s8f.org"},"_id":"haredis@0.1.4","_engineSupported":true,"_npmVersion":"1.1.24","_nodeVersion":"v0.6.19","_defaultsLoaded":true,"dist":{"shasum":"5339e9d9ddb85514180f23a5d66dfad6c5f06109","tarball":"https://registry.npmjs.org/haredis/-/haredis-0.1.4.tgz","integrity":"sha512-uGBR6U+KcP2Gao9G5ZN8Yv3Ep0ZBUOt5npv4vTrrZ8yMJclMQ5RCJBWa4Qv3C5urMeHf/yjdIHewT3DkfICx7w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF1kLh+RqtHJGUFCDA0NqUXBNJ5Vsp1SnpUf1TgdstWkAiANlVb1KGbrCuBxqfZ84/2ATkTVOzRUMSMgS9EP/AwhIA=="}]},"maintainers":[{"name":"carlos8f","email":"carlos@s8f.org"}]},"0.2.0":{"author":{"name":"Carlos Rodriguez","email":"carlos@s8f.org","url":"http://s8f.org/"},"name":"haredis","description":"High-availability redis in Node.js","version":"0.2.0","repository":{"type":"git","url":"git://github.com/carlos8f/haredis.git"},"main":"./lib","scripts":{"test":"make test"},"dependencies":{"redis":"~0.7.2","async":"~0.1.22"},"devDependencies":{},"optionalDependencies":{},"engines":{"node":"*"},"_npmUser":{"name":"carlos8f","email":"carlos@s8f.org"},"_id":"haredis@0.2.0","_engineSupported":true,"_npmVersion":"1.1.24","_nodeVersion":"v0.6.19","_defaultsLoaded":true,"dist":{"shasum":"f5c737cc02802b6ef910395c1b1527c1f28a9bd6","tarball":"https://registry.npmjs.org/haredis/-/haredis-0.2.0.tgz","integrity":"sha512-xtpiub3cIvDoM1M8mk0EoDINIaqbseO8JlttH0aLLi719ozj14Ca9Yb8S9ZDx0CWRWO+6pv+/B3VPIYlUtv7mg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDRcUJ5xKF2p5idnx/X7FC5PIwc7D232oxj3vfA9qFDQwIgVrHUKrzwhtWF8zB2g7v30fBA2GTwrRDvhwu/InS9VUM="}]},"maintainers":[{"name":"carlos8f","email":"carlos@s8f.org"}]},"0.2.1":{"author":{"name":"Carlos Rodriguez","email":"carlos@s8f.org","url":"http://s8f.org/"},"name":"haredis","description":"High-availability redis in Node.js","version":"0.2.1","repository":{"type":"git","url":"git://github.com/carlos8f/haredis.git"},"main":"./lib","scripts":{"test":"make test"},"dependencies":{"redis":"~0.7.2","async":"~0.1.22"},"devDependencies":{},"optionalDependencies":{},"engines":{"node":"*"},"_npmUser":{"name":"carlos8f","email":"carlos@s8f.org"},"_id":"haredis@0.2.1","_engineSupported":true,"_npmVersion":"1.1.24","_nodeVersion":"v0.6.19","_defaultsLoaded":true,"dist":{"shasum":"92beadf02f63daa029d584e8f336813ee7b1d6e3","tarball":"https://registry.npmjs.org/haredis/-/haredis-0.2.1.tgz","integrity":"sha512-K9ZUYHhJ54+cF1pdZFYuQRXW1EdGI5JZFX8RF0G+eXwkcCGm9DbLCTg6GGHflsiKGErXKUllWuGwyokO2m0H7g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD906AEYIqeVs9UuNuhXv9fq5UmPYBnMR2gpCwfOzNi7gIgEGeFb5H3zZuOA8MXlPDdqvIuj1knKuWLX76nEm1tudI="}]},"maintainers":[{"name":"carlos8f","email":"carlos@s8f.org"}]},"0.2.2":{"author":{"name":"Carlos Rodriguez","email":"carlos@s8f.org","url":"http://s8f.org/"},"name":"haredis","description":"High-availability redis in Node.js","version":"0.2.2","repository":{"type":"git","url":"git://github.com/carlos8f/haredis.git"},"main":"./lib","scripts":{"test":"make test"},"dependencies":{"redis":"~0.7.2","async":"~0.1.22","pkginfo":"~0.2.3"},"devDependencies":{},"optionalDependencies":{},"engines":{"node":"*"},"_npmUser":{"name":"carlos8f","email":"carlos@s8f.org"},"_id":"haredis@0.2.2","_engineSupported":true,"_npmVersion":"1.1.24","_nodeVersion":"v0.6.19","_defaultsLoaded":true,"dist":{"shasum":"f8c29474e6b30c8d0cc10ea81775dc3e253898dd","tarball":"https://registry.npmjs.org/haredis/-/haredis-0.2.2.tgz","integrity":"sha512-75eyS8q/5vcsOkIADObxnWijvyISEJA1yOFw6R9SXpGL03b0lI8t7di4MXYUsASlXivhb8mx2J7mgb/GdjDaew==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC9r0K0Ktu2EUXZDkDa8oD1m/7n6+VTjWRptaNDnbfepQIgOVsLDaQiJm4cDO9PwIIkG0SMcUQSfjsI2ruh+V5pdb8="}]},"maintainers":[{"name":"carlos8f","email":"carlos@s8f.org"}]},"0.2.3":{"author":{"name":"Carlos Rodriguez","email":"carlos@s8f.org","url":"http://s8f.org/"},"name":"haredis","description":"High-availability redis in Node.js","version":"0.2.3","repository":{"type":"git","url":"git://github.com/carlos8f/haredis.git"},"main":"./lib","scripts":{"test":"make test"},"dependencies":{"redis":"~0.7.2","async":"~0.1.22","pkginfo":"~0.2.3"},"devDependencies":{},"optionalDependencies":{},"engines":{"node":"*"},"_npmUser":{"name":"carlos8f","email":"carlos@s8f.org"},"_id":"haredis@0.2.3","_engineSupported":true,"_npmVersion":"1.1.24","_nodeVersion":"v0.6.19","_defaultsLoaded":true,"dist":{"shasum":"21ba1d43135e95606144ef90822eff1708b5797d","tarball":"https://registry.npmjs.org/haredis/-/haredis-0.2.3.tgz","integrity":"sha512-FtaVz0jWSHD2J3jURUllaY+R8+y2VTBk1XwIoOEjIz13HwVJ1b2hImlkX/M2MumP9jAFrYJnsIcpQd+mztzvtw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDzdHMx+yqONxk4NicI6gQKpaC/t7XFTIXYZH5d2EWCxQIgKEhFsLAdA6Laa+hyLMN7awuXie1ddDQXmKoyHUmCKjQ="}]},"maintainers":[{"name":"carlos8f","email":"carlos@s8f.org"}]},"0.2.4":{"author":{"name":"Carlos Rodriguez","email":"carlos@s8f.org","url":"http://s8f.org/"},"name":"haredis","description":"High-availability redis in Node.js","version":"0.2.4","repository":{"type":"git","url":"git://github.com/carlos8f/haredis.git"},"main":"./lib","scripts":{"test":"make test"},"dependencies":{"redis":"~0.7.2","async":"~0.1.22","pkginfo":"~0.2.3"},"devDependencies":{},"optionalDependencies":{},"engines":{"node":"*"},"_npmUser":{"name":"carlos8f","email":"carlos@s8f.org"},"_id":"haredis@0.2.4","_engineSupported":true,"_npmVersion":"1.1.24","_nodeVersion":"v0.6.19","_defaultsLoaded":true,"dist":{"shasum":"11316855e2896e0d2cba446804be4135b4131ae0","tarball":"https://registry.npmjs.org/haredis/-/haredis-0.2.4.tgz","integrity":"sha512-irTx8FOVAWPbaAYfR+jeXKtocpR/QOs5eziz/PP8s0mBj8MIEqkqKUYPUqHOvjhmJRbRbgY5BC6LZkSZZZY56A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDsWDz8ArkVlJLSu6zEc4QRKvV7288qMwhxIA3b3hMOewIgR73SIzIhwqbFhuDb/5kR196tPYkeQPivpKmOv8yeR1c="}]},"maintainers":[{"name":"carlos8f","email":"carlos@s8f.org"}]},"0.2.5":{"author":{"name":"Carlos Rodriguez","email":"carlos@s8f.org","url":"http://s8f.org/"},"name":"haredis","description":"High-availability redis in Node.js","version":"0.2.5","repository":{"type":"git","url":"git://github.com/carlos8f/haredis.git"},"main":"./lib","scripts":{"test":"make test"},"dependencies":{"redis":"~0.7.2","async":"~0.1.22","pkginfo":"~0.2.3"},"devDependencies":{},"optionalDependencies":{},"engines":{"node":"*"},"_npmUser":{"name":"carlos8f","email":"carlos@s8f.org"},"_id":"haredis@0.2.5","_engineSupported":true,"_npmVersion":"1.1.24","_nodeVersion":"v0.6.19","_defaultsLoaded":true,"dist":{"shasum":"b7dd68c88580e5318d59667452d34216cc1ebf64","tarball":"https://registry.npmjs.org/haredis/-/haredis-0.2.5.tgz","integrity":"sha512-1X782CP7laBaAKItJBcJvJ9Mstzrb2EdFsGMjImasOL01EttbTES6bukcP0TU41PdemDWskKcDVVH+eV/DoPvA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDj79/4lftnUgd4Cfhc+dTagiFLrHAASbz5opYl/cgcJgIgYAMmK713hlgOA6GBP+quBfOqBaykR5cLhT6HJngUDa4="}]},"maintainers":[{"name":"carlos8f","email":"carlos@s8f.org"}]},"0.2.6":{"author":{"name":"Carlos Rodriguez","email":"carlos@s8f.org","url":"http://s8f.org/"},"name":"haredis","description":"High-availability redis in Node.js","version":"0.2.6","repository":{"type":"git","url":"git://github.com/carlos8f/haredis.git"},"main":"./lib","scripts":{"test":"make test"},"dependencies":{"redis":"~0.7.2","async":"~0.1.22","pkginfo":"~0.2.3"},"devDependencies":{},"optionalDependencies":{},"engines":{"node":"*"},"_npmUser":{"name":"carlos8f","email":"carlos@s8f.org"},"_id":"haredis@0.2.6","_engineSupported":true,"_npmVersion":"1.1.24","_nodeVersion":"v0.8.2","_defaultsLoaded":true,"dist":{"shasum":"8697fc3a5171fd090535e3a58024f7acab28a73a","tarball":"https://registry.npmjs.org/haredis/-/haredis-0.2.6.tgz","integrity":"sha512-gYYWAKmLA1mavvudwP/0KPf+PRkIhewUMXX6pyU5hNOSomXTBROSIhOS98w3Qsshx/ZWFlpXa+nwkibXTS9cWw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCfpy2Dcyyew6LP214E0/4ogdJBMrGgSqwa9wJLhFL0kwIgJqT34DbrSinZ9ee1HozjKDjvXwNbt0bGT8dIu16A5DE="}]},"maintainers":[{"name":"carlos8f","email":"carlos@s8f.org"}]},"0.2.7":{"author":{"name":"Carlos Rodriguez","email":"carlos@s8f.org","url":"http://s8f.org/"},"name":"haredis","description":"High-availability redis in Node.js","version":"0.2.7","repository":{"type":"git","url":"git://github.com/carlos8f/haredis.git"},"main":"./lib","scripts":{"test":"make test"},"dependencies":{"redis":"~0.7.2","async":"~0.1.22","pkginfo":"~0.2.3"},"devDependencies":{},"optionalDependencies":{},"engines":{"node":"*"},"_npmUser":{"name":"carlos8f","email":"carlos@s8f.org"},"_id":"haredis@0.2.7","_engineSupported":true,"_npmVersion":"1.1.24","_nodeVersion":"v0.8.2","_defaultsLoaded":true,"dist":{"shasum":"39d528351239f54a7a191b4947a0a0791a96cdfa","tarball":"https://registry.npmjs.org/haredis/-/haredis-0.2.7.tgz","integrity":"sha512-9dou1H/huu2xH5Aj/2gLj87TLg5VNi4DnoudJFKhXw3Xfo0jtU1tLkkxsW2ZdfE3ndOlhIfLe1iJTdFy4Ydl6Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFhzwGeD0FZVi4mwKMYcez1M9toREaHcIEzfPY83epxyAiAadsBW/SzwyAeHSpV3GDaLex4JYBqD9THsSBGzKl52Kw=="}]},"maintainers":[{"name":"carlos8f","email":"carlos@s8f.org"}]},"0.2.8":{"author":{"name":"Carlos Rodriguez","email":"carlos@s8f.org","url":"http://s8f.org/"},"name":"haredis","description":"High-availability redis in Node.js","version":"0.2.8","repository":{"type":"git","url":"git://github.com/carlos8f/haredis.git"},"main":"./lib","scripts":{"test":"make test"},"dependencies":{"redis":"~0.7.2","async":"~0.1.22","pkginfo":"~0.2.3"},"devDependencies":{},"optionalDependencies":{},"engines":{"node":"*"},"_npmUser":{"name":"carlos8f","email":"carlos@s8f.org"},"_id":"haredis@0.2.8","_engineSupported":true,"_npmVersion":"1.1.24","_nodeVersion":"v0.8.2","_defaultsLoaded":true,"dist":{"shasum":"d31d226da16b9aa04761b556b143eede0bbe5796","tarball":"https://registry.npmjs.org/haredis/-/haredis-0.2.8.tgz","integrity":"sha512-o+eYCquqUfwji8m834VkGIsYzoOqlBd28mVckM+0V2c1eYnmi43HWIv44UTOQcG8gg+LY047MOsIKtt2OKHx6A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICkHEPVNP/7OsRqGxrZWmGV36zg8cAp7yImkMEn3tMd1AiEAvJX/7rHLULk88apqb+0TyaxFDL8/sY03Pnrl0vyJKnU="}]},"maintainers":[{"name":"carlos8f","email":"carlos@s8f.org"}]},"0.2.9":{"author":{"name":"Carlos Rodriguez","email":"carlos@s8f.org","url":"http://s8f.org/"},"name":"haredis","description":"High-availability redis in Node.js","version":"0.2.9","repository":{"type":"git","url":"git://github.com/carlos8f/haredis.git"},"main":"./lib","scripts":{"test":"make test"},"dependencies":{"redis":"~0.7.2","async":"~0.1.22","pkginfo":"~0.2.3"},"devDependencies":{},"optionalDependencies":{},"engines":{"node":"*"},"readme":"haredis\n-------\n\nHigh-availability redis in Node.js\n\nIdea\n====\n\n**haredis** is a code wrapper around [node_redis](https://github.com/mranney/node_redis)\nwhich adds fault-taulerance to your application.\n\nFeatures:\n\n- Drop-in replacement for [node_redis](https://github.com/mranney/node_redis)\n- Easily build a cluster out of 3 or more (default-configured) redis servers\n- Auto-failover due to connection drops\n- Master conflict resolution (default your servers to master, and **haredis**\n  will elect the freshest and issue the `SLAVEOF` commands)\n- Freshness judged by an opcounter (incremented on write)\n- Locking mechanism to prevent failover contention\n- Load-balancing for reads and pub/sub\n- One-client pub/sub\n- Gossip channel for quick failover\n\nUsage\n=====\n\nStart up multiple redis daemons, with no special configuration necessary, and\nlist them like so:\n\n```javascript\nvar redis = require('haredis')\n  , nodes = ['1.2.3.1:6379', '1.2.3.2:6379', '1.2.3.3:6379']\n  , client = redis.createClient(nodes)\n  ;\n```\n\n...then use `client` as you would use [node_redis](https://github.com/mranney/node_redis).\nIf the master node goes down, **haredis** will automatically determine which node\nto promote to master, and keep standby connections to the others.\n\nIf multiple **haredis** clients are connected, a locking mechanism is implemented\nto prevent contention between failover attempts.\n\nTo see this in action,\n\n- Set up 3 local redis daemons on ports 6380-82\n- 6380 should be `SLAVEOF NO ONE`. 6381 and 82 should be slaves to 6380.\n- Run `test/basic.js` or `test/pubsub.js` (try multiple to test contention)\n- Kill the process listening on 6380 (master). **haredis** will auto-failover to\n  the node it detects is freshest, set that to master, and the others to slaves!\n- Bring up 6380, and it will be added as standby for failover.\n\nAPI differences\n===============\n\n`createClient`\n--------------\n\nIn **haredis**, `createClient` works like this:\n\n```javascript\nfunction createClient([host/port array], options)\n```\n\nThe first argument can be an array of hosts (using default port), ports (using\nlocalhost), or colon-separated strings (i.e., `1.2.3.4:6379`). **haredis** will\nattempt to connect to all of these servers.\n\n`options` corresponds to the same options you would pass\n[node_redis](https://github.com/mranney/node_redis). **haredis**\nadditionally supports:\n\n- `haredis_db_num` {Number} database number that **haredis** should store metadata\n  in (such as an opcounter). Defaults to `15`.\n\n`auth`\n------\n\n`auth` works like this:\n\n```javascript\nfunction auth({host/port to password object}, callback)\n```\n\nThe first argument can be an object of hosts, ports mapped to passwords\n(i.e., `{'1.2.3.1:6379': 'pass1', '1.2.3.3:6379': 'pass2'}`), or just the password\nstring.\n\nLoad-balancing\n==============\n\n**haredis** can also load-balance read operations to random slaves. Pub/sub\nsubscriptions will automatically try to use a slave. For normal read-only\ncommands, you can choose to query a random slave by using the `slaveOk()` method:\n\n```javascript\nclient.slaveOk().GET('foo', function(err, reply) { ...\n```\n\n`slaveOk()` will only affect the current command.\n\nTo load-balance all reads, you can set `options.auto_slaveok = true` in\n`createClient()`. Be advised that this can case problems due to replication delay!\n\nOne-client pub/sub\n==================\n\nIn redis, pub/sub is a \"mode\" which excludes the use of regular commands while\nsubscriptions are active. Normally you need to make separate client objects to\nuse `publish` on one and `subscribe` on the other.\n\n**haredis** adds the nice ability to use pub/sub simultaneously with regular\ncommands. This is because it keeps internal redis clients in pub/sub mode for\ninternal \"gossip\", but also makes it available for users. Of course this is\noptional, and you can always maintain a separate `haredis` client for subscribes\nif you wish.\n\nAdvice\n======\n\nFor proper failover, a majority of the nodes need to be still online. This means\nthat the minimum number of nodes should be 3. Under the minimum setup, you can\nlose up to 1 node. If only 1/3 are up, commands will be queued indefinitely until\nanother node comes up.\n\nDebugging/verbose logging\n=========================\n\nTo see what's under the hood, try setting `redis.debug_mode = true`, and you can\nsee the failover process in detail:\n\n```\n[19:27:58](#1) warning: MASTER is down! (127.0.0.1:6380)\n[19:27:58](#1) info: reorientating (node down) in 2000ms\nRedis connection gone from end event.\n[19:28:00](#1) info: orientating (node down, 2/3 nodes up) ...\n[19:28:00](#1) warning: invalid master count: 0\n[19:28:00](#1) info: attempting failover!\n[19:28:00](#1) info: my failover id: gP0SCM1B\n[19:28:00](#1) info: lock was a success!\n[19:28:00](#1) info: 127.0.0.1:6381 had highest opcounter (1441) of 2 nodes. congrats!\n[19:28:00](#1) info: making 127.0.0.1:6382 into a slave...\n[19:28:00](#1) info: 127.0.0.1:6382 is slave\n[19:28:00](#1) info: publishing gossip:master for 127.0.0.1:6381\n[19:28:00](#1) info: renegotating subSlave away from master\n[19:28:00](#1) info: subSlave is now 127.0.0.1:6382\n[19:28:00](#1) info: ready, using 127.0.0.1:6381 as master\n```\n\nTo get info on which commands are executed on which servers, try setting\n`redis.command_logging = true`.\n\nRunning tests\n=============\n\n**haredis** includes the test suite from [node_redis](https://github.com/mranney/node_redis)\nwhich can be run in single or clustered mode.\n\nIf you have redis daemons running locally on ports 6380, 6381 and 8382, you can\nrun the clustered test with:\n\n```bash\n$ make test-cluster\n```\n\nOr in single-mode with a redis server on port 6379:\n\n```bash\n$ make test\n```\n\nLICENSE - \"MIT License\"\n=======================\n\n- Copyright (c) 2012 Carlos Rodriguez, http://s8f.org/\n- Copyright (c) 2012 Terra Eclipse, Inc., http://www.terraeclipse.com/\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.","readmeFilename":"README.md","_id":"haredis@0.2.9","dist":{"shasum":"1779b07fb5fbf376e2296012950c50dd94c3c409","tarball":"https://registry.npmjs.org/haredis/-/haredis-0.2.9.tgz","integrity":"sha512-OZjQiP7NWbUyl3ndlMKLXk1D6URProAOR2UyfIK6eUrPkxhu0APFoRpNkBZycok35I7nWQ9n22k5K8Mxvrg9Kg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCoWW/3+5CAKuz13S2FXfpIqPweTj0Nh9ZRDeuSUjZacAIhALGvPOw2ADbvpVwCRDRy0eXtkzkfEX06ijhY/PZtWM5V"}]},"_from":".","_npmVersion":"1.2.11","_npmUser":{"name":"carlos8f","email":"carlos@s8f.org"},"maintainers":[{"name":"carlos8f","email":"carlos@s8f.org"}]},"0.2.10":{"author":{"name":"Carlos Rodriguez","email":"carlos@s8f.org","url":"http://s8f.org/"},"name":"haredis","description":"High-availability redis in Node.js","version":"0.2.10","repository":{"type":"git","url":"git://github.com/carlos8f/haredis.git"},"main":"./lib","scripts":{"test":"make test"},"dependencies":{"redis":"~0.7.2","async":"~0.1.22","pkginfo":"~0.2.3"},"devDependencies":{},"optionalDependencies":{},"engines":{"node":"*"},"readme":"haredis\n-------\n\nHigh-availability redis in Node.js\n\nIdea\n====\n\n**haredis** is a code wrapper around [node_redis](https://github.com/mranney/node_redis)\nwhich adds fault-taulerance to your application.\n\nFeatures:\n\n- Drop-in replacement for [node_redis](https://github.com/mranney/node_redis)\n- Easily build a cluster out of 3 or more (default-configured) redis servers\n- Auto-failover due to connection drops\n- Master conflict resolution (default your servers to master, and **haredis**\n  will elect the freshest and issue the `SLAVEOF` commands)\n- Freshness judged by an opcounter (incremented on write)\n- Locking mechanism to prevent failover contention\n- Load-balancing for reads and pub/sub\n- One-client pub/sub\n- Gossip channel for quick failover\n\nUsage\n=====\n\nStart up multiple redis daemons, with no special configuration necessary, and\nlist them like so:\n\n```javascript\nvar redis = require('haredis')\n  , nodes = ['1.2.3.1:6379', '1.2.3.2:6379', '1.2.3.3:6379']\n  , client = redis.createClient(nodes)\n  ;\n```\n\n...then use `client` as you would use [node_redis](https://github.com/mranney/node_redis).\nIf the master node goes down, **haredis** will automatically determine which node\nto promote to master, and keep standby connections to the others.\n\nIf multiple **haredis** clients are connected, a locking mechanism is implemented\nto prevent contention between failover attempts.\n\nTo see this in action,\n\n- Set up 3 local redis daemons on ports 6380-82\n- 6380 should be `SLAVEOF NO ONE`. 6381 and 82 should be slaves to 6380.\n- Run `test/basic.js` or `test/pubsub.js` (try multiple to test contention)\n- Kill the process listening on 6380 (master). **haredis** will auto-failover to\n  the node it detects is freshest, set that to master, and the others to slaves!\n- Bring up 6380, and it will be added as standby for failover.\n\nAPI differences\n===============\n\n`createClient`\n--------------\n\nIn **haredis**, `createClient` works like this:\n\n```javascript\nfunction createClient([host/port array], options)\n```\n\nThe first argument can be an array of hosts (using default port), ports (using\nlocalhost), or colon-separated strings (i.e., `1.2.3.4:6379`). **haredis** will\nattempt to connect to all of these servers.\n\n`options` corresponds to the same options you would pass\n[node_redis](https://github.com/mranney/node_redis). **haredis**\nadditionally supports:\n\n- `haredis_db_num` {Number} database number that **haredis** should store metadata\n  in (such as an opcounter). Defaults to `15`.\n\n`auth`\n------\n\n`auth` works like this:\n\n```javascript\nfunction auth({host/port to password object}, callback)\n```\n\nThe first argument can be an object of hosts, ports mapped to passwords\n(i.e., `{'1.2.3.1:6379': 'pass1', '1.2.3.3:6379': 'pass2'}`), or just the password\nstring.\n\nLoad-balancing\n==============\n\n**haredis** can optionally load-balance read operations to random slaves. Pub/sub\nsubscriptions will automatically try to use a slave. For normal read-only\ncommands, you can choose to query a random slave by using the `slaveOk()` method:\n\n```javascript\nclient.slaveOk().GET('foo', function(err, reply) { ...\n```\n\n`slaveOk()` will only affect the current command.\n\nTo load-balance all reads, you can set `options.auto_slaveok = true` in\n`createClient()`. Be advised that this can case problems due to replication delay!\n\nTo force a read to go to master when using `auto_slaveok`, use `slaveOk(false)`\nbefore the command:\n\n```javascript\nclient.slaveOk(false).GET('foo', function(err, reply) { ...\n```\n\nOne-client pub/sub\n==================\n\nIn redis, pub/sub is a \"mode\" which excludes the use of regular commands while\nsubscriptions are active. Normally you need to make separate client objects to\nuse `publish` on one and `subscribe` on the other.\n\n**haredis** adds the nice ability to use pub/sub simultaneously with regular\ncommands. This is because it keeps internal redis clients in pub/sub mode for\ninternal \"gossip\", but also makes it available for users. Of course this is\noptional, and you can always maintain a separate `haredis` client for subscribes\nif you wish.\n\nAdvice\n======\n\nFor proper failover, a majority of the nodes need to be still online. This means\nthat the minimum number of nodes should be 3. Under the minimum setup, you can\nlose up to 1 node. If only 1/3 are up, commands will be queued indefinitely until\nanother node comes up.\n\nDebugging/verbose logging\n=========================\n\nTo see what's under the hood, try setting `redis.debug_mode = true`, and you can\nsee the failover process in detail:\n\n```\n[19:27:58](#1) warning: MASTER is down! (127.0.0.1:6380)\n[19:27:58](#1) info: reorientating (node down) in 2000ms\nRedis connection gone from end event.\n[19:28:00](#1) info: orientating (node down, 2/3 nodes up) ...\n[19:28:00](#1) warning: invalid master count: 0\n[19:28:00](#1) info: attempting failover!\n[19:28:00](#1) info: my failover id: gP0SCM1B\n[19:28:00](#1) info: lock was a success!\n[19:28:00](#1) info: 127.0.0.1:6381 had highest opcounter (1441) of 2 nodes. congrats!\n[19:28:00](#1) info: making 127.0.0.1:6382 into a slave...\n[19:28:00](#1) info: 127.0.0.1:6382 is slave\n[19:28:00](#1) info: publishing gossip:master for 127.0.0.1:6381\n[19:28:00](#1) info: renegotating subSlave away from master\n[19:28:00](#1) info: subSlave is now 127.0.0.1:6382\n[19:28:00](#1) info: ready, using 127.0.0.1:6381 as master\n```\n\nTo get info on which commands are executed on which servers, try setting\n`redis.command_logging = true`.\n\nRunning tests\n=============\n\n**haredis** includes the test suite from [node_redis](https://github.com/mranney/node_redis)\nwhich can be run in single or clustered mode.\n\nIf you have redis daemons running locally on ports 6380, 6381 and 8382, you can\nrun the clustered test with:\n\n```bash\n$ make test-cluster\n```\n\nOr in single-mode with a redis server on port 6379:\n\n```bash\n$ make test\n```\n\nLICENSE - \"MIT License\"\n=======================\n\n- Copyright (c) 2012 Carlos Rodriguez, http://s8f.org/\n- Copyright (c) 2012 Terra Eclipse, Inc., http://www.terraeclipse.com/\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.","readmeFilename":"README.md","_id":"haredis@0.2.10","dist":{"shasum":"b2808d569c7de9f8d3c45d78ec1e6d0b92d3ada3","tarball":"https://registry.npmjs.org/haredis/-/haredis-0.2.10.tgz","integrity":"sha512-L9OKinBfWPaqNFiGhKzzgSGGrUWhYCIki9KhPjwvAIZB3OLfPWStXOoVVZugZE78QXbdJpBbniew/I1xH9IuuA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDGWosnsxXV1FOhbGmtcodAdaOe84J2DtXXC2gN2Fg9PgIhALRvv1SzsVvuJOmIp8q6npBqONhrQdFUc81fM3N2vD3R"}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"carlos8f","email":"carlos@s8f.org"},"maintainers":[{"name":"carlos8f","email":"carlos@s8f.org"}]},"0.2.11":{"author":{"name":"Carlos Rodriguez","email":"carlos@s8f.org","url":"http://s8f.org/"},"name":"haredis","description":"High-availability redis in Node.js","version":"0.2.11","repository":{"type":"git","url":"git://github.com/carlos8f/haredis.git"},"main":"./lib","scripts":{"test":"make test"},"dependencies":{"redis":"~0.7.2","async":"~0.1.22","pkginfo":"~0.2.3"},"devDependencies":{"mocha":"~1.9.0","mkdirp":"~0.3.5","rimraf":"~2.1.4","idgen":"~1.2.0"},"optionalDependencies":{},"engines":{"node":"*"},"readme":"haredis\n-------\n\nHigh-availability redis in Node.js\n\nIdea\n====\n\n**haredis** is a code wrapper around [node_redis](https://github.com/mranney/node_redis)\nwhich adds fault-taulerance to your application.\n\nFeatures:\n\n- Drop-in replacement for [node_redis](https://github.com/mranney/node_redis)\n- Easily build a cluster out of 3 or more (default-configured) redis servers\n- Auto-failover due to connection drops\n- Master conflict resolution (default your servers to master, and **haredis**\n  will elect the freshest and issue the `SLAVEOF` commands)\n- Freshness judged by an opcounter (incremented on write)\n- Locking mechanism to prevent failover contention\n- Load-balancing for reads and pub/sub\n- One-client pub/sub\n- Gossip channel for quick failover\n\nUsage\n=====\n\nStart up multiple redis daemons, with no special configuration necessary, and\nlist them like so:\n\n```javascript\nvar redis = require('haredis')\n  , nodes = ['1.2.3.1:6379', '1.2.3.2:6379', '1.2.3.3:6379']\n  , client = redis.createClient(nodes)\n  ;\n```\n\n...then use `client` as you would use [node_redis](https://github.com/mranney/node_redis).\nIf the master node goes down, **haredis** will automatically determine which node\nto promote to master, and keep standby connections to the others.\n\nIf multiple **haredis** clients are connected, a locking mechanism is implemented\nto prevent contention between failover attempts.\n\nTo see this in action,\n\n- Set up 3 local redis daemons on ports 6380-82\n- 6380 should be `SLAVEOF NO ONE`. 6381 and 82 should be slaves to 6380.\n- Run `test/basic.js` or `test/pubsub.js` (try multiple to test contention)\n- Kill the process listening on 6380 (master). **haredis** will auto-failover to\n  the node it detects is freshest, set that to master, and the others to slaves!\n- Bring up 6380, and it will be added as standby for failover.\n\nAPI differences\n===============\n\n`createClient`\n--------------\n\nIn **haredis**, `createClient` works like this:\n\n```javascript\nfunction createClient([host/port array], options)\n```\n\nThe first argument can be an array of hosts (using default port), ports (using\nlocalhost), or colon-separated strings (i.e., `1.2.3.4:6379`). **haredis** will\nattempt to connect to all of these servers.\n\n`options` corresponds to the same options you would pass\n[node_redis](https://github.com/mranney/node_redis). **haredis**\nadditionally supports:\n\n- `haredis_db_num` {Number} database number that **haredis** should store metadata\n  in (such as an opcounter). Defaults to `15`.\n\n`auth`\n------\n\n`auth` works like this:\n\n```javascript\nfunction auth({host/port to password object}, callback)\n```\n\nThe first argument can be an object of hosts, ports mapped to passwords\n(i.e., `{'1.2.3.1:6379': 'pass1', '1.2.3.3:6379': 'pass2'}`), or just the password\nstring.\n\nLoad-balancing\n==============\n\n**haredis** can optionally load-balance read operations to random slaves. Pub/sub\nsubscriptions will automatically try to use a slave. For normal read-only\ncommands, you can choose to query a random slave by using the `slaveOk()` method:\n\n```javascript\nclient.slaveOk().GET('foo', function(err, reply) { ...\n```\n\n`slaveOk()` will only affect the current command.\n\nTo load-balance all reads, you can set `options.auto_slaveok = true` in\n`createClient()`. Be advised that this can case problems due to replication delay!\n\nTo force a read to go to master when using `auto_slaveok`, use `slaveOk(false)`\nbefore the command:\n\n```javascript\nclient.slaveOk(false).GET('foo', function(err, reply) { ...\n```\n\nOne-client pub/sub\n==================\n\nIn redis, pub/sub is a \"mode\" which excludes the use of regular commands while\nsubscriptions are active. Normally you need to make separate client objects to\nuse `publish` on one and `subscribe` on the other.\n\n**haredis** adds the nice ability to use pub/sub simultaneously with regular\ncommands. This is because it keeps internal redis clients in pub/sub mode for\ninternal \"gossip\", but also makes it available for users. Of course this is\noptional, and you can always maintain a separate `haredis` client for subscribes\nif you wish.\n\nAdvice\n======\n\nFor proper failover, a majority of the nodes need to be still online. This means\nthat the minimum number of nodes should be 3. Under the minimum setup, you can\nlose up to 1 node. If only 1/3 are up, commands will be queued indefinitely until\nanother node comes up.\n\nDebugging/verbose logging\n=========================\n\nTo see what's under the hood, try setting `redis.debug_mode = true`, and you can\nsee the failover process in detail:\n\n```\n[19:27:58](#1) warning: MASTER is down! (127.0.0.1:6380)\n[19:27:58](#1) info: reorientating (node down) in 2000ms\nRedis connection gone from end event.\n[19:28:00](#1) info: orientating (node down, 2/3 nodes up) ...\n[19:28:00](#1) warning: invalid master count: 0\n[19:28:00](#1) info: attempting failover!\n[19:28:00](#1) info: my failover id: gP0SCM1B\n[19:28:00](#1) info: lock was a success!\n[19:28:00](#1) info: 127.0.0.1:6381 had highest opcounter (1441) of 2 nodes. congrats!\n[19:28:00](#1) info: making 127.0.0.1:6382 into a slave...\n[19:28:00](#1) info: 127.0.0.1:6382 is slave\n[19:28:00](#1) info: publishing gossip:master for 127.0.0.1:6381\n[19:28:00](#1) info: renegotating subSlave away from master\n[19:28:00](#1) info: subSlave is now 127.0.0.1:6382\n[19:28:00](#1) info: ready, using 127.0.0.1:6381 as master\n```\n\nTo get info on which commands are executed on which servers, try setting\n`redis.command_logging = true`.\n\nRunning tests\n=============\n\n**haredis** includes the test suite from [node_redis](https://github.com/mranney/node_redis)\nwhich can be run in single or clustered mode.\n\nIf you have redis daemons running locally on ports 6380, 6381 and 8382, you can\nrun the clustered test with:\n\n```bash\n$ make test-cluster\n```\n\nOr in single-mode with a redis server on port 6379:\n\n```bash\n$ make test\n```\n\nLICENSE - \"MIT License\"\n=======================\n\n- Copyright (c) 2012 Carlos Rodriguez, http://s8f.org/\n- Copyright (c) 2012 Terra Eclipse, Inc., http://www.terraeclipse.com/\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.","readmeFilename":"README.md","_id":"haredis@0.2.11","dist":{"shasum":"7754a317d7ac5b32f2b766dfe5357856b7b41079","tarball":"https://registry.npmjs.org/haredis/-/haredis-0.2.11.tgz","integrity":"sha512-lDYYTWtFD+9vSzKQ90QDhFvR6k7VyJyHzFM2Llw2Vc5pdWkwcAzD5yL5sVL4PIHyFKSEbkPHx5HVfxGqwu1rQw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEVI723lIqpY5fn8H6FHH2cs5n7JGxOLMJI139hERI5cAiB5KyrFn4DSsKFqqxbTSeKWpNoP/C5LqRTMCGMke6XFaw=="}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"carlos8f","email":"carlos@s8f.org"},"maintainers":[{"name":"carlos8f","email":"carlos@s8f.org"}]},"0.2.12":{"author":{"name":"Carlos Rodriguez","email":"carlos@s8f.org","url":"http://s8f.org/"},"name":"haredis","description":"High-availability redis in Node.js","version":"0.2.12","repository":{"type":"git","url":"git://github.com/carlos8f/haredis.git"},"main":"./lib","scripts":{"test":"make test"},"dependencies":{"redis":"~0.7.2","async":"~0.1.22","pkginfo":"~0.2.3"},"devDependencies":{"mocha":"~1.9.0","mkdirp":"~0.3.5","rimraf":"~2.1.4","idgen":"~1.2.0"},"optionalDependencies":{},"engines":{"node":"*"},"readme":"haredis\n-------\n\nHigh-availability redis in Node.js\n\nIdea\n====\n\n**haredis** is a code wrapper around [node_redis](https://github.com/mranney/node_redis)\nwhich adds fault-taulerance to your application.\n\nFeatures:\n\n- Drop-in replacement for [node_redis](https://github.com/mranney/node_redis)\n- Easily build a cluster out of 3 or more (default-configured) redis servers\n- Auto-failover due to connection drops\n- Master conflict resolution (default your servers to master, and **haredis**\n  will elect the freshest and issue the `SLAVEOF` commands)\n- Freshness judged by an opcounter (incremented on write)\n- Locking mechanism to prevent failover contention\n- Load-balancing for reads and pub/sub\n- One-client pub/sub\n- Gossip channel for quick failover\n\nUsage\n=====\n\nStart up multiple redis daemons, with no special configuration necessary, and\nlist them like so:\n\n```javascript\nvar redis = require('haredis')\n  , nodes = ['1.2.3.1:6379', '1.2.3.2:6379', '1.2.3.3:6379']\n  , client = redis.createClient(nodes)\n  ;\n```\n\n...then use `client` as you would use [node_redis](https://github.com/mranney/node_redis).\nIf the master node goes down, **haredis** will automatically determine which node\nto promote to master, and keep standby connections to the others.\n\nIf multiple **haredis** clients are connected, a locking mechanism is implemented\nto prevent contention between failover attempts.\n\nTo see this in action,\n\n- Set up 3 local redis daemons on ports 6380-82\n- 6380 should be `SLAVEOF NO ONE`. 6381 and 82 should be slaves to 6380.\n- Run `test/basic.js` or `test/pubsub.js` (try multiple to test contention)\n- Kill the process listening on 6380 (master). **haredis** will auto-failover to\n  the node it detects is freshest, set that to master, and the others to slaves!\n- Bring up 6380, and it will be added as standby for failover.\n\nAPI differences\n===============\n\n`createClient`\n--------------\n\nIn **haredis**, `createClient` works like this:\n\n```javascript\nfunction createClient([host/port array], options)\n```\n\nThe first argument can be an array of hosts (using default port), ports (using\nlocalhost), or colon-separated strings (i.e., `1.2.3.4:6379`). **haredis** will\nattempt to connect to all of these servers.\n\n`options` corresponds to the same options you would pass\n[node_redis](https://github.com/mranney/node_redis). **haredis**\nadditionally supports:\n\n- `haredis_db_num` {Number} database number that **haredis** should store metadata\n  in (such as an opcounter). Defaults to `15`.\n\n`auth`\n------\n\n`auth` works like this:\n\n```javascript\nfunction auth({host/port to password object}, callback)\n```\n\nThe first argument can be an object of hosts, ports mapped to passwords\n(i.e., `{'1.2.3.1:6379': 'pass1', '1.2.3.3:6379': 'pass2'}`), or just the password\nstring.\n\nLoad-balancing\n==============\n\n**haredis** can optionally load-balance read operations to random slaves. Pub/sub\nsubscriptions will automatically try to use a slave. For normal read-only\ncommands, you can choose to query a random slave by using the `slaveOk()` method:\n\n```javascript\nclient.slaveOk().GET('foo', function(err, reply) { ...\n```\n\n`slaveOk()` will only affect the current command.\n\nTo load-balance all reads, you can set `options.auto_slaveok = true` in\n`createClient()`. Be advised that this can case problems due to replication delay!\n\nTo force a read to go to master when using `auto_slaveok`, use `slaveOk(false)`\nbefore the command:\n\n```javascript\nclient.slaveOk(false).GET('foo', function(err, reply) { ...\n```\n\nOne-client pub/sub\n==================\n\nIn redis, pub/sub is a \"mode\" which excludes the use of regular commands while\nsubscriptions are active. Normally you need to make separate client objects to\nuse `publish` on one and `subscribe` on the other.\n\n**haredis** adds the nice ability to use pub/sub simultaneously with regular\ncommands. This is because it keeps internal redis clients in pub/sub mode for\ninternal \"gossip\", but also makes it available for users. Of course this is\noptional, and you can always maintain a separate `haredis` client for subscribes\nif you wish.\n\nAdvice\n======\n\nFor proper failover, a majority of the nodes need to be still online. This means\nthat the minimum number of nodes should be 3. Under the minimum setup, you can\nlose up to 1 node. If only 1/3 are up, commands will be queued indefinitely until\nanother node comes up.\n\nDebugging/verbose logging\n=========================\n\nTo see what's under the hood, try setting `redis.debug_mode = true`, and you can\nsee the failover process in detail:\n\n```\n[19:27:58](#1) warning: MASTER is down! (127.0.0.1:6380)\n[19:27:58](#1) info: reorientating (node down) in 2000ms\nRedis connection gone from end event.\n[19:28:00](#1) info: orientating (node down, 2/3 nodes up) ...\n[19:28:00](#1) warning: invalid master count: 0\n[19:28:00](#1) info: attempting failover!\n[19:28:00](#1) info: my failover id: gP0SCM1B\n[19:28:00](#1) info: lock was a success!\n[19:28:00](#1) info: 127.0.0.1:6381 had highest opcounter (1441) of 2 nodes. congrats!\n[19:28:00](#1) info: making 127.0.0.1:6382 into a slave...\n[19:28:00](#1) info: 127.0.0.1:6382 is slave\n[19:28:00](#1) info: publishing gossip:master for 127.0.0.1:6381\n[19:28:00](#1) info: renegotating subSlave away from master\n[19:28:00](#1) info: subSlave is now 127.0.0.1:6382\n[19:28:00](#1) info: ready, using 127.0.0.1:6381 as master\n```\n\nTo get info on which commands are executed on which servers, try setting\n`redis.command_logging = true`.\n\nRunning tests\n=============\n\n**haredis** includes the test suite from [node_redis](https://github.com/mranney/node_redis)\nwhich can be run in single or clustered mode.\n\nIf you have redis daemons running locally on ports 6380, 6381 and 8382, you can\nrun the clustered test with:\n\n```bash\n$ make test-cluster\n```\n\nOr in single-mode with a redis server on port 6379:\n\n```bash\n$ make test\n```\n\nLICENSE - \"MIT License\"\n=======================\n\n- Copyright (c) 2012 Carlos Rodriguez, http://s8f.org/\n- Copyright (c) 2012 Terra Eclipse, Inc., http://www.terraeclipse.com/\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.","readmeFilename":"README.md","_id":"haredis@0.2.12","dist":{"shasum":"7dd9cf5c95d50a14dfd987e2da353e0f15e8b95b","tarball":"https://registry.npmjs.org/haredis/-/haredis-0.2.12.tgz","integrity":"sha512-SS19LbHg2dUkNI0p7PRYMIH1Aq6+um7YDmoAtNrPP7PMqTpTx/LUfn9Y+IJyqIVZrihIsaW4V91w+4M5jTjiog==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHLwAv7f01Pff1mp1JjXKS1qLGuHQWxcTpJy/KO4v/upAiEAvO3tP+KEqsG4vFUWWZ71DjuofcZNNATfZoP9IdSPVAE="}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"carlos8f","email":"carlos@s8f.org"},"maintainers":[{"name":"carlos8f","email":"carlos@s8f.org"}]},"0.2.13":{"author":{"name":"Carlos Rodriguez","email":"carlos@s8f.org","url":"http://s8f.org/"},"name":"haredis","description":"High-availability redis in Node.js","version":"0.2.13","repository":{"type":"git","url":"git://github.com/carlos8f/haredis.git"},"main":"./lib","scripts":{"test":"make test"},"dependencies":{"redis":"~0.7.2","async":"~0.1.22","pkginfo":"~0.2.3"},"devDependencies":{"mocha":"~1.9.0","mkdirp":"~0.3.5","rimraf":"~2.1.4","idgen":"~1.2.0"},"optionalDependencies":{},"engines":{"node":"*"},"readme":"haredis\n-------\n\nHigh-availability redis in Node.js\n\n[![build status](https://secure.travis-ci.org/carlos8f/haredis.png)](http://travis-ci.org/carlos8f/haredis)\n\nIdea\n====\n\n**haredis** is a code wrapper around [node_redis](https://github.com/mranney/node_redis)\nwhich adds fault-taulerance to your application.\n\nFeatures:\n\n- Drop-in replacement for [node_redis](https://github.com/mranney/node_redis)\n- Easily build a cluster out of 3 or more (default-configured) redis servers\n- Auto-failover due to connection drops\n- Master conflict resolution (default your servers to master, and **haredis**\n  will elect the freshest and issue the `SLAVEOF` commands)\n- Freshness judged by an opcounter (incremented on write)\n- Locking mechanism to prevent failover contention\n- Load-balancing for reads and pub/sub\n- One-client pub/sub\n- Gossip channel for quick failover\n\nUsage\n=====\n\nStart up multiple redis daemons, with no special configuration necessary, and\nlist them like so:\n\n```javascript\nvar redis = require('haredis')\n  , nodes = ['1.2.3.1:6379', '1.2.3.2:6379', '1.2.3.3:6379']\n  , client = redis.createClient(nodes)\n  ;\n```\n\n...then use `client` as you would use [node_redis](https://github.com/mranney/node_redis).\nIf the master node goes down, **haredis** will automatically determine which node\nto promote to master, and keep standby connections to the others.\n\nIf multiple **haredis** clients are connected, a locking mechanism is implemented\nto prevent contention between failover attempts.\n\nTo see this in action,\n\n- Set up 3 local redis daemons on ports 6380-82\n- 6380 should be `SLAVEOF NO ONE`. 6381 and 82 should be slaves to 6380.\n- Run `test/basic.js` or `test/pubsub.js` (try multiple to test contention)\n- Kill the process listening on 6380 (master). **haredis** will auto-failover to\n  the node it detects is freshest, set that to master, and the others to slaves!\n- Bring up 6380, and it will be added as standby for failover.\n\nAPI differences\n===============\n\n`createClient`\n--------------\n\nIn **haredis**, `createClient` works like this:\n\n```javascript\nfunction createClient([host/port array], options)\n```\n\nThe first argument can be an array of hosts (using default port), ports (using\nlocalhost), or colon-separated strings (i.e., `1.2.3.4:6379`). **haredis** will\nattempt to connect to all of these servers.\n\n`options` corresponds to the same options you would pass\n[node_redis](https://github.com/mranney/node_redis). **haredis**\nadditionally supports:\n\n- `haredis_db_num` {Number} database number that **haredis** should store metadata\n  in (such as an opcounter). Defaults to `15`.\n\n`auth`\n------\n\n`auth` works like this:\n\n```javascript\nfunction auth({host/port to password object}, callback)\n```\n\nThe first argument can be an object of hosts, ports mapped to passwords\n(i.e., `{'1.2.3.1:6379': 'pass1', '1.2.3.3:6379': 'pass2'}`), or just the password\nstring.\n\nLoad-balancing\n==============\n\n**haredis** can optionally load-balance read operations to random slaves. Pub/sub\nsubscriptions will automatically try to use a slave. For normal read-only\ncommands, you can choose to query a random slave by using the `slaveOk()` method:\n\n```javascript\nclient.slaveOk().GET('foo', function(err, reply) { ...\n```\n\n`slaveOk()` will only affect the current command.\n\nTo load-balance all reads, you can set `options.auto_slaveok = true` in\n`createClient()`. Be advised that this can case problems due to replication delay!\n\nTo force a read to go to master when using `auto_slaveok`, use `slaveOk(false)`\nbefore the command:\n\n```javascript\nclient.slaveOk(false).GET('foo', function(err, reply) { ...\n```\n\nOne-client pub/sub\n==================\n\nIn redis, pub/sub is a \"mode\" which excludes the use of regular commands while\nsubscriptions are active. Normally you need to make separate client objects to\nuse `publish` on one and `subscribe` on the other.\n\n**haredis** adds the nice ability to use pub/sub simultaneously with regular\ncommands. This is because it keeps internal redis clients in pub/sub mode for\ninternal \"gossip\", but also makes it available for users. Of course this is\noptional, and you can always maintain a separate `haredis` client for subscribes\nif you wish.\n\nAdvice\n======\n\nFor proper failover, a majority of the nodes need to be still online. This means\nthat the minimum number of nodes should be 3. Under the minimum setup, you can\nlose up to 1 node. If only 1/3 are up, commands will be queued indefinitely until\nanother node comes up.\n\nDebugging/verbose logging\n=========================\n\nTo see what's under the hood, try setting `redis.debug_mode = true`, and you can\nsee the failover process in detail:\n\n```\n[19:27:58](#1) warning: MASTER is down! (127.0.0.1:6380)\n[19:27:58](#1) info: reorientating (node down) in 2000ms\nRedis connection gone from end event.\n[19:28:00](#1) info: orientating (node down, 2/3 nodes up) ...\n[19:28:00](#1) warning: invalid master count: 0\n[19:28:00](#1) info: attempting failover!\n[19:28:00](#1) info: my failover id: gP0SCM1B\n[19:28:00](#1) info: lock was a success!\n[19:28:00](#1) info: 127.0.0.1:6381 had highest opcounter (1441) of 2 nodes. congrats!\n[19:28:00](#1) info: making 127.0.0.1:6382 into a slave...\n[19:28:00](#1) info: 127.0.0.1:6382 is slave\n[19:28:00](#1) info: publishing gossip:master for 127.0.0.1:6381\n[19:28:00](#1) info: renegotating subSlave away from master\n[19:28:00](#1) info: subSlave is now 127.0.0.1:6382\n[19:28:00](#1) info: ready, using 127.0.0.1:6381 as master\n```\n\nTo get info on which commands are executed on which servers, try setting\n`redis.command_logging = true`.\n\nRunning tests\n=============\n\n**haredis** includes the test suite from [node_redis](https://github.com/mranney/node_redis)\nwhich can be run in single or clustered mode.\n\nIf you have redis daemons running locally on ports 6380, 6381 and 8382, you can\nrun the clustered test with:\n\n```bash\n$ make test-cluster\n```\n\nOr in single-mode with a redis server on port 6379:\n\n```bash\n$ make test\n```\n\nLICENSE - \"MIT License\"\n=======================\n\n- Copyright (c) 2012 Carlos Rodriguez, http://s8f.org/\n- Copyright (c) 2012 Terra Eclipse, Inc., http://www.terraeclipse.com/\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.","readmeFilename":"README.md","_id":"haredis@0.2.13","dist":{"shasum":"af85cad6c39c847e7031bfe2a9c0bc71e4fc6e1b","tarball":"https://registry.npmjs.org/haredis/-/haredis-0.2.13.tgz","integrity":"sha512-J5JZiYJISHu7oZbZQYLnhYlfZsCsbKimlHJJFzAk5lMlAb4E0CdcJukxo3LLNrpL67oUS5QREK0JwhgPCUTNjQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDjga3XIfBot8h0ZcPpXo+SNHS7VOrHtuMVXF6P3KosnQIhAInDvvbLT45/n0nrxElWAqj7CzWdOBxukFbt+/r62Kev"}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"carlos8f","email":"carlos@s8f.org"},"maintainers":[{"name":"carlos8f","email":"carlos@s8f.org"}]},"0.2.14":{"author":{"name":"Carlos Rodriguez","email":"carlos@s8f.org","url":"http://s8f.org/"},"name":"haredis","description":"High-availability redis in Node.js","version":"0.2.14","repository":{"type":"git","url":"git://github.com/carlos8f/haredis.git"},"main":"./lib","scripts":{"test":"make test"},"dependencies":{"redis":"~0.7.2","async":"~0.1.22","pkginfo":"~0.2.3"},"devDependencies":{"mocha":"~1.9.0","mkdirp":"~0.3.5","rimraf":"~2.1.4","idgen":"~1.2.0"},"optionalDependencies":{},"engines":{"node":"*"},"readme":"haredis\n-------\n\nHigh-availability redis in Node.js\n\n[![build status](https://secure.travis-ci.org/carlos8f/haredis.png)](http://travis-ci.org/carlos8f/haredis)\n\nIdea\n====\n\n**haredis** is a code wrapper around [node_redis](https://github.com/mranney/node_redis)\nwhich adds fault-taulerance to your application.\n\nFeatures:\n\n- Drop-in replacement for [node_redis](https://github.com/mranney/node_redis)\n- Easily build a cluster out of 3 or more (default-configured) redis servers\n- Auto-failover due to connection drops\n- Master conflict resolution (default your servers to master, and **haredis**\n  will elect the freshest and issue the `SLAVEOF` commands)\n- Freshness judged by an opcounter (incremented on write)\n- Locking mechanism to prevent failover contention\n- Load-balancing for reads and pub/sub\n- One-client pub/sub\n- Gossip channel for quick failover\n\nUsage\n=====\n\nStart up multiple redis daemons, with no special configuration necessary, and\nlist them like so:\n\n```javascript\nvar redis = require('haredis')\n  , nodes = ['1.2.3.1:6379', '1.2.3.2:6379', '1.2.3.3:6379']\n  , client = redis.createClient(nodes)\n  ;\n```\n\n...then use `client` as you would use [node_redis](https://github.com/mranney/node_redis).\nIf the master node goes down, **haredis** will automatically determine which node\nto promote to master, and keep standby connections to the others.\n\nIf multiple **haredis** clients are connected, a locking mechanism is implemented\nto prevent contention between failover attempts.\n\nTo see this in action,\n\n- Set up 3 local redis daemons on ports 6380-82\n- 6380 should be `SLAVEOF NO ONE`. 6381 and 82 should be slaves to 6380.\n- Run `test/basic.js` or `test/pubsub.js` (try multiple to test contention)\n- Kill the process listening on 6380 (master). **haredis** will auto-failover to\n  the node it detects is freshest, set that to master, and the others to slaves!\n- Bring up 6380, and it will be added as standby for failover.\n\nAPI differences\n===============\n\n`createClient`\n--------------\n\nIn **haredis**, `createClient` works like this:\n\n```javascript\nfunction createClient([host/port array], options)\n```\n\nThe first argument can be an array of hosts (using default port), ports (using\nlocalhost), or colon-separated strings (i.e., `1.2.3.4:6379`). **haredis** will\nattempt to connect to all of these servers.\n\n`options` corresponds to the same options you would pass\n[node_redis](https://github.com/mranney/node_redis). **haredis**\nadditionally supports:\n\n- `haredis_db_num` {Number} database number that **haredis** should store metadata\n  in (such as an opcounter). Defaults to `15`.\n\n`auth`\n------\n\n`auth` works like this:\n\n```javascript\nfunction auth({host/port to password object}, callback)\n```\n\nThe first argument can be an object of hosts, ports mapped to passwords\n(i.e., `{'1.2.3.1:6379': 'pass1', '1.2.3.3:6379': 'pass2'}`), or just the password\nstring.\n\nLoad-balancing\n==============\n\n**haredis** can optionally load-balance read operations to random slaves. Pub/sub\nsubscriptions will automatically try to use a slave. For normal read-only\ncommands, you can choose to query a random slave by using the `slaveOk()` method:\n\n```javascript\nclient.slaveOk().GET('foo', function(err, reply) { ...\n```\n\n`slaveOk()` will only affect the current command.\n\nTo load-balance all reads, you can set `options.auto_slaveok = true` in\n`createClient()`. Be advised that this can case problems due to replication delay!\n\nTo force a read to go to master when using `auto_slaveok`, use `slaveOk(false)`\nbefore the command:\n\n```javascript\nclient.slaveOk(false).GET('foo', function(err, reply) { ...\n```\n\nOne-client pub/sub\n==================\n\nIn redis, pub/sub is a \"mode\" which excludes the use of regular commands while\nsubscriptions are active. Normally you need to make separate client objects to\nuse `publish` on one and `subscribe` on the other.\n\n**haredis** adds the nice ability to use pub/sub simultaneously with regular\ncommands. This is because it keeps internal redis clients in pub/sub mode for\ninternal \"gossip\", but also makes it available for users. Of course this is\noptional, and you can always maintain a separate `haredis` client for subscribes\nif you wish.\n\nAdvice\n======\n\nFor proper failover, a majority of the nodes need to be still online. This means\nthat the minimum number of nodes should be 3. Under the minimum setup, you can\nlose up to 1 node. If only 1/3 are up, commands will be queued indefinitely until\nanother node comes up.\n\nDebugging/verbose logging\n=========================\n\nTo see what's under the hood, try setting `redis.debug_mode = true`, and you can\nsee the failover process in detail:\n\n```\n[19:27:58](#1) warning: MASTER is down! (127.0.0.1:6380)\n[19:27:58](#1) info: reorientating (node down) in 2000ms\nRedis connection gone from end event.\n[19:28:00](#1) info: orientating (node down, 2/3 nodes up) ...\n[19:28:00](#1) warning: invalid master count: 0\n[19:28:00](#1) info: attempting failover!\n[19:28:00](#1) info: my failover id: gP0SCM1B\n[19:28:00](#1) info: lock was a success!\n[19:28:00](#1) info: 127.0.0.1:6381 had highest opcounter (1441) of 2 nodes. congrats!\n[19:28:00](#1) info: making 127.0.0.1:6382 into a slave...\n[19:28:00](#1) info: 127.0.0.1:6382 is slave\n[19:28:00](#1) info: publishing gossip:master for 127.0.0.1:6381\n[19:28:00](#1) info: renegotating subSlave away from master\n[19:28:00](#1) info: subSlave is now 127.0.0.1:6382\n[19:28:00](#1) info: ready, using 127.0.0.1:6381 as master\n```\n\nTo get info on which commands are executed on which servers, try setting\n`redis.command_logging = true`.\n\nRunning tests\n=============\n\n**haredis** includes the test suite from [node_redis](https://github.com/mranney/node_redis)\nwhich can be run in single or clustered mode.\n\nIf you have redis daemons running locally on ports 6380, 6381 and 8382, you can\nrun the clustered test with:\n\n```bash\n$ make test-cluster\n```\n\nOr in single-mode with a redis server on port 6379:\n\n```bash\n$ make test\n```\n\nLICENSE - \"MIT License\"\n=======================\n\n- Copyright (c) 2012 Carlos Rodriguez, http://s8f.org/\n- Copyright (c) 2012 Terra Eclipse, Inc., http://www.terraeclipse.com/\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.","readmeFilename":"README.md","_id":"haredis@0.2.14","dist":{"shasum":"90458b33aafed7b54447eefee589651712dc31fb","tarball":"https://registry.npmjs.org/haredis/-/haredis-0.2.14.tgz","integrity":"sha512-raWcsdfp7XM5JmJf6c4rAGRLPPXDXyZsHp7h23pd8Srp4FNGnvhBXmLl4ft5QlgfE0ZhjWmmBzOzFD9Mq2M2SA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEMCHzTqLSheeo7SFQZ6poZQSlVV7A3pne/RSjW7WNWPTiYCIH0Uebb1cSjmoufxD6Og6SFr/tdGsH3CLaGhr70/Dl4C"}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"carlos8f","email":"carlos@s8f.org"},"maintainers":[{"name":"carlos8f","email":"carlos@s8f.org"}]},"0.2.15":{"author":{"name":"Carlos Rodriguez","email":"carlos@s8f.org","url":"http://s8f.org/"},"name":"haredis","description":"High-availability redis in Node.js","version":"0.2.15","repository":{"type":"git","url":"git://github.com/carlos8f/haredis.git"},"main":"./lib","scripts":{"test":"make test"},"dependencies":{"redis":"~0.7.2","async":"~0.1.22","pkginfo":"~0.2.3"},"devDependencies":{"mocha":"~1.9.0","haredis-tmp":"~0.1.0"},"optionalDependencies":{},"engines":{"node":"*"},"readme":"haredis\n-------\n\nHigh-availability redis in Node.js\n\n[![build status](https://secure.travis-ci.org/carlos8f/haredis.png)](http://travis-ci.org/carlos8f/haredis)\n\n(note: Travis-CI support for this project is a work in progress. If the build\nbadge is red above, it's likely not really a problem with haredis, but rather a\nproblem with Travis-CI running my tests. Tests pass locally for me!)\n\nIdea\n====\n\n**haredis** is a code wrapper around [node_redis](https://github.com/mranney/node_redis)\nwhich adds fault-taulerance to your application.\n\nFeatures:\n\n- Drop-in replacement for [node_redis](https://github.com/mranney/node_redis)\n- Easily build a cluster out of 3 or more (default-configured) redis servers\n- Auto-failover due to connection drops\n- Master conflict resolution (default your servers to master, and **haredis**\n  will elect the freshest and issue the `SLAVEOF` commands)\n- Freshness judged by an opcounter (incremented on write)\n- Locking mechanism to prevent failover contention\n- Load-balancing for reads and pub/sub\n- One-client pub/sub\n- Gossip channel for quick failover\n\nUsage\n=====\n\nStart up multiple redis daemons, with no special configuration necessary, and\nlist them like so:\n\n```javascript\nvar redis = require('haredis')\n  , nodes = ['1.2.3.1:6379', '1.2.3.2:6379', '1.2.3.3:6379']\n  , client = redis.createClient(nodes)\n  ;\n```\n\n...then use `client` as you would use [node_redis](https://github.com/mranney/node_redis).\nIf the master node goes down, **haredis** will automatically determine which node\nto promote to master, and keep standby connections to the others.\n\nIf multiple **haredis** clients are connected, a locking mechanism is implemented\nto prevent contention between failover attempts.\n\nTo see this in action,\n\n- Set up 3 local redis daemons on ports 6380-82\n- 6380 should be `SLAVEOF NO ONE`. 6381 and 82 should be slaves to 6380.\n- Run `test/basic.js` or `test/pubsub.js` (try multiple to test contention)\n- Kill the process listening on 6380 (master). **haredis** will auto-failover to\n  the node it detects is freshest, set that to master, and the others to slaves!\n- Bring up 6380, and it will be added as standby for failover.\n\nAPI differences\n===============\n\n`createClient`\n--------------\n\nIn **haredis**, `createClient` works like this:\n\n```javascript\nfunction createClient([host/port array], options)\n```\n\nThe first argument can be an array of hosts (using default port), ports (using\nlocalhost), or colon-separated strings (i.e., `1.2.3.4:6379`). **haredis** will\nattempt to connect to all of these servers.\n\n`options` corresponds to the same options you would pass\n[node_redis](https://github.com/mranney/node_redis). **haredis**\nadditionally supports:\n\n- `haredis_db_num` {Number} database number that **haredis** should store metadata\n  in (such as an opcounter). Defaults to `15`.\n\n`auth`\n------\n\n`auth` works like this:\n\n```javascript\nfunction auth({host/port to password object}, callback)\n```\n\nThe first argument can be an object of hosts, ports mapped to passwords\n(i.e., `{'1.2.3.1:6379': 'pass1', '1.2.3.3:6379': 'pass2'}`), or just the password\nstring.\n\nLoad-balancing\n==============\n\n**haredis** can optionally load-balance read operations to random slaves. Pub/sub\nsubscriptions will automatically try to use a slave. For normal read-only\ncommands, you can choose to query a random slave by using the `slaveOk()` method:\n\n```javascript\nclient.slaveOk().GET('foo', function(err, reply) { ...\n```\n\n`slaveOk()` will only affect the current command.\n\nTo load-balance all reads, you can set `options.auto_slaveok = true` in\n`createClient()`. Be advised that this can case problems due to replication delay!\n\nTo force a read to go to master when using `auto_slaveok`, use `slaveOk(false)`\nbefore the command:\n\n```javascript\nclient.slaveOk(false).GET('foo', function(err, reply) { ...\n```\n\nOne-client pub/sub\n==================\n\nIn redis, pub/sub is a \"mode\" which excludes the use of regular commands while\nsubscriptions are active. Normally you need to make separate client objects to\nuse `publish` on one and `subscribe` on the other.\n\n**haredis** adds the nice ability to use pub/sub simultaneously with regular\ncommands. This is because it keeps internal redis clients in pub/sub mode for\ninternal \"gossip\", but also makes it available for users. Of course this is\noptional, and you can always maintain a separate `haredis` client for subscribes\nif you wish.\n\nAdvice\n======\n\nFor proper failover, a majority of the nodes need to be still online. This means\nthat the minimum number of nodes should be 3. Under the minimum setup, you can\nlose up to 1 node. If only 1/3 are up, commands will be queued indefinitely until\nanother node comes up.\n\nDebugging/verbose logging\n=========================\n\nTo see what's under the hood, try setting `redis.debug_mode = true`, and you can\nsee the failover process in detail:\n\n```\n[19:27:58](#1) warning: MASTER is down! (127.0.0.1:6380)\n[19:27:58](#1) info: reorientating (node down) in 2000ms\nRedis connection gone from end event.\n[19:28:00](#1) info: orientating (node down, 2/3 nodes up) ...\n[19:28:00](#1) warning: invalid master count: 0\n[19:28:00](#1) info: attempting failover!\n[19:28:00](#1) info: my failover id: gP0SCM1B\n[19:28:00](#1) info: lock was a success!\n[19:28:00](#1) info: 127.0.0.1:6381 had highest opcounter (1441) of 2 nodes. congrats!\n[19:28:00](#1) info: making 127.0.0.1:6382 into a slave...\n[19:28:00](#1) info: 127.0.0.1:6382 is slave\n[19:28:00](#1) info: publishing gossip:master for 127.0.0.1:6381\n[19:28:00](#1) info: renegotating subSlave away from master\n[19:28:00](#1) info: subSlave is now 127.0.0.1:6382\n[19:28:00](#1) info: ready, using 127.0.0.1:6381 as master\n```\n\nTo get info on which commands are executed on which servers, try setting\n`redis.command_logging = true`.\n\nRunning tests\n=============\n\n**haredis** includes the test suite from [node_redis](https://github.com/mranney/node_redis)\nwhich can be run in single or clustered mode.\n\nIf you have redis daemons running locally on ports 6380, 6381 and 8382, you can\nrun the clustered test with:\n\n```bash\n$ make test-cluster\n```\n\nOr in single-mode with a redis server on port 6379:\n\n```bash\n$ make test\n```\n\nLICENSE - \"MIT License\"\n=======================\n\n- Copyright (c) 2012 Carlos Rodriguez, http://s8f.org/\n- Copyright (c) 2012 Terra Eclipse, Inc., http://www.terraeclipse.com/\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.","readmeFilename":"README.md","bugs":{"url":"https://github.com/carlos8f/haredis/issues"},"_id":"haredis@0.2.15","dist":{"shasum":"01f72fa3a23d1b430173fd24ed7777d7b4df784b","tarball":"https://registry.npmjs.org/haredis/-/haredis-0.2.15.tgz","integrity":"sha512-Y/g+PHnEkgYry2ztPgkeeEM9dh6gbAeprxEx9ZHGZepE2b97/enaGKui0Z7eEGJDU0fyGulZ7SqjHR8ZRvXxMw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAouZMdZs04Iv08V40biDA1ZJ4UENkicouLQPlGENPs0AiBAbqxg0aTFmkheIZbSs82XlpVAjq8q7NI9CMbC65E2CQ=="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"carlos8f","email":"carlos@s8f.org"},"maintainers":[{"name":"carlos8f","email":"carlos@s8f.org"}]}},"readme":"haredis\n-------\n\nHigh-availability redis in Node.js\n\nIdea\n====\n\n**haredis** is a code wrapper around [node_redis](https://github.com/mranney/node_redis)\nwhich adds fault-taulerance to your application. Start up multiple redis daemons,\nwith no special configuration necessary, and list them like so:\n\n```javascript\nvar redis = require('haredis')\n  , nodes = ['1.2.3.1:6379', '1.2.3.2:6379', '1.2.3.3:6379']\n  , client = redis.createClient(nodes)\n  ;\n```\n\n...then use `client` as you would use [node_redis](https://github.com/mranney/node_redis).\nIf the master node goes down, **haredis** will automatically determine which node\nto promote to master, and keep standby connections to the others.\n\nIf multiple **haredis** clients are connected, a locking mechanism is implemented\nto prevent contention between failover attempts.\n\nTo see this in action,\n\n- Set up 3 local redis daemons on ports 6380-82\n- 6380 should be `SLAVEOF NO ONE`. 6381 and 82 should be slaves to 6380.\n- Run `test/basic.js` or `test/pubsub.js` (try multiple to test contention)\n- Kill the process listening on 6380 (master). **haredis** will auto-failover to\n  the node it detects is freshest, set that to master, and the others to slaves!\n- Bring up 6380, and it will be added as standby for failover.\n\nDifference: createClient\n========================\n\nIn **haredis**, `createClient` works like this:\n\n```javascript\nfunction createClient([host/port array], options)\n```\n\nThe first argument can be an array of hosts (using default port), ports (using\nlocalhost), or colon-separated strings (i.e., `1.2.3.4:6379`). **haredis** will\nattempt to connect to all of these servers.\n\n`options` corresponds to the same options you would pass\n[node_redis](https://github.com/mranney/node_redis). **haredis**\nadditionally supports:\n\n- `haredis_db_num` {Number} database number that **haredis** should store metadata\n  in (such as an opcounter). Defaults to `15`.\n\nOne-client pub/sub\n==================\n\nIn redis, pub/sub is a \"mode\" which excludes the use of regular commands while\nsubscriptions are active. Normally you need to make separate client objects to\nuse `publish` on one and `subscribe` on the other.\n\n**haredis** adds the nice ability to use pub/sub simultaneously with regular\ncommands. This is because it keeps internal redis clients in pub/sub mode for\ninternal \"gossip\", but also makes it available for users. Of course this is\noptional, and you can always maintain a separate `haredis` client for subscribes\nif you wish.\n\nAdvice\n======\n\nFor proper failover, a majority of the nodes need to be still online. This means\nthat the minimum number of nodes should be 3. Under the minimum setup, you can\nlose up to 1 node. If only 1/3 are up, commands will be queued indefinitely until\nanother node comes up.\n\nDebugging/verbose logging\n=========================\n\nTo see what's under the hood, try setting `redis.debug_mode = true`, and you can\nsee the failover process in detail:\n\n```\n[19:27:58](#1) info: set on 127.0.0.1:6380 (master default)\n[19:27:58](#1) warning: MASTER is down! (127.0.0.1:6380)\n[19:27:58](#1) info: reorientating (node down) in 2000ms\nRedis connection gone from end event.\n[19:28:00](#1) info: orientating (node down, 2/3 nodes up) ...\n[19:28:00](#1) warning: invalid master count: 0\n[19:28:00](#1) info: attempting failover!\n[19:28:00](#1) info: my failover id: gP0SCM1B\n[19:28:00](#1) info: lock was a success!\n[19:28:00](#1) info: 127.0.0.1:6381 had highest opcounter (1441) of 2 nodes. congrats!\n[19:28:00](#1) info: making 127.0.0.1:6382 into a slave...\n[19:28:00](#1) info: 127.0.0.1:6382 is slave\n[19:28:00](#1) info: publishing gossip:master for 127.0.0.1:6381\n[19:28:00](#1) info: renegotating subSlave away from master\n[19:28:00](#1) info: subSlave is now 127.0.0.1:6382\n[19:28:00](#1) info: ready, using 127.0.0.1:6381 as master\n[19:28:00](#1) info: set on 127.0.0.1:6381 (master default)\n```\n\nRunning tests\n=============\n\n**haredis** includes the test suite from [node_redis](https://github.com/mranney/node_redis)\nwhich can be run in single or clustered mode.\n\nIf you have redis daemons running locally on ports 6380, 6381 and 8382, you can\nrun the clustered test with:\n\n```bash\n$ make test-clustered\n```\n\nOr in single-mode with a redis server on port 6379:\n\n```bash\n$ make test\n```\n\nLICENSE - \"MIT License\"\n=======================\n\nCopyright (c) 2012 Carlos Rodriguez, http://s8f.org/\nCopyright (c) 2012 Terra Eclipse, Inc., http://www.terraeclipse.com/\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.","maintainers":[{"name":"carlos8f","email":"carlos@s8f.org"}],"time":{"modified":"2022-06-18T19:22:07.120Z","created":"2012-06-19T00:22:25.238Z","0.1.4":"2012-06-19T00:22:26.701Z","0.2.0":"2012-06-19T01:08:34.245Z","0.2.1":"2012-06-19T21:01:40.051Z","0.2.2":"2012-06-21T18:42:34.658Z","0.2.3":"2012-06-21T19:26:05.342Z","0.2.4":"2012-07-06T20:33:13.000Z","0.2.5":"2012-07-11T19:37:02.139Z","0.2.6":"2012-07-21T02:04:00.399Z","0.2.7":"2012-07-22T22:52:26.824Z","0.2.8":"2012-07-24T19:11:10.561Z","0.2.9":"2013-03-12T17:30:13.558Z","0.2.10":"2013-04-04T22:29:48.058Z","0.2.11":"2013-06-03T21:30:15.028Z","0.2.12":"2013-06-03T23:15:36.430Z","0.2.13":"2013-06-14T20:31:40.713Z","0.2.14":"2013-06-14T20:46:47.565Z","0.2.15":"2013-10-07T17:59:30.151Z"},"author":{"name":"Carlos Rodriguez","email":"carlos@s8f.org","url":"http://s8f.org/"},"repository":{"type":"git","url":"git://github.com/carlos8f/haredis.git"},"users":{"fgribreau":true,"cpsubrian":true}}