5993:C 14 Apr 2023 17:02:21.419 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 5993:C 14 Apr 2023 17:02:21.419 # Redis version=6.2.6, bits=64, commit=00000000, modified=0, pid=5993, just started 5993:C 14 Apr 2023 17:02:21.419 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf 5993:M 14 Apr 2023 17:02:21.420 * Increased maximum number of open files to 10032 (it was originally set to 1024). 5993:M 14 Apr 2023 17:02:21.420 * monotonic clock: POSIX clock_gettime _._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis 6.2.6 (00000000/0) 64 bit .-`` .-```. ```\/ _.,_ ''-._ ( ' , .-` | `, ) Running in standalone mode |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 | `-._ `._ / _.-' | PID: 5993 `-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | https://redis.io `-._ `-._`-.__.-'_.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | `-._ `-._`-.__.-'_.-' _.-' `-._ `-.__.-' _.-' `-._ _.-' `-.__.-'
5993:M 14 Apr 2023 17:02:21.421 # Server initialized 5993:M 14 Apr 2023 17:02:21.421 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect. 5993:M 14 Apr 2023 17:02:21.421 * Ready to accept connections
127.0.0.1:6379> help redis-cli 6.2.6 To get help about Redis commands type: "help @<group>" to get a list of commands in <group> "help <command>" for help on <command> "help <tab>" to get a list of possible help topics "quit" to exit
To set redis-cli preferences: ":set hints" enable online hints ":set nohints" disable online hints Set your preferences in ~/.redisclirc 127.0.0.1:6379> help @string
APPEND key value summary: Append a value to a key since: 2.0.0
# incr让一个整数类型的key自增1 127.0.0.1:6379> incr age (integer) 19 127.0.0.1:6379> get age "19" 127.0.0.1:6379> incr age (integer) 20 127.0.0.1:6379> incr age (integer) 21 127.0.0.1:6379> incr age (integer) 22
# 让一个整数类型的key自增并设定步长为3 127.0.0.1:6379> incrby age 3 (integer) 25 127.0.0.1:6379> incrby age 3 (integer) 28 127.0.0.1:6379> incrby age 3 (integer) 31