所以我想使用redis作为一个工具,在不同语言编写的多个脚本之间传递数据。
我通过我的操作系统上的包管理器安装了 redis(opensuse 如果它有助于调试...)。
我运行了 sudo redis-server 和 redis-cli,我得到了这个
wawa@linux-79q8:~/Desktop> sudo redis-server
[sudo] password for root:
26824:C 08 May 01:37:37.913 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
26824:C 08 May 01:37:37.913 # Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=26824, just started
26824:C 08 May 01:37:37.913 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
26824:M 08 May 01:37:37.915 * Increased maximum number of open files to 10032 (it was originally set to 1024).
26824:M 08 May 01:37:37.915 # Creating Server TCP listening socket *:6379: bind: Address already in use
wawa@linux-79q8:~/Desktop> redis-cli ping
什么都没有!!!提示只是闪烁为空。我不知道如何调试它。我是 redis 的新手。
请帮忙!
编辑:netsat 给我这个:
wawa@linux-79q8:~/Desktop> sudo netstat -antp | grep 6379
[sudo] password for root:
tcp 7 0 0.0.0.0:6379 0.0.0.0:* LISTEN 23836/redis-server
tcp 0 0 127.0.0.1:44128 127.0.0.1:6379 ESTABLISHED 27034/redis-cli
tcp 14 0 127.0.0.1:6379 127.0.0.1:44128 ESTABLISHED -
tcp 0 0 127.0.0.1:43878 127.0.0.1:6379 ESTABLISHED 24530/redis-cli
tcp 17 0 127.0.0.1:6379 127.0.0.1:43878 ESTABLISHED -
tcp 15 0 127.0.0.1:6379 127.0.0.1:43850 CLOSE_WAIT -
tcp 17 0 127.0.0.1:6379 127.0.0.1:43976 ESTABLISHED -
tcp 17 0 127.0.0.1:6379 127.0.0.1:43886 ESTABLISHED -
tcp 18 0 127.0.0.1:6379 127.0.0.1:43862 CLOSE_WAIT -
tcp 18 0 127.0.0.1:6379 127.0.0.1:43854 CLOSE_WAIT -
tcp 0 0 127.0.0.1:43886 127.0.0.1:6379 ESTABLISHED 24786/redis-cli
tcp 0 0 127.0.0.1:43976 127.0.0.1:6379 ESTABLISHED 26551/redis-cli
tcp6 0 0 :::6379 :::* LISTEN 23836/redis-server
wawa@linux-79q8:~/Desktop>
最佳答案
看来您的 Redis 服务器已经在运行并监听端口 6379
。
tcp 7 0 0.0.0.0:6379 0.0.0.0:* LISTEN 23836/redis-server
现在您可以终止现有的 Redis 服务器并重新运行该进程。
然后,您可以通过 redis-cli 连接到 redis。然后尝试一些获取/设置命令。
$ redis-cli
127.0.0.1:6379> set a "asdfasdf"
OK
127.0.0.1:6379> get a
"asdfasdf"
关于redis - 提示符闪烁为空时,如何让redis工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50229473/