shell - 命令提示符下远程服务器的输出

标签 shell redis

我可以使用 telnet 命令连接到远程 redis 并获取“mytest”键的值。以下内容按预期工作。

[root@server shantanu]# telnet 10.10.10.100 6379
Trying 10.10.10.100...
Connected to 10.10.10.100 (10.10.10.100).
Escape character is '^]'.
get mytest
$14
this is first 

但是我如何在 shell 脚本中使用它呢? 我习惯使用以下方式连接到 mysql:

msyql -h10.10.10.100 -uroot -proot@123 -e"show databases"

redis 有类似的语法吗?

最佳答案

您也可以使用 redis-cli,包含在 redis 中

$ ./src/redis-cli --raw GET key
test

关于shell - 命令提示符下远程服务器的输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8091721/

相关文章:

仅当提供参数时,Python 脚本才在 Bash 脚本中返回空字符串

caching - 在缓存中搜索/选择查询

c# - Windows 本地主机上的 Redis 性能

ruby-on-rails - 如何在 Rails 查询中缓存数据库产生的列表

redis - redis cluster multi set命令可以在不同的插槽上吗?

shell - 为什么Shell中多个赋值可以用空格分隔

linux - 如何在 docker 容器中定义环境变量以与我的 jar 文件一起使用

linux - bash 脚本中的“全局化”Bash 函数

c - dup2 错误文件描述符

c# - 字典c#的算术运算