【问题标题】:Redis syntax help in bin/sh script?bin/sh 脚本中的 Redis 语法帮助?
【发布时间】:2015-06-13 01:09:03
【问题描述】:

目前我已经计划了一个使用脚本通过 rpush 将键值添加到 redis 中的过程。

我目前正在使用 bin/sh 来启动 redis。 但是将我的 keyvalue 推送到 redis 服务器的语法是什么。

#!/bin/sh

redis-cli -h 172.16.114.54
rpush stlfile "fad.stl"         // how to rpush in with the correct syntax?

什么样的语言更适合redis所以也许我现在可以改变以简化我未来的流程

【问题讨论】:

  • 要推送文件的内容吗?
  • 我只想在 redis 中注册一个名为“fad.stl”的文件名,但我不知道如何使用 bin/sh 进行 rpush
  • 你得到了什么错误?
  • 没有任何错误,直接进入redis-cli,也没有把我的值导入stlfile
  • 你把所有东西都放在同一条线上了吗?

标签: redis


【解决方案1】:

似乎使用 python 编写 Redis 代码会更容易 从这篇文章中我发现here我可以轻松安装python。 ImportError: No module named redis

我设法用这个创建了一个 python 脚本

import redis

r = redis.StrictRedis(host='172.16.114.54', port=6379, db=0)
r.lpush ('stlfile', 'variable.stl')
r.lrange ('stlfile', 0, -1)

当与另一个客户检查时,我设法看到 variable.stl 进入了:D

【讨论】:

    猜你喜欢
    • 2011-02-27
    • 2019-04-25
    • 2012-05-22
    • 1970-01-01
    • 2013-01-29
    • 1970-01-01
    • 2019-12-06
    • 2019-12-24
    • 2018-05-16
    相关资源
    最近更新 更多