Win系统下配置文件为 redis.windows.conf
Linux系统下 配置文件为redis.conf
Linux系统下使用redis-server命令启动redis服务器时,可以指定配置文件
redis-server /usr/local/redis/conf/redis.conf
1、redis服务器允许远程主机访问
(修改配置文件redis.conf)
bind 127.0.0.1 修改为 bind 0.0.0.0 daemonize no 修改伪 daemonize yes
(daemonize yes 表示开启redis守护进程,在linux启动时自动允许redis作为守护进程来运行)
关闭protected-mode模式,外部网络可以直接访问redis
protected-mode yes 改为 protected-mode no
2、客户端远程链接redis服务器
redis-cli [options] [cmd [arg [arg...]]]
参数:
-h 主机ip地址 默认127.0.0.1
-p 端口 默认6379
-a 密码 如果设置了密码 需要传递密码