SENDMAIL-General Commands Manual

1
2
NAME
- sendmail - Postfix to Sendmail compatibility interface

SYNOPSIS

1
2
3
4
5
6
7
sendmail [option ...] [recipient ...]

mailq
sendmail -bp

newaliases
sendmail -I

DESCRIPTION

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
The Postfix sendmail(1) command implements the Postfix to Sendmail com‐
patibility interface. For the sake of compatibility with existing
applications, some Sendmail command-line options are recognized but
silently ignored.

By default, Postfix sendmail(1) reads a message from standard input
until EOF or until it reads a line with only a . character, and
arranges for delivery. Postfix sendmail(1) relies on the postdrop(1)
command to create a queue file in the maildrop directory.

Specific command aliases are provided for other common modes of opera‐
tion:

mailq List the mail queue. Each entry shows the queue file ID, message
size, arrival time, sender, and the recipients that still need
to be delivered. If mail could not be delivered upon the last
attempt, the reason for failure is shown. The queue ID string is
followed by an optional status character:

* The message is in the active queue, i.e. the message is
selected for delivery.

! The message is in the hold queue, i.e. no further deliv‐
ery attempt will be made until the mail is taken off
hold.

This mode of operation is implemented by executing the
postqueue(1) command.

newaliases
Initialize the alias database. If no input file is specified
(with the -oA option, see below), the program processes the
file(s) specified with the alias_database configuration parame‐
ter. If no alias database type is specified, the program uses
the type specified with the default_database_type configuration
parameter. This mode of operation is implemented by running the
postalias(1) command.

Note: it may take a minute or so before an alias database update
becomes visible. Use the "postfix reload" command to eliminate
this delay.

These and other features can be selected by specifying the appropriate
combination of command-line options. Some features are controlled by
parameters in the main.cf configuration file.

The following options are recognized:

-Am (ignored)

-Ac (ignored)
Postfix sendmail uses the same configuration file regardless of
whether or not a message is an initial submission.

-B body_type
The message body MIME type: 7BIT or 8BITMIME.

-bd Go into daemon mode. This mode of operation is implemented by
executing the "postfix start" command.

-bh (ignored)

-bH (ignored)
Postfix has no persistent host status database.

-bi Initialize alias database. See the newaliases command above.

-bl Go into daemon mode. To accept only local connections as with
Sendmail´s -bl option, specify "inet_interfaces = loopback" in
the Postfix main.cf configuration file.

-bm Read mail from standard input and arrange for delivery. This is
the default mode of operation.

-bp List the mail queue. See the mailq command above.

-bs Stand-alone SMTP server mode. Read SMTP commands from standard
input, and write responses to standard output. In stand-alone
SMTP server mode, mail relaying and other access controls are
disabled by default. To enable them, run the process as the
mail_owner user.

This mode of operation is implemented by running the smtpd(8)
daemon.

-bv Do not collect or deliver a message. Instead, send an email
report after verifying each recipient address. This is useful
for testing address rewriting and routing configurations.

This feature is available in Postfix version 2.1 and later.

-C config_file

-C config_dir
The path name of the Postfix main.cf file, or of its parent
directory. This information is ignored with Postfix versions
before 2.3.

With Postfix version 3.2 and later, a non-default directory must
be authorized in the default main.cf file, through the alter‐
nate_config_directories or multi_instance_directories parame‐
ters.

With all Postfix versions, you can specify a directory pathname
with the MAIL_CONFIG environment variable to override the loca‐
tion of configuration files.

-F full_name
Set the sender full name. This overrides the NAME environment
variable, and is used only with messages that have no From: mes‐
sage header.

-f sender
Set the envelope sender address. This is the address where
delivery problems are sent to. With Postfix versions before 2.1,
the Errors-To: message header overrides the error return
address.

-G Gateway (relay) submission, as opposed to initial user submis‐
sion. Either do not rewrite addresses at all, or update incom‐
plete addresses with the domain information specified with
remote_header_rewrite_domain.

This option is ignored before Postfix version 2.3.

-h hop_count (ignored)
Hop count limit. Use the hopcount_limit configuration parameter
instead.

-I Initialize alias database. See the newaliases command above.

-i When reading a message from standard input, don´t treat a line
with only a . character as the end of input.

-L label (ignored)
The logging label. Use the syslog_name configuration parameter
instead.

-m (ignored)
Backwards compatibility.

-N dsn (default: 'delay, failure')
Delivery status notification control. Specify either a
comma-separated list with one or more of failure (send notifica‐
tion when delivery fails), delay (send notification when deliv‐
ery is delayed), or success (send notification when the message
is delivered); or specify never (don't send any notifications at
all).

This feature is available in Postfix 2.3 and later.

-n (ignored)
Backwards compatibility.

-oAalias_database
Non-default alias database. Specify pathname or type:pathname.
See postalias(1) for details.

-O option=value (ignored)
Set the named option to value. Use the equivalent configuration
parameter in main.cf instead.

-o7 (ignored)

-o8 (ignored)
To send 8-bit or binary content, use an appropriate MIME encap‐
sulation and specify the appropriate -B command-line option.

-oi When reading a message from standard input, don´t treat a line
with only a . character as the end of input.

-om (ignored)
The sender is never eliminated from alias etc. expansions.

-o x value (ignored)
Set option x to value. Use the equivalent configuration parame‐
ter in main.cf instead.

-r sender
Set the envelope sender address. This is the address where
delivery problems are sent to. With Postfix versions before 2.1,
the Errors-To: message header overrides the error return
address.

-R return
Delivery status notification control. Specify "hdrs" to return
only the header when a message bounces, "full" to return a full
copy (the default behavior).

The -R option specifies an upper bound; Postfix will return only
the header, when a full copy would exceed the bounce_size_limit
setting.

This option is ignored before Postfix version 2.10.

-q Attempt to deliver all queued mail. This is implemented by exe‐
cuting the postqueue(1) command.

Warning: flushing undeliverable mail frequently will result in
poor delivery performance of all other mail.

-qinterval (ignored)
The interval between queue runs. Use the queue_run_delay config‐
uration parameter instead.

-qIqueueid
Schedule immediate delivery of mail with the specified queue ID.
This option is implemented by executing the postqueue(1) com‐
mand, and is available with Postfix version 2.4 and later.

-qRsite
Schedule immediate delivery of all mail that is queued for the
named site. This option accepts only site names that are eligi‐
ble for the "fast flush" service, and is implemented by execut‐
ing the postqueue(1) command. See flush(8) for more information
about the "fast flush" service.

-qSsite
This command is not implemented. Use the slower "sendmail -q"
command instead.

-t Extract recipients from message headers. These are added to any
recipients specified on the command line.

With Postfix versions prior to 2.1, this option requires that no
recipient addresses are specified on the command line.

-U (ignored)
Initial user submission.

-V envid
Specify the envelope ID for notification by servers that support
DSN.

This feature is available in Postfix 2.3 and later.

-XV (Postfix 2.2 and earlier: -V)
Variable Envelope Return Path. Given an envelope sender address
of the form owner-listname@origin, each recipient user@domain
receives mail with a personalized envelope sender address.

By default, the personalized envelope sender address is
owner-listname+user=domain@origin. The default + and = charac‐
ters are configurable with the default_verp_delimiters configu‐
ration parameter.

-XVxy (Postfix 2.2 and earlier: -Vxy)
As -XV, but uses x and y as the VERP delimiter characters,
instead of the characters specified with the default_verp_delim‐
iters configuration parameter.

-v Send an email report of the first delivery attempt (Postfix ver‐
sions 2.1 and later). Mail delivery always happens in the back‐
ground. When multiple -v options are given, enable verbose log‐
ging for debugging purposes.

-X log_file (ignored)
Log mailer traffic. Use the debug_peer_list and debug_peer_level
configuration parameters instead.

SECURITY

1
2
3
By design, this program is not set-user (or group) id. However, it must
handle data from untrusted, possibly remote, users. Thus, the usual
precautions need to be taken against malicious inputs.

DIAGNOSTICS

1
Problems are logged to syslogd(8) and to the standard error stream.

ENVIRONMENT

1
2
3
4
5
6
7
8
9
10
11
12
MAIL_CONFIG
Directory with Postfix configuration files.

MAIL_VERBOSE (value does not matter)
Enable verbose logging for debugging purposes.

MAIL_DEBUG (value does not matter)
Enable debugging with an external command, as specified with the
debugger_command configuration parameter.

NAME The sender full name. This is used only with messages that have
no From: message header. See also the -F option above.

CONFIGURATION PARAMETERS

1
2
3
The  following  main.cf parameters are especially relevant to this pro‐
gram. The text below provides only a parameter summary. See post‐
conf(5) for more details including examples.

COMPATIBILITY CONTROLS

1
2
3
4
5
Available with Postfix 2.9 and later:

sendmail_fix_line_endings (always)
Controls how the Postfix sendmail command converts email message
line endings from <CR><LF> into UNIX format (<LF>).

TROUBLE SHOOTING CONTROLS

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
The DEBUG_README file gives examples of how to trouble shoot a  Postfix
system.

debugger_command (empty)
The external command to execute when a Postfix daemon program is
invoked with the -D option.

debug_peer_level (2)
The increment in verbose logging level when a remote client or
server matches a pattern in the debug_peer_list parameter.

debug_peer_list (empty)
Optional list of remote client or server hostname or network
address patterns that cause the verbose logging level to
increase by the amount specified in $debug_peer_level.

ACCESS CONTROLS

1
2
3
4
5
6
7
8
9
10
11
12
Available in Postfix version 2.2 and later:

authorized_flush_users (static:anyone)
List of users who are authorized to flush the queue.

authorized_mailq_users (static:anyone)
List of users who are authorized to view the queue.

authorized_submit_users (static:anyone)
List of users who are authorized to submit mail with the send‐
mail(1) command (and with the privileged postdrop(1) helper com‐
mand).

RESOURCE AND RATE CONTROLS

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
bounce_size_limit (50000)
The maximal amount of original message text that is sent in a
non-delivery notification.

fork_attempts (5)
The maximal number of attempts to fork() a child process.

fork_delay (1s)
The delay between attempts to fork() a child process.

hopcount_limit (50)
The maximal number of Received: message headers that is allowed
in the primary message headers.

queue_run_delay (300s)
The time between deferred queue scans by the queue manager;
prior to Postfix 2.4 the default value was 1000s.

FAST FLUSH CONTROLS

1
2
3
4
5
6
The ETRN_README file describes configuration and operation details  for
the Postfix "fast flush" service.

fast_flush_domains ($relay_domains)
Optional list of destinations that are eligible for per-destina‐
tion logfiles with mail that is queued to those destinations.

VERP CONTROLS

1
2
3
4
5
6
7
8
9
The VERP_README file describes configuration and operation  details  of
Postfix support for variable envelope return path addresses.

default_verp_delimiters (+=)
The two default VERP delimiter characters.

verp_delimiter_filter (-=+)
The characters Postfix accepts as VERP delimiter characters on
the Postfix sendmail(1) command line and in SMTP commands.

MISCELLANEOUS CONTROLS

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
alias_database (see 'postconf -d' output)
The alias databases for local(8) delivery that are updated with
"newaliases" or with "sendmail -bi".

command_directory (see 'postconf -d' output)
The location of all postfix administrative commands.

config_directory (see 'postconf -d' output)
The default location of the Postfix main.cf and master.cf con‐
figuration files.

daemon_directory (see 'postconf -d' output)
The directory with Postfix support programs and daemon programs.

default_database_type (see 'postconf -d' output)
The default database type for use in newaliases(1), postalias(1)
and postmap(1) commands.

delay_warning_time (0h)
The time after which the sender receives a copy of the message
headers of mail that is still queued.

import_environment (see 'postconf -d' output)
The list of environment parameters that a privileged Postfix
process will import from a non-Postfix parent process, or
name=value environment overrides.

mail_owner (postfix)
The UNIX system account that owns the Postfix queue and most
Postfix daemon processes.

queue_directory (see 'postconf -d' output)
The location of the Postfix top-level queue directory.

remote_header_rewrite_domain (empty)
Don't rewrite message headers from remote clients at all when
this parameter is empty; otherwise, rewrite message headers and
append the specified domain name to incomplete addresses.

syslog_facility (mail)
The syslog facility of Postfix logging.

syslog_name (see 'postconf -d' output)
A prefix that is prepended to the process name in syslog
records, so that, for example, "smtpd" becomes "prefix/smtpd".

Postfix 3.2 and later:

alternate_config_directories (empty)
A list of non-default Postfix configuration directories that may
be specified with "-c config_directory" on the command line (in
the case of sendmail(1), with the "-C" option), or via the
MAIL_CONFIG environment parameter.

multi_instance_directories (empty)
An optional list of non-default Postfix configuration directo‐
ries; these directories belong to additional Postfix instances
that share the Postfix executable files and documentation with
the default Postfix instance, and that are started, stopped,
etc., together with the default Postfix instance.

FILES

1
2
/var/spool/postfix, mail queue
/etc/postfix, configuration files

SEE ALSO

1
2
3
4
5
6
7
8
9
10
pickup(8), mail pickup daemon
qmgr(8), queue manager
smtpd(8), SMTP server
flush(8), fast flush service
postsuper(1), queue maintenance
postalias(1), create/update/query alias database
postdrop(1), mail posting utility
postfix(1), mail system control
postqueue(1), mail queue control
syslogd(8), system logging

README_FILES

1
2
3
4
5
Use  "postconf readme_directory" or "postconf html_directory" to locate
this information.
DEBUG_README, Postfix debugging howto
ETRN_README, Postfix ETRN howto
VERP_README, Postfix VERP howto

LICENSE

1
The Secure Mailer license must be distributed with this software.

AUTHOR(S)

1
2
3
4
5
6
7
8
9
Wietse Venema
IBM T.J. Watson Research
P.O. Box 704
Yorktown Heights, NY 10598, USA

Wietse Venema
Google, Inc.
111 8th Avenue
New York, NY 10011, USA

ps-man

1
2
NAME
- ps -- process status

SYNOPSIS

1
2
ps [-AaCcEefhjlMmrSTvwXx] [-O fmt | -o fmt] [-G gid[,gid...]] [-g grp[,grp...]] [-u uid[,uid...]] [-p pid[,pid...]] [-t tty[,tty...]] [-U user[,user...]]
ps [-L]

DESCRIPTION

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
The ps utility displays a header line, followed by lines containing information about all of your processes that have controlling terminals.
A different set of processes can be selected for display by using any combination of the -a, -G, -g, -p, -T, -t, -U, and -u options. If more than one of these options are given, then ps will select all processes which are matched by at least one of the given options.
For the processes which have been selected for display, ps will usually display one line per process. The -M option may result in multiple output lines (one line per thread) for some processes. By default all of these output lines are sorted first by controlling terminal, then by process ID. The -m, -r, and -v options will change the sort order. If more than one sorting option was given, then the selected processes will be sorted by the last sorting option which was specified.
For the processes which have been selected for display, the information to display is selected based on a set of keywords (see the -L, -O, and -o options). The default output format includes, for each process, the process‘ ID, controlling terminal, CPU time (including both user and system time), state, and associated command.
The options are as follows:
-A Display information about other users‘ processes, including those without controlling terminals.
-a Display information about other users‘ processes as well as your own. This will skip any processes which do not have a controlling terminal, unless the -x option is also specified.
-C Change the way the CPU percentage is calculated by using a ``raw‘‘ CPU calculation that ignores ``resident‘‘ time (this normally has no effect).
-c Change the ``command‘‘ column output to just contain the executable name, rather than the full command line.
-d Like -A, but excludes session leaders.
-E Display the environment as well. This does not reflect changes in the environment after process launch.
-e Identical to -A.
-f Display the uid, pid, parent pid, recent CPU usage, process start time, controlling tty, elapsed CPU usage, and the associated command. If the -u option is also used, display the user name rather then the numeric uid. When -o or -O is used to add to the display following -f, the command field is not truncated as severely as it is in other formats.
-G Display information about processes which are running with the specified real group IDs.
-g Display information about processes with the specified process group leaders.
-h Repeat the information header as often as necessary to guarantee one header per page of information.
-j Print information associated with the following keywords: user, pid, ppid, pgid, sess, jobc, state, tt, time, and command.
-L List the set of keywords available for the -O and -o options.
-l Display information associated with the following keywords: uid, pid, ppid, flags, cpu, pri, nice, vsz=SZ, rss, wchan, state=S, paddr=ADDR, tty, time, and command=CMD.
-M Print the threads corresponding to each task.
-m Sort by memory usage, instead of the combination of controlling terminal and process ID.
-O Add the information associated with the space or comma separated list of keywords specified, after the process ID, in the default information display. Keywords may be appended with an equals (`=‘) sign and a string. This causes the printed header to use the specified string instead of the standard header.
-o Display information associated with the space or comma separated list of keywords specified. Multiple keywords may also be given in the form of more than one -o option. Keywords may be appended with an equals (`=‘) sign and a string. This causes the printed header to use the specified string instead of the standard header. If all keywords have empty header texts, no header line is written.
-p Display information about processes which match the specified process IDs.
-r Sort by current CPU usage, instead of the combination of controlling terminal and process ID.
-S Change the way the process time is calculated by summing all exited children to their parent process.
-T Display information about processes attached to the device associated with the standard input.
-t Display information about processes attached to the specified terminal devices.
-U Display the processes belonging to the specified real user IDs.
-u Display the processes belonging to the specified usernames.
-v Display information associated with the following keywords: pid, state, time, sl, re, pagein, vsz, rss, lim, tsiz, %cpu, %mem, and command. The -v option implies the -m option.
-w Use 132 columns to display information, instead of the default which is your window size. If the -w option is specified more than once, ps will use as many columns as necessary without regard for your window size. When output is not to a terminal, an unlimited number of columns are always used.
-X When displaying processes matched by other options, skip any processes which do not have a controlling terminal.
-x When displaying processes matched by other options, include processes which do not have a controlling terminal. This is the opposite of the -X option. If both -X and -x are specified in the same command, then ps will use the one which was specified last.
A complete list of the available keywords is given below. Some of these keywords are further specified as follows:
%cpu The CPU utilization of the process; this is a decaying average over up to a minute of previous (real) time. Because the time base over which this is computed varies (some processes may be very young), it is possible for the sum of all %cpu fields to exceed 100%.
%mem The percentage of real memory used by this process.
flags The flags associated with the process as in the include file <sys/proc.h>:
P_ADVLOCK 0x00001 Process may hold a POSIX advisory lock
P_CONTROLT 0x00002 Has a controlling terminal
P_LP64 0x00004 Process is LP64
P_NOCLDSTOP 0x00008 No SIGCHLD when children stop
P_PPWAIT 0x00010 Parent is waiting for child to exec/exit
P_PROFIL 0x00020 Has started profiling
P_SELECT 0x00040 Selecting; wakeup/waiting danger
P_CONTINUED 0x00080 Process was stopped and continued
P_SUGID 0x00100 Had set id privileges since last exec
P_SYSTEM 0x00200 System proc: no sigs, stats or swapping
P_TIMEOUT 0x00400 Timing out during sleep
P_TRACED 0x00800 Debugged process being traced
P_WAITED 0x01000 Debugging process has waited for child
P_WEXIT 0x02000 Working on exiting
P_EXEC 0x04000 Process called exec
P_OWEUPC 0x08000 Owe process an addupc() call at next ast
P_WAITING 0x40000 Process has a wait() in progress
P_KDEBUG 0x80000 Kdebug tracing on for this process
lim The soft limit on memory used, specified via a call to setrlimit(2).
lstart The exact time the command started, using the `%c‘ format described in strftime(3).
nice The process scheduling increment (see setpriority(2)).
rss the real memory (resident set) size of the process (in 1024 byte units).
start The time the command started. If the command started less than 24 hours ago, the start time is displayed using the ``%l:ps.1p‘‘ format described in strftime(3). If the command started less than 7 days ago, the start time is displayed using the ``%a6.15p‘‘ format. Otherwise, the start time is displayed using the ``%e%b%y‘‘ format.
state The state is given by a sequence of characters, for example, ``RWNA‘‘. The first character indicates the run state of the process:
I Marks a process that is idle (sleeping for longer than about 20 seconds).
R Marks a runnable process.
S Marks a process that is sleeping for less than about 20 seconds.
T Marks a stopped process.
U Marks a process in uninterruptible wait.
Z Marks a dead process (a ``zombie‘‘).
Additional characters after these, if any, indicate additional state information:
+ The process is in the foreground process group of its control terminal.
< The process has raised CPU scheduling priority.
> The process has specified a soft limit on memory requirements and is currently exceeding that limit; such a process is (necessarily) not swapped.
A the process has asked for random page replacement (VA_ANOM, from vadvise(2), for example, lisp(1) in a garbage collect).
E The process is trying to exit.
L The process has pages locked in core (for example, for raw I/O).
N The process has reduced CPU scheduling priority (see setpriority(2)).
S The process has asked for FIFO page replacement (VA_SEQL, from vadvise(2), for example, a large image processing program using virtual memory to sequentially address voluminous data).
s The process is a session leader.
V The process is suspended during a vfork(2).
W The process is swapped out.
X The process is being traced or debugged.
tt An abbreviation for the pathname of the controlling terminal, if any. The abbreviation consists of the three letters following /dev/tty, or, for the console, ``con‘‘. This is followed by a `-‘ if the process can no longer reach that controlling terminal (i.e., it has been revoked).
wchan The event (an address in the system) on which a process waits. When printed numerically, the initial part of the address is trimmed off and the result is printed in hex, for example, 0x80324000 prints as 324000.
When printing using the command keyword, a process that has exited and has a parent that has not yet waited for the process (in other words, a zombie) is listed as ``<defunct>‘‘, and a process which is blocked while trying to exit is listed as ``<exiting>‘‘. If the arguments cannot be located (usually because it has not been set, as is the case of system processes and/or kernel threads) the command name is printed within square brackets. The process can change the arguments shown with setproctitle(3). Otherwise, ps makes an educated guess as to the file name and arguments given when the process was created by examining memory or the swap area. The method is inherently somewhat unreliable and in any event a process is entitled to destroy this information. The ucomm (accounting) keyword can, however, be depended on. If the arguments are unavailable or do not agree with the ucomm keyword, the value for the ucomm keyword is appended to the arguments in parentheses.

KEYWORDS

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
The following is a complete list of the available keywords and their meanings.  Several of them have aliases (keywords which are synonyms).
%cpu percentage CPU usage (alias pcpu)
%mem percentage memory usage (alias pmem)
acflag accounting flag (alias acflg)
args command and arguments
comm command
command command and arguments
cpu short-term CPU usage factor (for scheduling)
etime elapsed running time
flags the process flags, in hexadecimal (alias f)
gid processes group id (alias group)
inblk total blocks read (alias inblock)
jobc job control count
ktrace tracing flags
ktracep tracing vnode
lim memoryuse limit
logname login name of user who started the session
lstart time started
majflt total page faults
minflt total page reclaims
msgrcv total messages received (reads from pipes/sockets)
msgsnd total messages sent (writes on pipes/sockets)
nice nice value (alias ni)
nivcsw total involuntary context switches
nsigs total signals taken (alias nsignals)
nswap total swaps in/out
nvcsw total voluntary context switches
nwchan wait channel (as an address)
oublk total blocks written (alias oublock)
p_ru resource usage (valid only for zombie)
paddr swap address
pagein pageins (same as majflt)
pgid process group number
pid process ID
ppid parent process ID
pri scheduling priority
re core residency time (in seconds; 127 = infinity)
rgid real group ID
rss resident set size
ruid real user ID
ruser user name (from ruid)
sess session ID
sig pending signals (alias pending)
sigmask blocked signals (alias blocked)
sl sleep time (in seconds; 127 = infinity)
start time started
state symbolic process state (alias stat)
svgid saved gid from a setgid executable
svuid saved UID from a setuid executable
tdev control terminal device number
time accumulated CPU time, user + system (alias cputime)
tpgid control terminal process group ID
tsess control terminal session ID
tsiz text size (in Kbytes)
tt control terminal name (two letter abbreviation)
tty full name of control terminal
ucomm name to be used for accounting
uid effective user ID
upr scheduling priority on return from system call (alias usrpri)
user user name (from UID)
utime user CPU time (alias putime)
vsz virtual size in Kbytes (alias vsize)
wchan wait channel (as a symbolic name)
wq total number of workqueue threads
wqb number of blocked workqueue threads
wqr number of running workqueue threads
wql workqueue limit status (C = constrained thread limit, T = total thread limit)
xstat exit or stop status (valid only for stopped or zombie process)

ENVIRONMENT

1
2
The following environment variables affect the execution of ps:
COLUMNS If set, specifies the user‘s preferred output width in column positions. By default, ps attempts to automatically determine the terminal width.

FILES

1
2
3
4
/dev                 special files and device names
/var/run/dev.db /dev name database
/var/db/kvm_kernel.db
system namelist database

LEGACY DESCRIPTION

1
2
3
4
5
6
7
In legacy mode, ps functions as described above, with the following differences:
-e Display the environment as well. Same as -E.
-g Ignored for compatibility. Takes no argument.
-l Display information associated with the following keywords: uid, pid, ppid, cpu, pri, nice, vsz, rss, wchan, state, tt, time, and command.
-u Display information associated with the following keywords: user, pid, %cpu, %mem, vsz, rss, tt, state, start, time, and command. The -u option implies the -r option.
The biggest change is in the interpretation of the -u option, which now displays processes belonging to the specified username(s). Thus, "ps -aux" will fail (unless you want to know about user "x"). As a convenience, however, "ps aux" still works as it did in Tiger.
For more information about legacy mode, see compat(5).

SEE ALSO

1
kill(1), w(1), kvm(3), strftime(3), sysctl(8)

STANDARDS

1
The ps utility supports the Version 3 of the Single UNIX Specification (``SUSv3‘‘) standard.

HISTORY

1
The ps command appeared in Version 4 AT&T UNIX.

BUGS

1
2
Since ps cannot run faster than the system and is run as any other scheduled process, the information it displays can never be exact.
The ps utility does not correctly display argument lists containing multibyte characters.

crontab-man

SYNOPSIS

1
2
crontab [ -u user ] file
crontab [ -u user ] [ -i ] { -e | -l | -r }

DESCRIPTION

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
crontab  is  the  program used to install, deinstall or list the tables
used to drive the cron(8) daemon in Vixie Cron. Each user can have
their own crontab, and though these are files in
/var/spool/cron/crontabs, they are not intended to be edited directly.

If the /etc/cron.allow file exists, then you must be listed (one user
per line) therein in order to be allowed to use this command. If the
/etc/cron.allow file does not exist but the /etc/cron.deny file does
exist, then you must not be listed in the /etc/cron.deny file in order
to use this command.

If neither of these files exists, then depending on site-dependent con‐
figuration parameters, only the super user will be allowed to use this
command, or all users will be able to use this command.

If both files exist then /etc/cron.allow takes precedence. Which means
that /etc/cron.deny is not considered and your user must be listed in
/etc/cron.allow in order to be able to use the crontab.

Regardless of the existance of any of these files, the root administra‐
tive user is always allowed to setup a crontab. For standard Debian
systems, all users may use this command.

If the -u option is given, it specifies the name of the user whose
crontab is to be used (when listing) or modified (when editing). If
this option is not given, crontab examines "your" crontab, i.e., the
crontab of the person executing the command. Note that su(8) can con‐
fuse crontab and that if you are running inside of su(8) you should
always use the -u option for safety's sake.

The first form of this command is used to install a new crontab from
some named file or standard input if the pseudo-filename ``-'' is
given.

The -l option causes the current crontab to be displayed on standard
output. See the note under DEBIAN SPECIFIC below.

The -r option causes the current crontab to be removed.

The -e option is used to edit the current crontab using the editor
specified by the VISUAL or EDITOR environment variables. After you
exit from the editor, the modified crontab will be installed automati‐
cally. If neither of the environment variables is defined, then the
default editor /usr/bin/editor is used.

The -i option modifies the -r option to prompt the user for a 'y/Y'
response before actually removing the crontab.

DEBIAN SPECIFIC

1
2
3
4
5
6
7
8
9
10
11
12
13
The  "out-of-the-box"  behaviour for crontab -l is to display the three
line "DO NOT EDIT THIS FILE" header that is placed at the beginning of
the crontab when it is installed. The problem is that it makes the
sequence

crontab -l | crontab -

non-idempotent -- you keep adding copies of the header. This causes
pain to scripts that use sed to edit a crontab. Therefore, the default
behaviour of the -l option has been changed to not output such header.
You may obtain the original behaviour by setting the environment vari‐
able CRONTAB_NOHEADER to 'N', which will cause the crontab -l command
to emit the extraneous header.

SEE ALSO

1
crontab(5), cron(8)

FILES

1
2
3
4
5
6
7
8
9
10
11
/etc/cron.allow
/etc/cron.deny
/var/spool/cron/crontabs

There is one file for each user's crontab under the
/var/spool/cron/crontabs directory. Users are not allowed to edit the
files under that directory directly to ensure that only users allowed
by the system to run periodic tasks can add them, and only syntacti‐
cally correct crontabs will be written there. This is enforced by hav‐
ing the directory writable only by the crontab group and configuring
crontab command with the setgid bid set for that specific group.

STANDARDS

1
2
3
The  crontab command conforms to IEEE Std1003.2-1992 (``POSIX'').  This
new command syntax differs from previous versions of Vixie Cron, as
well as from the classic SVR3 syntax.

DIAGNOSTICS

1
2
3
4
5
6
A  fairly  informative  usage  message appears if you run it with a bad
command line.

cron requires that each entry in a crontab end in a newline character.
If the last entry in a crontab is missing the newline, cron will con‐
sider the crontab (at least partially) broken and refuse to install it.

AUTHOR

1
2
3
Paul Vixie <paul@vix.com> is the author of cron and original creator of
this manual page. This page has also been modified for Debian by Steve
Greenland, Javier Fernandez-Sanguino and Christian Kastner.

mysql允许远程访问操作

终端操作

  • 1、先在服务器中通过命令行方式登录mysql: mysql -uroot -p密码
  • 2、执行use mysql;
  • 3、执行grant all privileges on . to root@’%’ identified by ‘密码’;
  • 4、执行flush privileges;

数据库管理中心操作

在user表中将相应用户对应的host改为“%”​

nginx配置首页默认跳转路径

https指定路径跳转

1
rewrite ^/index.html(.*)$ 指定的跳转路径 permanent;

http跳转到https

1
2
3
4
5
6
7
server {
listen 80;
server_name localhost;
rewrite ^(.*)$ https://$host$1 permanent;
location / {
index index.html index.htm;
}

Help on class Redis in module redis.client

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
'''Help on class Redis in module redis.client:'''

class Redis(builtins.object)
Redis(
host='localhost', port=6379, db=0, password=None, socket_timeout=None,
socket_connect_timeout=None, socket_keepalive=None,
socket_keepalive_options=None, connection_pool=None,
unix_socket_path=None, encoding='utf-8', encoding_errors='strict',
charset=None, errors=None, decode_responses=False,
retry_on_timeout=False, ssl=False, ssl_keyfile=None, ssl_certfile=None,
ssl_cert_reqs='required', ssl_ca_certs=None, max_connections=None
)

'''
Implementation of the Redis protocol.

This abstract class provides a Python interface to all Redis commands
and an implementation of the Redis protocol.

Connection and Pipeline derive from this, implementing how
the commands are sent and received to the Redis server

Methods defined here:
'''
__contains__ = exists(self, *names)

__delitem__(self, name)

__getitem__(self, name)
'''Return the value at key ``name``, raises a KeyError if the key
doesn't exist.'''

__init__(self, host='localhost', port=6379, db=0, password=None, socket_timeout=None, socket_connect_timeout=None, socket_keepalive=None, socket_keepalive_options=None, connection_pool=None, unix_socket_path=None, encoding='utf-8', encoding_errors='strict', charset=None, errors=None, decode_responses=False, retry_on_timeout=False, ssl=False, ssl_keyfile=None, ssl_certfile=None, ssl_cert_reqs='required', ssl_ca_certs=None, max_connections=None)
'''Initialize self. See help(type(self)) for accurate signature.'''

__repr__(self)
'''Return repr(self).'''

__setitem__(self, name, value)

append(self, key, value)
'''
Appends the string ``value`` to the value at ``key``. If ``key``
doesn't already exist, create it with a value of ``value``.
Returns the new length of the value at ``key``.
'''

bgrewriteaof(self)
'''
Tell the Redis server to rewrite the AOF file from data in memory.
'''

bgsave(self)
'''
Tell the Redis server to save its data to disk. Unlike save(),
this method is asynchronous and returns immediately.
'''

bitcount(self, key, start=None, end=None)
'''
Returns the count of set bits in the value of ``key``. Optional
``start`` and ``end`` paramaters indicate which bytes to consider
'''

bitfield(self, key, default_overflow=None)
'''
Return a BitFieldOperation instance to conveniently construct one or
more bitfield operations on ``key``.
'''

bitop(self, operation, dest, *keys)
'''
Perform a bitwise operation using ``operation`` between ``keys`` and
store the result in ``dest``.
'''

bitpos(self, key, bit, start=None, end=None)
'''
Return the position of the first bit set to 1 or 0 in a string.
``start`` and ``end`` difines search range. The range is interpreted
as a range of bytes and not a range of bits, so start=0 and end=2
means to look at the first three bytes.
'''

blpop(self, keys, timeout=0)
'''
LPOP a value off of the first non-empty list
named in the ``keys`` list.

If none of the lists in ``keys`` has a value to LPOP, then block
for ``timeout`` seconds, or until a value gets pushed on to one
of the lists.

If timeout is 0, then block indefinitely.
'''

brpop(self, keys, timeout=0)
'''
RPOP a value off of the first non-empty list
named in the ``keys`` list.

If none of the lists in ``keys`` has a value to RPOP, then block
for ``timeout`` seconds, or until a value gets pushed on to one
of the lists.

If timeout is 0, then block indefinitely.
'''

brpoplpush(self, src, dst, timeout=0)
'''
Pop a value off the tail of ``src``, push it on the head of ``dst``
and then return it.

This command blocks until a value is in ``src`` or until ``timeout``
seconds elapse, whichever is first. A ``timeout`` value of 0 blocks
forever.
'''

bzpopmax(self, keys, timeout=0)
'''
ZPOPMAX a value off of the first non-empty sorted set
named in the ``keys`` list.

If none of the sorted sets in ``keys`` has a value to ZPOPMAX,
then block for ``timeout`` seconds, or until a member gets added
to one of the sorted sets.

If timeout is 0, then block indefinitely.
'''

bzpopmin(self, keys, timeout=0)
'''
ZPOPMIN a value off of the first non-empty sorted set
named in the ``keys`` list.

If none of the sorted sets in ``keys`` has a value to ZPOPMIN,
then block for ``timeout`` seconds, or until a member gets added
to one of the sorted sets.

If timeout is 0, then block indefinitely.
'''

client_getname(self)
'''Returns the current connection name'''

client_id(self)
'''Returns the current connection id'''

client_kill(self, address)
'''Disconnects the client at ``address`` (ip:port)'''

client_kill_filter(self, _id=None, _type=None, addr=None, skipme=None)
'''
Disconnects client(s) using a variety of filter options
:param id: Kills a client by its unique ID field
:param type: Kills a client by type where type is one of 'normal',
'master', 'slave' or 'pubsub'
:param addr: Kills a client by its 'address:port'
:param skipme: If True, then the client calling the command
will not get killed even if it is identified by one of the filter
options. If skipme is not provided, the server defaults to skipme=True
'''

client_list(self, _type=None)
'''
Returns a list of currently connected clients.
If type of client specified, only that type will be returned.
:param _type: optional. one of the client types (normal, master,
replica, pubsub)
'''

client_pause(self, timeout)
'''
Suspend all the Redis clients for the specified amount of time
:param timeout: milliseconds to pause clients
'''

client_setname(self, name)
'''Sets the current connection name'''

client_unblock(self, client_id, error=False)
'''
Unblocks a connection by its client id.
If ``error`` is True, unblocks the client with a special error message.
If ``error`` is False (default), the client is unblocked using the
regular timeout mechanism.
'''

cluster(self, cluster_arg, *args)

config_get(self, pattern='*')
'''Return a dictionary of configuration based on the ``pattern``'''

config_resetstat(self)
'''Reset runtime statistics'''

config_rewrite(self)
'''Rewrite config file with the minimal change to reflect running config'''

config_set(self, name, value)
'''Set config item ``name`` with ``value``'''

dbsize(self)
'''Returns the number of keys in the current database'''

debug_object(self, key)
'''Returns version specific meta information about a given key'''

decr(self, name, amount=1)
'''
Decrements the value of ``key`` by ``amount``. If no key exists,
the value will be initialized as 0 - ``amount``
'''

decrby(self, name, amount=1)
'''
Decrements the value of ``key`` by ``amount``. If no key exists,
the value will be initialized as 0 - ``amount``
'''

delete(self, *names)
'''Delete one or more keys specified by ``names``'''

dump(self, name)
'''
Return a serialized version of the value stored at the specified key.
If key does not exist a nil bulk reply is returned.
'''

echo(self, value)
'''Echo the string back from the server'''

eval(self, script, numkeys, *keys_and_args)
'''
Execute the Lua ``script``, specifying the ``numkeys`` the script
will touch and the key names and argument values in ``keys_and_args``.
Returns the result of the script.

In practice, use the object returned by ``register_script``. This
function exists purely for Redis API completion.
'''

evalsha(self, sha, numkeys, *keys_and_args)
'''
Use the ``sha`` to execute a Lua script already registered via EVAL
or SCRIPT LOAD. Specify the ``numkeys`` the script will touch and the
key names and argument values in ``keys_and_args``. Returns the result
of the script.

In practice, use the object returned by ``register_script``. This
function exists purely for Redis API completion.
'''

execute_command(self, *args, **options)
'''Execute a command and return a parsed response'''

exists(self, *names)
''' Returns the number of ``names`` that exist'''

expire(self, name, time)
'''
Set an expire flag on key ``name`` for ``time`` seconds. ``time``
can be represented by an integer or a Python timedelta object.
'''

expireat(self, name, when)
'''
Set an expire flag on key ``name``. ``when`` can be represented
as an integer indicating unix time or a Python datetime object.
'''

flushall(self, asynchronous=False)
'''
Delete all keys in all databases on the current host.

``asynchronous`` indicates whether the operation is
executed asynchronously by the server.
'''

flushdb(self, asynchronous=False)
'''
Delete all keys in the current database.

``asynchronous`` indicates whether the operation is
executed asynchronously by the server.
'''

geoadd(self, name, *values)
'''
Add the specified geospatial items to the specified key identified
by the ``name`` argument. The Geospatial items are given as ordered
members of the ``values`` argument, each item or place is formed by
the triad longitude, latitude and name.
'''

geodist(self, name, place1, place2, unit=None)
'''
Return the distance between ``place1`` and ``place2`` members of the
``name`` key.
The units must be one of the following : m, km mi, ft. By default
meters are used.
'''

geohash(self, name, *values)
'''
Return the geo hash string for each item of ``values`` members of
the specified key identified by the ``name`` argument.
'''

geopos(self, name, *values)
'''
Return the positions of each item of ``values`` as members of
the specified key identified by the ``name`` argument. Each position
is represented by the pairs lon and lat.
'''

georadius(self, name, longitude, latitude, radius, unit=None, withdist=False, withcoord=False, withhash=False, count=None, sort=None, store=None, store_dist=None)
'''
Return the members of the specified key identified by the
``name`` argument which are within the borders of the area specified
with the ``latitude`` and ``longitude`` location and the maximum
distance from the center specified by the ``radius`` value.

The units must be one of the following : m, km mi, ft. By default

``withdist`` indicates to return the distances of each place.

``withcoord`` indicates to return the latitude and longitude of
each place.

``withhash`` indicates to return the geohash string of each place.

``count`` indicates to return the number of elements up to N.

``sort`` indicates to return the places in a sorted way, ASC for
nearest to fairest and DESC for fairest to nearest.

``store`` indicates to save the places names in a sorted set named
with a specific key, each element of the destination sorted set is
populated with the score got from the original geo sorted set.

``store_dist`` indicates to save the places names in a sorted set
named with a specific key, instead of ``store`` the sorted set
destination score is set with the distance.
'''

georadiusbymember(self, name, member, radius, unit=None, withdist=False, withcoord=False, withhash=False, count=None, sort=None, store=None, store_dist=None)
'''
This command is exactly like ``georadius`` with the sole difference
that instead of taking, as the center of the area to query, a longitude
and latitude value, it takes the name of a member already existing
inside the geospatial index represented by the sorted set.
'''

get(self, name)
'''Return the value at key ``name``, or None if the key doesn't exist'''

getbit(self, name, offset)
'''Returns a boolean indicating the value of ``offset`` in ``name``'''

getrange(self, key, start, end)
'''
Returns the substring of the string value stored at ``key``,
determined by the offsets ``start`` and ``end`` (both are inclusive)
'''

getset(self, name, value)
'''
Sets the value at key ``name`` to ``value``
and returns the old value at key ``name`` atomically.
'''

hdel(self, name, *keys)
'''Delete ``keys`` from hash ``name``'''

hexists(self, name, key)
'''Returns a boolean indicating if ``key`` exists within hash ``name``'''

hget(self, name, key)
'''Return the value of ``key`` within the hash ``name``'''

hgetall(self, name)
'''Return a Python dict of the hash's name/value pairs'''

hincrby(self, name, key, amount=1)
'''Increment the value of ``key`` in hash ``name`` by ``amount``'''

hincrbyfloat(self, name, key, amount=1.0)
'''Increment the value of ``key`` in hash ``name`` by floating ``amount``'''

hkeys(self, name)
'''Return the list of keys within hash ``name``'''

hlen(self, name)
'''Return the number of elements in hash ``name``'''

hmget(self, name, keys, *args)
'''Returns a list of values ordered identically to ``keys``'''

hmset(self, name, mapping)
'''
Set key to value within hash ``name`` for each corresponding
key and value from the ``mapping`` dict.
'''

hscan(self, name, cursor=0, match=None, count=None)
'''
Incrementally return key/value slices in a hash. Also return a cursor
indicating the scan position.

``match`` allows for filtering the keys by pattern

``count`` allows for hint the minimum number of returns
'''

hscan_iter(self, name, match=None, count=None)
'''
Make an iterator using the HSCAN command so that the client doesn't
need to remember the cursor position.

``match`` allows for filtering the keys by pattern

``count`` allows for hint the minimum number of returns
'''

hset(self, name, key, value)
'''
Set ``key`` to ``value`` within hash ``name``
Returns 1 if HSET created a new field, otherwise 0
'''

hsetnx(self, name, key, value)
'''
Set ``key`` to ``value`` within hash ``name`` if ``key`` does not
exist. Returns 1 if HSETNX created a field, otherwise 0.
'''

hstrlen(self, name, key)
'''
Return the number of bytes stored in the value of ``key``
within hash ``name``
'''

hvals(self, name)
'''Return the list of values within hash ``name``'''

incr(self, name, amount=1)
'''
Increments the value of ``key`` by ``amount``. If no key exists,
the value will be initialized as ``amount``
'''

incrby(self, name, amount=1)
'''
Increments the value of ``key`` by ``amount``. If no key exists,
the value will be initialized as ``amount``
'''

incrbyfloat(self, name, amount=1.0)
'''
Increments the value at key ``name`` by floating ``amount``.
If no key exists, the value will be initialized as ``amount``
'''

info(self, section=None)
'''
Returns a dictionary containing information about the Redis server

The ``section`` option can be used to select a specific section
of information

The section option is not supported by older versions of Redis Server,
and will generate ResponseError
'''

keys(self, pattern='*')
'''Returns a list of keys matching ``pattern``'''

lastsave(self)
'''
Return a Python datetime object representing the last time the
Redis database was saved to disk
'''

lindex(self, name, index)
'''
Return the item from list ``name`` at position ``index``

Negative indexes are supported and will return an item at the
end of the list
'''

linsert(self, name, where, refvalue, value)
'''
Insert ``value`` in list ``name`` either immediately before or after
[``where``] ``refvalue``

Returns the new length of the list on success or -1 if ``refvalue``
is not in the list.
'''

llen(self, name)
'''Return the length of the list ``name``'''

lock(self, name, timeout=None, sleep=0.1, blocking_timeout=None, lock_class=None, thread_local=True)
'''
Return a new Lock object using key ``name`` that mimics
the behavior of threading.Lock.

If specified, ``timeout`` indicates a maximum life for the lock.
By default, it will remain locked until release() is called.

``sleep`` indicates the amount of time to sleep per loop iteration
when the lock is in blocking mode and another client is currently
holding the lock.

``blocking_timeout`` indicates the maximum amount of time in seconds to
spend trying to acquire the lock. A value of ``None`` indicates
continue trying forever. ``blocking_timeout`` can be specified as a
float or integer, both representing the number of seconds to wait.

``lock_class`` forces the specified lock implementation.

``thread_local`` indicates whether the lock token is placed in
thread-local storage. By default, the token is placed in thread local
storage so that a thread only sees its token, not a token set by
another thread. Consider the following timeline:

time: 0, thread-1 acquires `my-lock`, with a timeout of 5 seconds.
thread-1 sets the token to "abc"
time: 1, thread-2 blocks trying to acquire `my-lock` using the
Lock instance.
time: 5, thread-1 has not yet completed. redis expires the lock
key.
time: 5, thread-2 acquired `my-lock` now that it's available.
thread-2 sets the token to "xyz"
time: 6, thread-1 finishes its work and calls release(). if the
token is *not* stored in thread local storage, then
thread-1 would see the token value as "xyz" and would be
able to successfully release the thread-2's lock.

In some use cases it's necessary to disable thread local storage. For
example, if you have code where one thread acquires a lock and passes
that lock instance to a worker thread to release later. If thread
local storage isn't disabled in this case, the worker thread won't see
the token set by the thread that acquired the lock. Our assumption
is that these cases aren't common and as such default to using
thread local storage.
'''

lpop(self, name)
'''Remove and return the first item of the list ``name``'''

lpush(self, name, *values)
'''Push ``values`` onto the head of the list ``name``'''

lpushx(self, name, value)
'''Push ``value`` onto the head of the list ``name`` if ``name`` exists'''

lrange(self, name, start, end)
'''
Return a slice of the list ``name`` between
position ``start`` and ``end``

``start`` and ``end`` can be negative numbers just like
Python slicing notation
'''

lrem(self, name, count, value)
'''
Remove the first ``count`` occurrences of elements equal to ``value``
from the list stored at ``name``.

The count argument influences the operation in the following ways:
count > 0: Remove elements equal to value moving from head to tail.
count < 0: Remove elements equal to value moving from tail to head.
count = 0: Remove all elements equal to value.
'''

lset(self, name, index, value)
'''Set ``position`` of list ``name`` to ``value``'''

ltrim(self, name, start, end)
'''
Trim the list ``name``, removing all values not within the slice
between ``start`` and ``end``

``start`` and ``end`` can be negative numbers just like
Python slicing notation
'''

memory_purge(self)
'''Attempts to purge dirty pages for reclamation by allocator'''

memory_usage(self, key, samples=None)
'''
Return the total memory usage for key, its value and associated
administrative overheads.

For nested data structures, ``samples`` is the number of elements to
sample. If left unspecified, the server's default is 5. Use 0 to sample
all elements.
'''

mget(self, keys, *args)
''' Returns a list of values ordered identically to ``keys``'''

migrate(self, host, port, keys, destination_db, timeout, copy=False, replace=False, auth=None)
'''
Migrate 1 or more keys from the current Redis server to a different
server specified by the ``host``, ``port`` and ``destination_db``.

The ``timeout``, specified in milliseconds, indicates the maximum
time the connection between the two servers can be idle before the
command is interrupted.

If ``copy`` is True, the specified ``keys`` are NOT deleted from
the source server.

If ``replace`` is True, this operation will overwrite the keys
on the destination server if they exist.

If ``auth`` is specified, authenticate to the destination server with
the password provided.
'''

move(self, name, db)
'''Moves the key ``name`` to a different Redis database ``db``'''

mset(self, mapping)
'''
Sets key/values based on a mapping. Mapping is a dictionary of
key/value pairs. Both keys and values should be strings or types that
can be cast to a string via str().
'''

msetnx(self, mapping)
'''
Sets key/values based on a mapping if none of the keys are already set.
Mapping is a dictionary of key/value pairs. Both keys and values
should be strings or types that can be cast to a string via str().
Returns a boolean indicating if the operation was successful.
'''

object(self, infotype, key)
'''Return the encoding, idletime, or refcount about the key'''

parse_response(self, connection, command_name, **options)
'''Parses a response from the Redis server'''

persist(self, name)
'''Removes an expiration on ``name``'''

pexpire(self, name, time)
'''
Set an expire flag on key ``name`` for ``time`` milliseconds.
``time`` can be represented by an integer or a Python timedelta
object.
'''

pexpireat(self, name, when)
'''
Set an expire flag on key ``name``. ``when`` can be represented
as an integer representing unix time in milliseconds (unix time * 1000)
or a Python datetime object.
'''

pfadd(self, name, *values)
'''Adds the specified elements to the specified HyperLogLog.'''

pfcount(self, *sources)
'''
Return the approximated cardinality of
the set observed by the HyperLogLog at key(s).
'''

pfmerge(self, dest, *sources)
'''Merge N different HyperLogLogs into a single one.'''

ping(self)
'''Ping the Redis server'''

pipeline(self, transaction=True, shard_hint=None)
'''
Return a new pipeline object that can queue multiple commands for
later execution. ``transaction`` indicates whether all commands
should be executed atomically. Apart from making a group of operations
atomic, pipelines are useful for reducing the back-and-forth overhead
between the client and server.
'''

psetex(self, name, time_ms, value)
'''
Set the value of key ``name`` to ``value`` that expires in ``time_ms``
milliseconds. ``time_ms`` can be represented by an integer or a Python
timedelta object
'''

pttl(self, name)
'''Returns the number of milliseconds until the key ``name`` will expire'''

publish(self, channel, message)
'''
Publish ``message`` on ``channel``.
Returns the number of subscribers the message was delivered to.
'''

pubsub(self, **kwargs)
'''
Return a Publish/Subscribe object. With this object, you can
subscribe to channels and listen for messages that get published to
them.
'''

pubsub_channels(self, pattern='*')
'''Return a list of channels that have at least one subscriber'''

pubsub_numpat(self)
'''Returns the number of subscriptions to patterns'''

pubsub_numsub(self, *args)
'''
Return a list of (channel, number of subscribers) tuples
for each channel given in ``*args``
'''

randomkey(self)
'''Returns the name of a random key'''

register_script(self, script)
'''
Register a Lua ``script`` specifying the ``keys`` it will touch.
Returns a Script object that is callable and hides the complexity of
deal with scripts, keys, and shas. This is the preferred way to work
with Lua scripts.
'''

rename(self, src, dst)
'''Rename key ``src`` to ``dst``'''

renamenx(self, src, dst)
'''Rename key ``src`` to ``dst`` if ``dst`` doesn't already exist'''

restore(self, name, ttl, value, replace=False)
'''
Create a key using the provided serialized value, previously obtained
using DUMP.
'''

rpop(self, name)
'''Remove and return the last item of the list ``name``'''

rpoplpush(self, src, dst)
'''
RPOP a value off of the ``src`` list and atomically LPUSH it
on to the ``dst`` list. Returns the value.
'''

rpush(self, name, *values)
'''Push ``values`` onto the tail of the list ``name``'''

rpushx(self, name, value)
'''Push ``value`` onto the tail of the list ``name`` if ``name`` exists'''

sadd(self, name, *values)
'''Add ``value(s)`` to set ``name``'''

save(self)
'''
Tell the Redis server to save its data to disk,
blocking until the save is complete
'''

scan(self, cursor=0, match=None, count=None)
'''
Incrementally return lists of key names. Also return a cursor
indicating the scan position.

``match`` allows for filtering the keys by pattern

``count`` allows for hint the minimum number of returns
'''

scan_iter(self, match=None, count=None)
'''
Make an iterator using the SCAN command so that the client doesn't
need to remember the cursor position.

``match`` allows for filtering the keys by pattern

``count`` allows for hint the minimum number of returns
'''
scard(self, name)
'''Return the number of elements in set ``name``'''

script_exists(self, *args)
'''
Check if a script exists in the script cache by specifying the SHAs of
each script as ``args``. Returns a list of boolean values indicating if
if each already script exists in the cache.
'''

script_flush(self)
'''Flush all scripts from the script cache'''

script_kill(self)
'''Kill the currently executing Lua script'''

script_load(self, script)
'''Load a Lua ``script`` into the script cache. Returns the SHA.'''

sdiff(self, keys, *args)
'''Return the difference of sets specified by ``keys``'''

sdiffstore(self, dest, keys, *args)
'''
Store the difference of sets specified by ``keys`` into a new
set named ``dest``. Returns the number of keys in the new set.
'''

sentinel(self, *args)
'''Redis Sentinel's SENTINEL command.'''

sentinel_get_master_addr_by_name(self, service_name)
'''Returns a (host, port) pair for the given ``service_name``'''

sentinel_master(self, service_name)
'''Returns a dictionary containing the specified masters state.'''

sentinel_masters(self)
'''Returns a list of dictionaries containing each master's state.'''

sentinel_monitor(self, name, ip, port, quorum)
'''Add a new master to Sentinel to be monitored'''

sentinel_remove(self, name)
'''Remove a master from Sentinel's monitoring'''

sentinel_sentinels(self, service_name)
'''Returns a list of sentinels for ``service_name``'''

sentinel_set(self, name, option, value)
'''Set Sentinel monitoring parameters for a given master'''

sentinel_slaves(self, service_name)
'''Returns a list of slaves for ``service_name``'''

set(self, name, value, ex=None, px=None, nx=False, xx=False)
'''
Set the value at key ``name`` to ``value``

``ex`` sets an expire flag on key ``name`` for ``ex`` seconds.

``px`` sets an expire flag on key ``name`` for ``px`` milliseconds.

``nx`` if set to True, set the value at key ``name`` to ``value`` only
if it does not exist.

``xx`` if set to True, set the value at key ``name`` to ``value`` only
if it already exists.
'''

set_response_callback(self, command, callback)
'''Set a custom Response Callback'''

setbit(self, name, offset, value)
'''
Flag the ``offset`` in ``name`` as ``value``. Returns a boolean
indicating the previous value of ``offset``.
'''

setex(self, name, time, value)
'''
Set the value of key ``name`` to ``value`` that expires in ``time``
seconds. ``time`` can be represented by an integer or a Python
timedelta object.
'''

setnx(self, name, value)
'''Set the value of key ``name`` to ``value`` if key doesn't exist'''

setrange(self, name, offset, value)
'''
Overwrite bytes in the value of ``name`` starting at ``offset`` with
``value``. If ``offset`` plus the length of ``value`` exceeds the
length of the original value, the new value will be larger than before.
If ``offset`` exceeds the length of the original value, null bytes
will be used to pad between the end of the previous value and the start
of what's being injected.

Returns the length of the new string.
'''

shutdown(self, save=False, nosave=False)
'''
Shutdown the Redis server. If Redis has persistence configured,
data will be flushed before shutdown. If the "save" option is set,
a data flush will be attempted even if there is no persistence
configured. If the "nosave" option is set, no data flush will be
attempted. The "save" and "nosave" options cannot both be set.
'''

sinter(self, keys, *args)
'''Return the intersection of sets specified by ``keys``'''

sinterstore(self, dest, keys, *args)
'''
Store the intersection of sets specified by ``keys`` into a new
set named ``dest``. Returns the number of keys in the new set.
'''

sismember(self, name, value)
'''Return a boolean indicating if ``value`` is a member of set ``name``'''

slaveof(self, host=None, port=None)
'''
Set the server to be a replicated slave of the instance identified
by the ``host`` and ``port``. If called without arguments, the
instance is promoted to a master instead.
'''

slowlog_get(self, num=None)
'''
Get the entries from the slowlog. If ``num`` is specified, get the
most recent ``num`` items.
'''

slowlog_len(self)
'''Get the number of items in the slowlog'''

slowlog_reset(self)
'''Remove all items in the slowlog'''

smembers(self, name)
'''Return all members of the set ``name``'''

smove(self, src, dst, value)
'''Move ``value`` from set ``src`` to set ``dst`` atomically'''

sort(self, name, start=None, num=None, by=None, get=None, desc=False, alpha=False, store=None, groups=False)
'''
Sort and return the list, set or sorted set at ``name``.

``start`` and ``num`` allow for paging through the sorted data

``by`` allows using an external key to weight and sort the items.
Use an "*" to indicate where in the key the item value is located

``get`` allows for returning items from external keys rather than the
sorted data itself. Use an "*" to indicate where int he key
the item value is located

``desc`` allows for reversing the sort

``alpha`` allows for sorting lexicographically rather than numerically

``store`` allows for storing the result of the sort into
the key ``store``

``groups`` if set to True and if ``get`` contains at least two
elements, sort will return a list of tuples, each containing the
values fetched from the arguments to ``get``.
'''

spop(self, name, count=None)
'''Remove and return a random member of set ``name``'''

srandmember(self, name, number=None)
'''
If ``number`` is None, returns a random member of set ``name``.

If ``number`` is supplied, returns a list of ``number`` random
memebers of set ``name``. Note this is only available when running
Redis 2.6+.
'''

srem(self, name, *values)
'''Remove ``values`` from set ``name``'''

sscan(self, name, cursor=0, match=None, count=None)
'''
Incrementally return lists of elements in a set. Also return a cursor
indicating the scan position.

``match`` allows for filtering the keys by pattern

``count`` allows for hint the minimum number of returns
'''

sscan_iter(self, name, match=None, count=None)
'''
Make an iterator using the SSCAN command so that the client doesn't
need to remember the cursor position.

``match`` allows for filtering the keys by pattern

``count`` allows for hint the minimum number of returns
'''

strlen(self, name)
'''Return the number of bytes stored in the value of ``name``'''

substr(self, name, start, end=-1)
'''
Return a substring of the string at key ``name``. ``start`` and ``end``
are 0-based integers specifying the portion of the string to return.
'''

sunion(self, keys, *args)
'''Return the union of sets specified by ``keys``'''

sunionstore(self, dest, keys, *args)
'''
Store the union of sets specified by ``keys`` into a new
set named ``dest``. Returns the number of keys in the new set.
'''

swapdb(self, first, second)
'''Swap two databases'''

time(self)
'''
Returns the server time as a 2-item tuple of ints:
(seconds since epoch, microseconds into this second).
'''

touch(self, *args)
'''
Alters the last access time of a key(s) ``*args``. A key is ignored
if it does not exist.
'''

transaction(self, func, *watches, **kwargs)
'''
Convenience method for executing the callable `func` as a transaction
while watching all keys specified in `watches`. The 'func' callable
should expect a single argument which is a Pipeline object.
'''

ttl(self, name)
'''Returns the number of seconds until the key ``name`` will expire'''

type(self, name)
'''Returns the type of key ``name``'''

unlink(self, *names)
'''Unlink one or more keys specified by ``names``'''

unwatch(self)
'''Unwatches the value at key ``name``, or None of the key doesn't exist'''

wait(self, num_replicas, timeout)
'''
Redis synchronous replication
That returns the number of replicas that processed the query when
we finally have at least ``num_replicas``, or when the ``timeout`` was
reached.
'''

watch(self, *names)
'''Watches the values at keys ``names``, or None if the key doesn't exist'''

xack(self, name, groupname, *ids)
'''
Acknowledges the successful processing of one or more messages.
name: name of the stream.
groupname: name of the consumer group.
*ids: message ids to acknowlege.
'''

xadd(self, name, fields, id='*', maxlen=None, approximate=True)
'''
Add to a stream.
name: name of the stream
fields: dict of field/value pairs to insert into the stream
id: Location to insert this record. By default it is appended.
maxlen: truncate old stream members beyond this size
approximate: actual stream length may be slightly more than maxlen
'''

xclaim(self, name, groupname, consumername, min_idle_time, message_ids, idle=None, time=None, retrycount=None, force=False, justid=False)
'''
Changes the ownership of a pending message.
name: name of the stream.
groupname: name of the consumer group.
consumername: name of a consumer that claims the message.
min_idle_time: filter messages that were idle less than this amount of
milliseconds
message_ids: non-empty list or tuple of message IDs to claim
idle: optional. Set the idle time (last time it was delivered) of the
message in ms
time: optional integer. This is the same as idle but instead of a
relative amount of milliseconds, it sets the idle time to a specific
Unix time (in milliseconds).
retrycount: optional integer. set the retry counter to the specified
value. This counter is incremented every time a message is delivered
again.
force: optional boolean, false by default. Creates the pending message
entry in the PEL even if certain specified IDs are not already in the
PEL assigned to a different client.
justid: optional boolean, false by default. Return just an array of IDs
of messages successfully claimed, without returning the actual message
'''

xdel(self, name, *ids)
'''
Deletes one or more messages from a stream.
name: name of the stream.
*ids: message ids to delete.
'''

xgroup_create(self, name, groupname, id='$', mkstream=False)
'''
Create a new consumer group associated with a stream.
name: name of the stream.
groupname: name of the consumer group.
id: ID of the last item in the stream to consider already delivered.
'''

xgroup_delconsumer(self, name, groupname, consumername)
'''
Remove a specific consumer from a consumer group.
Returns the number of pending messages that the consumer had before it
was deleted.
name: name of the stream.
groupname: name of the consumer group.
consumername: name of consumer to delete
'''

xgroup_destroy(self, name, groupname)
'''
Destroy a consumer group.
name: name of the stream.
groupname: name of the consumer group.
'''

xgroup_setid(self, name, groupname, id)
'''
Set the consumer group last delivered ID to something else.
name: name of the stream.
groupname: name of the consumer group.
id: ID of the last item in the stream to consider already delivered.
'''

xinfo_consumers(self, name, groupname)
'''
Returns general information about the consumers in the group.
name: name of the stream.
groupname: name of the consumer group.
'''

xinfo_groups(self, name)
'''
Returns general information about the consumer groups of the stream.
name: name of the stream.
'''

xinfo_stream(self, name)
'''
Returns general information about the stream.
name: name of the stream.
'''

xlen(self, name)
'''Returns the number of elements in a given stream.'''

xpending(self, name, groupname)
'''
Returns information about pending messages of a group.
name: name of the stream.
groupname: name of the consumer group.
'''

xpending_range(self, name, groupname, min, max, count, consumername=None)
'''
Returns information about pending messages, in a range.
name: name of the stream.
groupname: name of the consumer group.
min: minimum stream ID.
max: maximum stream ID.
count: number of messages to return
consumername: name of a consumer to filter by (optional).
'''

xrange(self, name, min='-', max='+', count=None)
'''
Read stream values within an interval.
name: name of the stream.
start: first stream ID. defaults to '-',
meaning the earliest available.
finish: last stream ID. defaults to '+',
meaning the latest available.
count: if set, only return this many items, beginning with the
earliest available.
'''

xread(self, streams, count=None, block=None)
'''
Block and monitor multiple streams for new data.
streams: a dict of stream names to stream IDs, where
IDs indicate the last ID already seen.
count: if set, only return this many items, beginning with the
earliest available.
block: number of milliseconds to wait, if nothing already present.
'''

xreadgroup(self, groupname, consumername, streams, count=None, block=None, noack=False)
'''
Read from a stream via a consumer group.
groupname: name of the consumer group.
consumername: name of the requesting consumer.
streams: a dict of stream names to stream IDs, where
IDs indicate the last ID already seen.
count: if set, only return this many items, beginning with the
earliest available.
block: number of milliseconds to wait, if nothing already present.
noack: do not add messages to the PEL
'''

xrevrange(self, name, max='+', min='-', count=None)
'''
Read stream values within an interval, in reverse order.
name: name of the stream
start: first stream ID. defaults to '+',
meaning the latest available.
finish: last stream ID. defaults to '-',
meaning the earliest available.
count: if set, only return this many items, beginning with the
latest available.
'''

xtrim(self, name, maxlen, approximate=True)
'''
Trims old messages from a stream.
name: name of the stream.
maxlen: truncate old stream messages beyond this size
approximate: actual stream length may be slightly more than maxlen
'''

zadd(self, name, mapping, nx=False, xx=False, ch=False, incr=False)
'''
Set any number of element-name, score pairs to the key ``name``. Pairs
are specified as a dict of element-names keys to score values.

mapping {'element-name':'score'}

``nx`` forces ZADD to only create new elements and not to update
scores for elements that already exist.

``xx`` forces ZADD to only update scores of elements that already
exist. New elements will not be added.

``ch`` modifies the return value to be the numbers of elements changed.
Changed elements include new elements that were added and elements
whose scores changed.

``incr`` modifies ZADD to behave like ZINCRBY. In this mode only a
single element/score pair can be specified and the score is the amount
the existing score will be incremented by. When using this mode the
return value of ZADD will be the new score of the element.

The return value of ZADD varies based on the mode specified. With no
options, ZADD returns the number of new elements added to the sorted
set.
'''

zcard(self, name)
'''Return the number of elements in the sorted set ``name``'''

zcount(self, name, min, max)
'''
Returns the number of elements in the sorted set at key ``name`` with
a score between ``min`` and ``max``.
'''

zincrby(self, name, amount, value)
'''Increment the score of ``value`` in sorted set ``name`` by ``amount``'''

zinterstore(self, dest, keys, aggregate=None)
'''
Intersect multiple sorted sets specified by ``keys`` into
a new sorted set, ``dest``. Scores in the destination will be
aggregated based on the ``aggregate``, or SUM if none is provided.
'''

zlexcount(self, name, min, max)
'''
Return the number of items in the sorted set ``name`` between the
lexicographical range ``min`` and ``max``.
'''

zpopmax(self, name, count=None)
'''
Remove and return up to ``count`` members with the highest scores
from the sorted set ``name``.
'''

zpopmin(self, name, count=None)
'''
Remove and return up to ``count`` members with the lowest scores
from the sorted set ``name``.
'''

zrange(self, name, start, end, desc=False, withscores=False, score_cast_func=<class 'float'>)
'''
Return a range of values from sorted set ``name`` between
``start`` and ``end`` sorted in ascending order.

``start`` and ``end`` can be negative, indicating the end of the range.

``desc`` a boolean indicating whether to sort the results descendingly

``withscores`` indicates to return the scores along with the values.
The return type is a list of (value, score) pairs

``score_cast_func`` a callable used to cast the score return value
'''

zrangebylex(self, name, min, max, start=None, num=None)
'''
Return the lexicographical range of values from sorted set ``name``
between ``min`` and ``max``.

If ``start`` and ``num`` are specified, then return a slice of the
range.
'''

zrangebyscore(self, name, min, max, start=None, num=None, withscores=False, score_cast_func=<class 'float'>)
'''
Return a range of values from the sorted set ``name`` with scores
between ``min`` and ``max``.

If ``start`` and ``num`` are specified, then return a slice
of the range.

``withscores`` indicates to return the scores along with the values.
The return type is a list of (value, score) pairs

`score_cast_func`` a callable used to cast the score return value
'''

zrank(self, name, value)
'''
Returns a 0-based value indicating the rank of ``value`` in sorted set
``name``
'''

zrem(self, name, *values)
'''Remove member ``values`` from sorted set ``name``'''

zremrangebylex(self, name, min, max)
'''
Remove all elements in the sorted set ``name`` between the
lexicographical range specified by ``min`` and ``max``.

Returns the number of elements removed.
'''

zremrangebyrank(self, name, min, max)
'''
Remove all elements in the sorted set ``name`` with ranks between
``min`` and ``max``. Values are 0-based, ordered from smallest score
to largest. Values can be negative indicating the highest scores.
Returns the number of elements removed
'''

zremrangebyscore(self, name, min, max)
'''
Remove all elements in the sorted set ``name`` with scores
between ``min`` and ``max``. Returns the number of elements removed.
'''

zrevrange(self, name, start, end, withscores=False, score_cast_func=<class 'float'>)
'''
Return a range of values from sorted set ``name`` between
``start`` and ``end`` sorted in descending order.

``start`` and ``end`` can be negative, indicating the end of the range.

``withscores`` indicates to return the scores along with the values
The return type is a list of (value, score) pairs

``score_cast_func`` a callable used to cast the score return value
'''

zrevrangebylex(self, name, max, min, start=None, num=None)
'''
Return the reversed lexicographical range of values from sorted set
``name`` between ``max`` and ``min``.

If ``start`` and ``num`` are specified, then return a slice of the
range.
'''

zrevrangebyscore(self, name, max, min, start=None, num=None, withscores=False, score_cast_func=<class 'float'>)
'''
Return a range of values from the sorted set ``name`` with scores
between ``min`` and ``max`` in descending order.

If ``start`` and ``num`` are specified, then return a slice
of the range.

``withscores`` indicates to return the scores along with the values.
The return type is a list of (value, score) pairs

``score_cast_func`` a callable used to cast the score return value
'''

zrevrank(self, name, value)
'''
Returns a 0-based value indicating the descending rank of
``value`` in sorted set ``name``
'''

zscan(self, name, cursor=0, match=None, count=None, score_cast_func=<class 'float'>)
'''
Incrementally return lists of elements in a sorted set. Also return a
cursor indicating the scan position.

``match`` allows for filtering the keys by pattern

``count`` allows for hint the minimum number of returns

``score_cast_func`` a callable used to cast the score return value
'''

zscan_iter(self, name, match=None, count=None, score_cast_func=<class 'float'>)
'''
Make an iterator using the ZSCAN command so that the client doesn't
need to remember the cursor position.

``match`` allows for filtering the keys by pattern

``count`` allows for hint the minimum number of returns

``score_cast_func`` a callable used to cast the score return value
'''

zscore(self, name, value)
'''Return the score of element ``value`` in sorted set ``name``'''

zunionstore(self, dest, keys, aggregate=None)
'''
Union multiple sorted sets specified by ``keys`` into
a new sorted set, ``dest``. Scores in the destination will be
aggregated based on the ``aggregate``, or SUM if none is provided.
'''

# ----------------------------------------------------------------------
'''Class methods defined here:'''

from_url(url, db=None, **kwargs) from builtins.type
'''
Return a Redis client object configured from the given URL

For example::

redis://[:password]@localhost:6379/0
rediss://[:password]@localhost:6379/0
unix://[:password]@/path/to/socket.sock?db=0

Three URL schemes are supported:

- ```redis://``
<http://www.iana.org/assignments/uri-schemes/prov/redis>`_ creates a
normal TCP socket connection
- ```rediss://``
<http://www.iana.org/assignments/uri-schemes/prov/rediss>`_ creates a
SSL wrapped TCP socket connection
- ``unix://`` creates a Unix Domain Socket connection

There are several ways to specify a database number. The parse function
will return the first specified option:
1. A ``db`` querystring option, e.g. redis://localhost?db=0
2. If using the redis:// scheme, the path argument of the url, e.g.
redis://localhost/0
3. The ``db`` argument to this function.

If none of these options are specified, db=0 is used.

Any additional querystring arguments and keyword arguments will be
passed along to the ConnectionPool class's initializer. In the case
of conflicting arguments, querystring arguments always win.
'''

# ----------------------------------------------------------------------
'''Data descriptors defined here:'''

__dict__
'''dictionary for instance variables (if defined)'''

__weakref__
'''list of weak references to the object (if defined)'''

# ----------------------------------------------------------------------
'''Data and other attributes defined here:'''

RESPONSE_CALLBACKS = {'AUTH': <class 'bool'>, 'BGREWRITEAOF': <functio...

最常考的数据结构与算法知识点

数 据 结 构 算 法 概 念
链表 广度(深度)优先搜索 位操作
数组 递归 设计模式
二叉树 二分查找 内存管理(堆、栈等)
排序(归并排序、快速排序等)
堆(大顶堆、小顶堆) 树的插入/删除/查找/遍历等
图论
队列 Hash 法
向量 分治法
Hash 表 动态规划