Mac(os x):有没有办法只安装redis-cli?

noj0wjuj  于 2023-01-01  发布在  Redis
关注(0)|答案(6)|浏览(195)

我试着运行brew install redis-cli并在谷歌上搜索,但一无所获。有什么想法吗?

d4so4syb

d4so4syb1#

如果您安装redishomebrew,您可以看到软件包中的内容如下:

brew install redis
brew ls redis

你会看到,它只安装非常少的文件确实无论如何:

/usr/local/Cellar/redis/3.2.3/bin/redis-benchmark
/usr/local/Cellar/redis/3.2.3/bin/redis-check-aof
/usr/local/Cellar/redis/3.2.3/bin/redis-check-rdb
/usr/local/Cellar/redis/3.2.3/bin/redis-cli
/usr/local/Cellar/redis/3.2.3/bin/redis-sentinel
/usr/local/Cellar/redis/3.2.3/bin/redis-server
/usr/local/Cellar/redis/3.2.3/homebrew.mxcl.redis.plist

或者,您可以直接查看homebrew的Cellar,如下所示:

ls -lR /usr/local/Cellar/redis/3.2.3
total 40
-rw-r--r--  1 mark  admin  1487  2 Aug 10:00 COPYING
-rw-r--r--  1 mark  admin   376  9 Aug 10:34 INSTALL_RECEIPT.json
-rw-r--r--  1 mark  admin  6834  2 Aug 10:00 README.md
drwxr-xr-x  8 mark  admin   272  2 Aug 10:00 bin
-rw-r--r--  1 mark  admin   785  9 Aug 10:34 homebrew.mxcl.redis.plist

/usr/local/Cellar/redis/3.2.3/bin:
total 3440
-r-xr-xr-x  1 mark  admin   67668  2 Aug 10:00 redis-benchmark
-r-xr-xr-x  1 mark  admin   13936  2 Aug 10:00 redis-check-aof
-r-xr-xr-x  1 mark  admin  768704  2 Aug 10:00 redis-check-rdb
-r-xr-xr-x  1 mark  admin  129712  2 Aug 10:00 redis-cli
lrwxr-xr-x  1 mark  admin      12  2 Aug 10:00 redis-sentinel -> redis-server
-r-xr-xr-x  1 mark  admin  768704  2 Aug 10:00 redis-server

所以,很多都是许可证,README和,在6个二进制文件中,一个是符号链接,所以它不是一个沉重的安装负载的服务和配置文件。
顺便说一句,您可以随时提取和运行dockerredis-cli,而无需安装任何内容:

docker run -it redis redis-cli -h 192.168.0.8     # change to your Redis host's IP

如果你只想安装最少的软件,你其实什么都不用安装!Redis协议非常简单,你可以在bash中创建一个命令,然后自己发送它,如下所示:

#!/bin/bash
################################################################################
# redis.sh
# Very, very simplistic Redis client in bash
# Mark Setchell
# Usage:
# redis.sh SET answer 42
#
# Ref: https://redis.io/topics/mass-insert
################################################################################
if [ $# -lt 2 ] ; then
    echo "Usage: redis.sh SET answer 42" >&2
    exit 1
fi

# Build protocol string
protocol="*$#\r\n"

for var in "$@" ; do
   protocol+="$" 
   protocol+="${#var}\r\n${var}\r\n"
done

# Send to Redis on default port on local host - but you can change it
printf "$protocol" > /dev/tcp/localhost/6379
kadbb459

kadbb4592#

brew tap ringohub/redis-cli

brew update && brew doctor

brew install redis-cli
nkkqxpd9

nkkqxpd93#

这不是一个正确的安装redis-cli,但我得到我的工作完成。我得到它的工作使用npm,我安装了redis-cli的javascript库。

$ npm install -g redis-cli                  
    /Users/toni/.nvm/versions/node/v8.9.4/bin/rdcli -> /Users/toni/.nvm/versions/node/v8.9.4/lib/node_modules/redis-cli/bin/rdcli
    + redis-cli@1.3.0
    updated 1 package in 1.07s

然后使用控制台:

$ rdcli                                 
127.0.0.1:6379> keys incident::sequence
1) incident::sequence
127.0.0.1:6379> GET incident::sequence
570
127.0.0.1:6379> config get dir
1) dir
2) /data
127.0.0.1:6379> exit
00jrzges

00jrzges4#

我安装了redis-cli节点js模块:

yarn global add redis-cli

然后运行Redis客户端:

rdcli

并且连接了redis客户端,则激活了redis REPL shell

vecaoik1

vecaoik15#

首先你需要检查是否安装了redis。命令- telnet localhost 6379
如果没有,你可以用啤酒或Yarn来添加。
对于Yarn- yarn全局添加redis-cli用于brew- brew安装用于NPM的redis- $npm安装-g redis-cli

gcuhipw9

gcuhipw96#

您可以使用telnet [host [port]]连接到redis:

telnet localhost 6379

相关问题