redis loadServerConfig

函數原型 void loadServerConfig(char *filename, char *options)

redis可以通過指定配置文件和命令行方式修改redis 配置,其中filename就是配置文件,option 保存使用者從命令行啓動的參數

1讀取filename以每行一個命令方式保存在config

2 命令行參數以每行一個命令方式保存在config

最終都轉換成每行一個參數配置config,然後調用loadServerConfigFromString進行配置解析

配置文件格式

command arg1 arg2 arg3 ...

如下默認配置(redis.conf):

pidfile /var/run/redis.pid
port 6379
tcp-backlog 511
timeout 0
tcp-keepalive 0
loglevel notice
logfile ""
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir ./
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
slave-priority 100
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
lua-time-limit 5000
cluster-enabled yes
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10

aof-rewrite-incremental-fsync yes

配置key

變量名

pidfile

server.pidfile

/var/run/redis.pid

port

server.port

6379

tcp-backlog

server.tcp_backlog

511

timeout

server.maxidletime

0

tcp-keepalive

server.tcpkeepalive

0

databases

 

16

stop-writes-on-bgsave-error

 

yes

發佈了83 篇原創文章 · 獲贊 8 · 訪問量 15萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章