通过编译安装redis之后,修改配置文件之后,发现里面的配置不生效?
原因是:当我们在启动redis的时候,需要加上redis.conf的配置文件一起
我的redis-server在/usr/local/bin/redis-server ,然后配置文件在/opt/redis-4.0.10/redis.conf
因此,启动redis这样启动,才能生效配置文件:
/usr/local/bin/redis-server /opt/redis-4.0.10/redis.conf
当以守护进程的方式启动了redis之后,打开session,连接redis:
redis-cli # 报错: Could not connect to Redis at 127.0.0.1:6379: Connection refused Could not connect to Redis at 127.0.0.1:6379: Connection refused # 通过ip和端口连接-配置文件中设置的 redis-cli -h 192.168.6.128 -p 6379 ping # 不同,需要输入密码 (error) NOAUTH Authentication required. auth admin(admin是自己设置的密码) # OK ping # 返回PONG 即可
详情:
# Note that in order to read the configuration file, Redis must be # started with the file path as first argument: # # ./redis-server /path/to/redis.conf
此外:停止redis命令是:
/usr/local/bin/redis-cli shutdown