Skip to content

Redis 配置

Redis 是开箱即用的,当然也提供了一些设置项目。

配置

有三种方式来配置 Redis 服务器的行为:

  1. 通过命令行传入参数 ./redis-sever --port 6380 --replicaof 127.0.0.1 6379
  2. 通过配置文件 redis.conf 来实现
  3. 通过 CONFIG SET 来在服务器运行时更改 Redis 配置,它能够通过编程的方式在 Client 中进行操作,不过并不是所有的配置项都支持

redis.conf

Redis 的配置通常位于 /etc/redis/redis.conf,也可以在启动服务器时指定要使用的配置文件:

Bash
redis-server /path/to/redis.conf

常用配置说明

参考