本文主要写真正上生产环境的部署策略-config文件的方式,简单的命令行直接启动的,这里不体现
一剔除原config配置文件中的各种注释和空行
# actively rehash the main dictionaries, freeing memory when possible.
#
# If unsure:
原本的config文件如上,有很多注释行,这些东西有利于理解整个redis的配置项,但在实际使用时,很不容易看到config里到底开启了什么。按 以下方法可以对#开头的注释行和空行进行删除。
用notepad++打开文件
ctrl+f进入到替换标签中,查找目标内容^#.*替换内容为空(),其中查找模式选择正则表达式,勾选循环查找。替换后
查找目标内容改为^[\t ]*\r\n替换内容为空。
对原http://download.redis.io/redis-stable/redis.conf完成替换后内容如下:
bind 127.0.0.1
protected-mode yes
port 6379
tcp-backlog 511
timeout 0
tcp-keepalive 300
daemonize no
supervised no
pidfile /var/run/redis_6379.pid
loglevel notice
logfile ""
databases 16
always-show-logo yes
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir ./
slave-