← 返回命令列表

Linux command

redis-server 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Start Redis server

redis-server

Start with a configuration file

redis-server [/path/to/redis.conf]

Start on a specific port

redis-server --port [6380]

Start with password protection

redis-server --requirepass [password]

Start in daemonized mode

redis-server --daemonize yes

Start with a specific data directory

redis-server --dir [/path/to/data]

Test configuration file syntax

redis-server [/path/to/redis.conf] --test-memory [megabytes]

说明

redis-server is the Redis server daemon, an in-memory data structure store supporting strings, lists, sets, sorted sets, hashes, streams, and more. It provides high-performance key-value storage with optional persistence. Redis supports two persistence modes: RDB snapshots (point-in-time snapshots at intervals) and AOF (append-only file logging every write). Both can be enabled simultaneously for maximum durability. The server supports replication for high availability, with replicas automatically syncing from a master. Redis Sentinel provides automatic failover, while Redis Cluster enables horizontal scaling across multiple nodes. Configuration can be specified via command-line options or a configuration file. Command-line options override config file settings.

参数

--port _number_
Listen on specified port (default: 6379)
--bind _address_
Bind to specified IP address(es)
--daemonize _yes|no_
Run as daemon in background
--requirepass _password_
Require password for client connections
--dir _path_
Set working directory for data files
--dbfilename _file_
Set RDB snapshot filename
--appendonly _yes|no_
Enable append-only file persistence
--maxmemory _bytes_
Set maximum memory limit
--maxmemory-policy _policy_
Eviction policy when maxmemory reached
--loglevel _level_
Set log verbosity (debug, verbose, notice, warning)
--logfile _path_
Log to specified file
--replica-of _host_ _port_
Start as replica of specified master

FAQ

What is the redis-server command used for?

redis-server is the Redis server daemon, an in-memory data structure store supporting strings, lists, sets, sorted sets, hashes, streams, and more. It provides high-performance key-value storage with optional persistence. Redis supports two persistence modes: RDB snapshots (point-in-time snapshots at intervals) and AOF (append-only file logging every write). Both can be enabled simultaneously for maximum durability. The server supports replication for high availability, with replicas automatically syncing from a master. Redis Sentinel provides automatic failover, while Redis Cluster enables horizontal scaling across multiple nodes. Configuration can be specified via command-line options or a configuration file. Command-line options override config file settings.

How do I run a basic redis-server example?

Run `redis-server` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --port _number_ do in redis-server?

Listen on specified port (default: 6379)