【问题标题】:How to connect to Redis using R (rredis and specific socket)如何使用 R 连接到 Redis(rredis 和特定套接字)
【发布时间】:2017-05-26 08:12:57
【问题描述】:

我对 Redis 完全陌生,对 R 也相对陌生。我需要做一个作业,首先我需要连接到一个套接字(它为股票流式传输键值)。

我使用自制软件在我的 mac 中安装了 Redis,然后在 R 中安装了包 rredis。 每次我尝试连接到本地主机时都会收到以下错误:

redisConnect()
Warning message:
In .openConnection(host = host, port = port, nodelay = nodelay,  :
  Unable to set nodelay.

如果我设置nodelay = F 我已连接

现在,我正在尝试连接到特定的套接字(ip:88.99.38.191,端口:1337)

我明白了

redisConnect(host = "88.99.38.191", port = 1337)
Error:  Error in doTryCatch(return(expr), name, parentenv, handler): 

Unknown message type

Warning message:
In .openConnection(host = host, port = port, nodelay = nodelay,  :
  Unable to set nodelay.

如果我尝试设置nodelay = F

 > redisConnect(host = "88.99.38.191", port = 1337, nodelay = F)
Error:  Error in doTryCatch(return(expr), name, parentenv, handler): Unknown message type

Warning messages:
1: closing unused connection 12 (->localhost:6379) 
2: closing unused connection 11 (->localhost:6379) 
3: closing unused connection 10 (->localhost:6379) 
4: closing unused connection 9 (->localhost:6379) 

有人知道我做错了什么吗?我在网上看到的所有指南/教程在nodelay = T的默认设置下都没有问题

ps:请原谅我的无知,或者我有类似的帖子,我没有找到。

【问题讨论】:

    标签: r redis data-stream nosql


    【解决方案1】:

    对于那些感兴趣的人来说,与套接字的连接是这样建立的

    con <- socketConnection(host="88.99.38.191", port = 1337, blocking=T, server=FALSE, open="r+")

    它与redis无关。 Redis 正在监听本地 ip,而redisConnect 用于连接远程 redis 服务器。

    更多信息可以在here找到。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-11-23
      • 1970-01-01
      • 1970-01-01
      • 2021-11-11
      • 1970-01-01
      • 2015-01-12
      • 2022-06-16
      相关资源
      最近更新 更多