Redis配置

Redis作为一个高性能的key-value数据库,我们主要是学习使用即可;

参考地址:

redis教程:http://www.runoob.com/redis/redis-tutorial.html

redis百度百科:https://baike.baidu.com/item/Redis/6549233?fr=aladdin

redis官网:https://redis.io/

一、Redis添加密码

为了安全会为Redis添加一个访问密码,为redis配置密码只需在配置文件加入如下行即可配置密码

requirepass foobared #配置密码为foobared

二、改redis的连接端口

Redis服务修改端口只需修改配置文件中的port属性

port 7379 #修改端口为7379

三、主要配置项说明

daemonize yes #是否以daemon模式运行,如果是在docker容器平台中该值需要配置为no,否则容器无法启动
pidfile /usr/local/redis/redis.pid #记录进程号文件位置
port 6379
tcp-backlog 511
bind 0.0.0.0 #redis 运行绑定网卡地址,对于多网卡的服务器建议绑定一个通信的网络地址
timeout 0 #当Client端在timeout时间后如果未发送命令,则主动断开链接,配置为0 表示不主动断开
tcp-keepalive 60
loglevel notice
logfile "/usr/local/redis/logs/redis.log"
databases 16 #最大可使用的dbindex
dir /usr/local/redis/data
# slaveof <masterip> <masterport>
# masterauth <master-password>
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
#requirepass foobared
appendonly yes
appendfilename "appendonly.aof"
# appendfsync always
appendfsync everysec
# appendfsync no
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
# cluster-config-file nodes-6379.conf
# cluster-node-timeout 15000
# cluster-slave-validity-factor 10
# cluster-migration-barrier 1
# cluster-require-full-coverage 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

 

posted @ 2019-03-22 11:19  wmqiang  阅读(128)  评论(0编辑  收藏  举报