Ubuntu上安装、使用Redis的详细教程

sudo apt-get update
sudo apt-get install redis

启动方式二
systemctl start redis-server
启动方式三
service redis-server start
重启redis
service redis-server restart
关闭redis
service redis-server stop
查看redis状态
service redis-server status
4、在宿主机连接redis
根据以上步骤安装启动redis后,默认只能在虚拟机内访问redis,如果在其他机器上访问,需要修改配置文件。

默认情况下,redis的配置文件在/etc/redis/redis.conf,打开这个文件,注释掉下面的内容。

bind 127.0.0.1 -::1
然后就可以在windows上通过Another Redis Desktop Manager连接ubuntu上的redis了,当然了,如果你希望给redis设置一个密码,可以在配置文件中加上以下的配置。

requirepass 你的密码

# 密码,建议生产环境开启

 

  1. 将 bind 注释掉,允许非本机访问
  2. 关闭安全守护模式,将 protected-mode 设置为 no
  3. 加上安全认证,设置 requirepass 密码,但在我的测试中,不设置密码只执行上面两个步骤,也可以解决这个 bug

执行上面操作后,重启 Redis 服务端,报错就解决了

 

 

Caused by: java.util.concurrent.CompletionException: org.redisson.client.RedisException: ERR AUTH <password> called without any password configured for the default user. Are you sure your configuration is correct?#

 

解决方案:

把yaml文件中连接Redis 的配置的密码字段改为 auth,然后发现就可以了。

目前我也没搞明白,什么时候用password,什么时候用auth,我另一个demo项目,用的也是redis-windows-6.2.6,  但是使用password字段就可以连接。。。感觉与redis-starter的版本有关。

 

 

 

posted on   zyp_java_net  阅读(178)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示