欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 文旅 > 旅游 > redis 安装配置

redis 安装配置

2025/4/2 17:37:19 来源:https://blog.csdn.net/m0_52062236/article/details/146319237  浏览:    关键词:redis 安装配置

安装:redis install - redis.io


远程连接 RDM : redis desktop manager

本地连接默认情况不需要密码,直接 redis-cli

# You will also need to set a password unless you explicitly disable protected
# mode.# When protected mode is on and the default user has no password, the server
# only accepts local connections from the IPv4 address (127.0.0.1), IPv6 address
# (::1) or Unix domain sockets.# By default protected mode is enabled. You should disable it only if
# you are sure you want clients from other hosts to connect to Redis
# even if no authentication is configured.bind 0.0.0.0
protected-mode no
requirepass default

测试连接

root@u20:/# redis-cli
127.0.0.1:6379> ping
(error) NOAUTH Authentication required.
127.0.0.1:6379> auth default
OK
127.0.0.1:6379> ping
PONG# 或者直接在命令行输入密码
root@u20t:/# redis-cli -a default
127.0.0.1:6379> ping
PONG

主从复制

# replicaof <masterip> <masterport>
# masterauth <master-password>
# masteruser <username>
  • 指定当前 Redis 实例作为从节点,并连接到指定的主节点进行数据复制。
  • 设置连接到主节点时所需的密码认证。当主节点启用了密码认证(通过 requirepass 配置项),从节点需要提供相应的密码才能成功连接并进行数据复制。
  • 指定用于连接主节点的用户名(需要 Redis 6 及以上版本,并且主节点启用了 ACL)。username 是主节点上配置的具有复制权限的用户名

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词