redis - 提示闪烁为空时如何使redis工作?
问题描述
所以我想用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 服务器已经在运行并正在侦听 port 6379
。
tcp 7 0 0.0.0.0:6379 0.0.0.0:* LISTEN 23836/redis-server
现在您可以终止现有的 redis 服务器并重新运行该过程。
然后,您可以通过redis-cli连接到 redis 。然后尝试一些 get/set 命令。
$ redis-cli
127.0.0.1:6379> set a "asdfasdf"
OK
127.0.0.1:6379> get a
"asdfasdf"
推荐阅读
- ruby-on-rails - 为什么我会收到此 Ruby on Rails 错误?:#index 缺少请求格式的模板:text/html
- r - 使用 Tidyverse 和 fitdistrplus 进行批量分布拟合
- composer-php - PHPUnit 找不到我的类,但 composer.json 中的自动加载看起来不错
- css - 容器部分之外的图像
- java - 如何使用apache POI在excel中基于多列值查找数据
- java - 无法使用 cygwin 初始化 hive3.1.2 的架构
- mysql - 在 Flask App 中从 SQLite 转换为 MySQL 时出现 1064 错误
- reactjs - 当匹配 url 嵌套路由器不起作用
- javascript - javascript 从地图中检索值
- amazon-redshift - 如何按顺序运行 sql 语句?