问题标签 [ioredis]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
node.js - 设置 ioredis 的过期时间
我正在尝试为 ioredis nodejs 中的一组值设置过期时间。我可以使用此命令将一组添加到 reids
但是我需要为这个集合设置一个过期时间。我怎样才能做到这一点?
node.js - Redis sentinel not connect to master: Error: READONLY You can't write against a read only slave?
我redis replication
和sentinel
建筑师有这个:
5个服务器:.1
、.2
、.3
和.4
.5
.1
: nodejs app, redis master, redis sentinel.2
: nodejs 应用程序,redis 从属.3
: nodejs 应用程序,redis 从属.4
: redis 哨兵.5
: redis 哨兵
Sentinel 按预期处理故障转移。
redis-cli -h x.y.z.5 -p 26379 sentinel get-master-addr-by-name mymaster
总是返回.1
服务器。
我连接到此复制的代码(我使用ioredis):
然后,.1
nodejs app 运行正常,但是在.2
and.3
中,出现这个日志的错误:
P/s:我的 redis 服务器绑定了服务器 IP 和127.0.0.1
. 因为,没有127.0.0.1
,我遇到了这个错误:
所以,我想,我的应用程序没有连接到redis server
via sentinel
,而是直接连接到localhost
.
任何帮助都是合适的!
更新:当我打开时记录DEBUG=ioredis:*
:
更新 2:还有一件事,我在本地机器上运行应用程序,production
一切都像魅力一样工作!!!
redis - 如何使用 HSCAN/redis 过滤多个模式
我试过了,ioredis
但 HSCAN 只支持一个匹配模式。
从redis过滤多个模式的最佳方法是什么
node.js - 在 Redis 上将字符串数据与压缩(缓冲)数据一起存储
有没有机会在 Redis 上将 Buffer 数据与字符串数据一起存储。
伪代码:
虽然这似乎不可能我想问。
有没有机会将压缩数据与字符串一起存储?
编辑:
将压缩数据与未压缩数据存储在同一个密钥中后,我无法解压上面的用户数据。
伪代码:
promise - ioredis bluebird 在处理程序中创建了一个承诺,但没有从它返回
有人可以向我解释为什么我收到此警告警告:在处理程序中创建了一个承诺,但在我执行以下代码时没有从它返回:
这是其余的代码:
我正在使用以下库:ioredis & bluebird。代码执行良好,一切正常!我只是不喜欢我收到无法解决的警告的事实!
javascript - 如何创建与 Master 和 Slave 的 Redis 连接
我正在尝试进行 Redis 连接,我有一个“主”端口和两个从属端口。我想用哨兵做到这一点。
我认为连接redis的实际代码实际上已被弃用。
这是我的代码。
我正在阅读其他帖子,我认为使用 ioredis 可能会很酷。但是我对Redis了解不多...
我想与redis建立连接,如果主服务器关闭,则会自动连接到从服务器。
我希望你能帮助我,
罗斯。
javascript - How to set a value in a bitmap and retrieve a bitmap from redis using ioredis?
I would like to use a Redis bitmap to represent values.
If I have an integer value then I want to be able to set the corresponding index of the bitmap to 1
or true
.
I also want to be able to retrieve the entire bitmap and walk it to identify the positions of the "ones".
There is a bitfield data structure in Redis, but I don't understand the documentation.
There are the following commands:
What is the <type>
field? What value should I use for <value>
(string 1
?).
Finally, can anyone help me with the syntax for these commands when using ioredis?
node.js - 使用 ioredis 向 redis 发送任意命令
是否可以使用 ioredis for Node JS 向 Redis 发送任意命令?
例如,我正在使用新的 RediSearch 模块,并希望使用以下命令创建索引:
我将如何使用 ioredis 发送此命令?
node.js - 从 NodeJS 连接到 Redis 引发连接超时
我在 azure linux vm 中有一个 redis 服务器,在同一个 VM(A) 中运行一个 master、slave 和 sentinel。当我尝试使用 redis-cli 从另一个 VM(B) 连接到 redis sentinal 时,我能够连接并设置和获取值。但是当我尝试使用来自VM(B)的nodeJS中的ioredis模块连接到redis sentinel时,它会引发连接超时错误。我使用以下代码片段从节点应用程序连接到哨兵
令人困惑的部分是,当我在同一个 vm(A) 中运行 redis master、slave 和 sentinel 并使用 '127.0.0.1' 而不是 'xxxx' 时,代码工作正常。
任何帮助深表感谢。
redis - Redis 集群重新分片期间集群重定向过多
Redis 版本:3.2.10
ioredis 版本:3.1.4
最近我测试了在redis集群上运行resharding操作,同时集群处于相当高的负载下,客户端使用ioredis node.js库,偶尔在客户端上我们在reshard操作期间看到以下错误。
我目前对 ioredis 的以下选项使用默认值: maxRedirections 16 retryDelayOnFailover 100ms
这是否意味着在重新分片期间,插槽数据的传输时间超过 1600 毫秒?
我大致知道迁移插槽的过程如下:
- 使用 CLUSTER SETSLOT IMPORTING 将目标节点槽设置为导入状态。
- 使用 CLUSTER SETSLOT MIGRATING 将源节点槽设置为迁移状态。
- 使用 CLUSTER GETKEYSINSLOT 命令从源节点获取密钥,并使用 MIGRATE 命令将它们移动到目标节点。
- 在源或目标中使用 CLUSTER SETSLOT NODE。
但是在上述哪些步骤中,客户端将无法获取或设置关键数据?
对于上下文,在此测试期间,每个节点的操作速度高达 100k 操作/秒。