Docs for redis-server command line options
Asked Answered
H

2

23

I've looked "everywhere." I cannot find documentation for all the supported command line options for redis-server. I'm using version 5.0.3

I tried redis-server --help. It is no help.

The usage given doesn't even mention --port, --slaveof, --replicaof, --loglevel ... yet these options are shown in the help's examples.

Does someone know where I can find full and complete documentation for the server's command line?

Hydrokinetics answered 9/3, 2019 at 14:17 Comment(3)
Redis itself puts out a ton of documentation, see here.Anthologize
I've gone over that page countless times. My answer isn't there, however ...Hydrokinetics
It might help your question to ask about a specific feature of Redis, rather than asking for an entire manual.Anthologize
H
23

Right at the top of the redis configuration documents it says the following:

"... it is possible to ... pass Redis configuration parameters using the command line directly."

Therefore, every configuration file option is passable on the command line. I'm an idiot.

Hydrokinetics answered 9/3, 2019 at 14:35 Comment(4)
But you've learned a valuable lesson so don't be too harsh on yourself.Wina
And what happens if you pass both - a config file AND parameters, what's the precedence?Brinson
usually the command line is prioritized, I assume it is so this time as well, given redis skillful software architecture in general... but idkExostosis
No, you're not an idiot. The documentation is awful. The uickstart or Install section don't mention how to launch it.Magdaleno
P
2

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.

Praise answered 11/10, 2022 at 17:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.