redis-server
Start the Redis server
TLDR
Start Redis server, using the default port (6379), and write logs to stdout
Start Redis server, using the default port, as a background process
Start Redis server, using the specified port, as a background process
Start Redis server with a custom configuration file
Start Redis server with verbose logging
SYNOPSIS
redis-server [config_file] [options]
PARAMETERS
config_file
Path to the Redis configuration file. If not specified, Redis will use default settings.
--help
Show help message and exit.
--version
Show version information and exit.
--test-memory
Perform a memory test before starting the server (only useful for development).
--port
Override the port number specified in the configuration file.
--bind
Override the bind address specified in the configuration file.
--protected-mode
Enable or disable protected mode.
--daemonize
Run the server in the background as a daemon process.
--loglevel
Specify the verbosity level. Possible values: debug, verbose, notice, warning.
--logfile
Specify a log file for the Redis server process.
DESCRIPTION
The redis-server
command is the primary way to start a Redis server instance. Redis is an in-memory data structure store, used as a database, cache and message broker. The redis-server
command reads a configuration file (typically redis.conf
) or command-line arguments to determine the server's behavior, including port number, persistence settings, security configurations, and other operational parameters.
Without any arguments, it will attempt to start Redis using the default configuration. If a configuration file is specified, the server will load the settings from that file, overriding the defaults. The server will then bind to the specified port and IP address, begin listening for client connections, and load any persisted data from disk if configured to do so. The command will run in the foreground and log output to the console unless specified to run as a daemon or logging is configured to write to a file.
CAVEATS
Incorrect configuration of redis-server
can lead to security vulnerabilities or data loss. Always review the configuration file carefully and understand the implications of each setting.
CONFIGURATION FILE
The redis.conf
file contains numerous configuration options that control the behavior of the Redis server. These include settings for persistence, replication, security, memory management, and more. Consult the Redis documentation for a complete list of options.
LOGGING
Redis provides different logging levels (debug, verbose, notice, warning) that can be configured using the loglevel
option. Choosing the appropriate logging level is crucial for monitoring the server's activity and troubleshooting issues.
PROTECTED MODE
Protected mode is a security feature that prevents unauthorized access to the Redis server.
It is enabled by default and should only be disabled if you understand the security implications and have properly configured authentication and network access controls.
HISTORY
Redis was created by Salvatore Sanfilippo in 2009. The redis-server
command has been the core component for running Redis instances since its inception. Over time, new features and configuration options have been added to support various use cases, improved performance, and enhanced security. Early versions were simpler, but Redis has evolved into a feature-rich and widely used data store.
SEE ALSO
redis-cli(1), redis-benchmark(1), redis-sentinel(1)