Edit: Note that config file parameters which have spaces in them will not work as a command line parameter. For example, --save "600 1 30 10 6 100"
will not be used. Running redis-cli
followed by config get save
will show ""
. Doesn't matter if the parameter is placed at the end of the command line. Doesn't matter if it is enclosed with single quotes, double quotes, or no quotes.
redis-server
command line does not parse params with spaces correctly. The issue is known and closed without being resolved:
https://github.com/redis/redis/issues/2366
The most useful information about configuring redis-server
is at https://redis.io/docs/manual/config/
Passing arguments via the command line
You can also pass Redis configuration parameters using the command line directly. This is very useful for testing purposes. The following is an example that starts a new Redis instance using port 6380 as a replica of the instance running at 127.0.0.1 port 6379.
./redis-server --port 6380 --replicaof 127.0.0.1 6379
The format of the arguments passed via the command line is exactly the same as the one used in the redis.conf file, with the exception that the keyword is prefixed with --.
Note that internally this generates an in-memory temporary config file (possibly concatenating the config file passed by the user, if any) where arguments are translated into the format of redis.conf.
The .conf
file with all the params has reasonably useful inline docs.
man redis-server
and redis-server -h
are basically useless.
man redis-server
:
REDIS-SERVER(1) General Commands Manual REDIS-SERVER(1)
NAME
redis-server - Persistent key-value database
SYNOPSIS
redis-server configfile
DESCRIPTION
Redis is a key-value database. It is similar to memcached but the dataset is not volatile and other
datatypes (such as lists and sets) are natively supported.
OPTIONS
configfile
Read options from specified configuration file.
NOTES
On Debian GNU/Linux systems, redis-server is typically started via the /etc/init.d/redis-server initscript,
not manually. This defaults to using /etc/redis/redis.conf as a configuration file.
AUTHOR
redis-server was written by Salvatore Sanfilippo.
This manual page was written by Chris Lamb <[email protected]> for the Debian project (but may be used by
others).
March 20, 2009 REDIS-SERVER(1)
`redis-server -h`:
Usage: ./redis-server [/path/to/redis.conf] [options] [-]
./redis-server - (read config from stdin)
./redis-server -v or --version
./redis-server -h or --help
./redis-server --test-memory <megabytes>
./redis-server --check-system
Examples:
./redis-server (run the server with default conf)
echo 'maxmemory 128mb' | ./redis-server -
./redis-server /etc/redis/6379.conf
./redis-server --port 7777
./redis-server --port 7777 --replicaof 127.0.0.1 8888
./redis-server /etc/myredis.conf --loglevel verbose -
./redis-server /etc/myredis.conf --loglevel verbose
Sentinel mode:
./redis-server /etc/sentinel.conf --sentinel
Also, if someone knows how to tuck the man and -h snippets of this answer into <details>
with SO markup, please edit this response, thanks.