修改redis配置文件
redis.conf
1.bind
bind 127.0.0.1 如果指定了bind,则说明只允许来自指定网卡的Redis请求。如果没有指定,就说明可以接受来自任意一个网卡的Redis请求。
关于bind的两种配置:
1. 在bind中配置多个IP地址:bind xxxxx xxxxx 127.0.0.0.1
2. 将bind的配置改为:bind 0.0.0.0 任何IP地址都能连接
2.daemonize
- A、redis.conf配置文件中daemonize守护线程,默认是NO。
- B、daemonize是用来指定redis是否要用守护线程的方式启动。
-
daemonize 设置yes或者no区别
daemonize:yes
:redis采用的是单进程多线程的模式。当redis.conf中选项daemonize设置成yes时,代表开启守护进程模式。在该模式下,redis会在后台运行,并将进程pid号写入至redis.conf选项pidfile设置的文件中,此时redis将一直运行,除非手动kill该进程。daemonize:no
: 当daemonize选项设置成no时,当前界面将进入redis的命令行界面,exit强制退出或者关闭连接工具(putty,xshell等)都会导致redis进程退出。
3. protected-mode
protected-mode no关闭保护进程