ioredis is a robust, performance-focused, and full-featured Redis client for Node.js, currently at version 5.10.1. It provides comprehensive support for various Redis topologies including Cluster, Sentinel, and offers advanced features like Pipelining, Streams, Pub/Sub (with binary messages), and Lua scripting. While ioredis is a stable and widely used project, its maintenance is now on a best-effort basis for relevant issues. For new projects, the official `node-redis` client is explicitly recommended by the maintainers, as it is actively maintained and supports newer Redis commands and capabilities from Redis Stack and Redis 8. ioredis is written entirely in TypeScript, providing official type declarations, and is compatible with Node.js versions 12 and above, and Redis versions 2.6.12 through 7.x. Its differentiators include high performance, a Promise-based API (also supporting callbacks), sophisticated error handling, transparent key prefixing, and autopipelining. Releases are frequent for bug fixes and minor features.
npm install ioredisVerified import paths — ran on the pinned version, not inferred.
Demonstrates connecting to a single Redis instance and a Redis Cluster, performing basic set/get operations, handling errors, and ensuring proper disconnection. Uses environment variables for sensitive connection details.
For new applications, consider `node-redis`. For existing ioredis projects, ensure robust error handling and keep up-to-date with patch releases.
Ensure your Node.js runtime environment is version 12.x or higher before upgrading ioredis to v5.x.x.
Remove any custom Promise implementations, as ioredis v5 will use native Promises.
Run `npm uninstall @types/ioredis`. Review your TypeScript code for minor type errors, especially for imports (e.g., `import * as Redis from 'ioredis'` is now `import { Redis } from 'ioredis'`).If you don't intend to pass a username to Redis, omit the username part from your connection URI (e.g., `redis://:password@host:port`).
If you rely on proactive cluster slot refreshing, explicitly set `slotsRefreshInterval` in your `Cluster` options, e.g., `new Cluster(nodes, { slotsRefreshInterval: 5000 })`.Review usage of blocking commands. If you experience unexpected behavior or timeouts, consult the ioredis documentation for how to explicitly enable client-side blocking timeouts if required.
Update calls to these properties using the new method syntax, e.g., `cluster.nodes('masters')` or `cluster.nodes('all')`.Verify that the Redis server is running and accessible from the application's host. Check firewall rules, network connectivity, and ensure the correct host and port are configured in the ioredis client. If using a cloud provider, check security groups and instance status.
For ESM with TypeScript, use `import { Redis } from 'ioredis';`. For CommonJS, use `const Redis = require('ioredis').default || require('ioredis');` and always instantiate with `new Redis()`.Ensure you are using `new Cluster(...)` for Redis Cluster connections. The `ioredis` Cluster client should handle `MOVED` redirections automatically. If this persists, increase `slotsRefreshTimeout` or `retryDelayOnMoved` options in the Cluster configuration. It can also occur during failovers or resharding.
Verify the Redis password and username (if ACLs are enabled) in your client configuration matches the Redis server's configuration. For managed services, check token validity or credential rotation policies.
No dependency data recorded yet.