安装配置
启动服务
客户端启动
对数据的操作
Redis 哈希(Hash)
Redis hash 是一个string类型的field和value的映射表,hash特别适合用于存储对象。
Redis 列表(List)
Redis列表是简单的字符串列表,按照插入顺序排序。你可以添加一个元素到列表的头部(左边)或者尾部(右边)
Redis的set集合
sadd添加元素
smembers 查看元素成员
sdiff查看两个集合差集
sinter 查看两个交集
sunion查看两个集合并集
Redis HyperLogLog 命令
pfadd添加元素
PFCOUNT 计算基数
PFGERGE 将多个 HyperLoglog合并为一个
订阅
发布
获取配置
CONFIG GET *
- “dbfilename”
- “dump.rdb”
- “requirepass”
- “xxxxx1129”
- “masterauth”
- “”
- “cluster-announce-ip”
- “”
- “unixsocket”
- “”
- “logfile”
- “”
- “pidfile”
- “/var/run/redis_6379.pid”
- “slave-announce-ip”
- “”
- “maxmemory”
- “0”
- “proto-max-bulk-len”
- “536870912”
- “client-query-buffer-limit”
- “1073741824”
- “maxmemory-samples”
- “5”
- “lfu-log-factor”
- “10”
- “lfu-decay-time”
- “1”
- “timeout”
- “0”
- “active-defrag-threshold-lower”
- “10”
- “active-defrag-threshold-upper”
- “100”
- “active-defrag-ignore-bytes”
- “104857600”
- “active-defrag-cycle-min”
- “25”
- “active-defrag-cycle-max”
- “75”
- “auto-aof-rewrite-percentage”
- “100”
- “auto-aof-rewrite-min-size”
- “67108864”
- “hash-max-ziplist-entries”
- “512”
- “hash-max-ziplist-value”
- “64”
- “list-max-ziplist-size”
- “-2”
- “list-compress-depth”
- “0”
- “set-max-intset-entries”
- “512”
- “zset-max-ziplist-entries”
- “128”
- “zset-max-ziplist-value”
- “64”
- “hll-sparse-max-bytes”
- “3000”
- “lua-time-limit”
- “5000”
- “slowlog-log-slower-than”
- “10000”
- “latency-monitor-threshold”
- “0”
- “slowlog-max-len”
- “128”
- “port”
- “6379”
- “cluster-announce-port”
- “0”
- “cluster-announce-bus-port”
- “0”
- “tcp-backlog”
- “511”
- “databases”
- “16”
- “repl-ping-slave-period”
- “10”
- “repl-timeout”
- “60”
- “repl-backlog-size”
- “1048576”
- “repl-backlog-ttl”
- “3600”
- “maxclients”
- “10000”
- “watchdog-period”
- “0”
- “slave-priority”
- “100”
- “slave-announce-port”
- “0”
- “min-slaves-to-write”
- “0”
- “min-slaves-max-lag”
- “10”
- “hz”
- “10”
- “cluster-node-timeout”
- “15000”
- “cluster-migration-barrier”
- “1”
- “cluster-slave-validity-factor”
- “10”
- “repl-diskless-sync-delay”
- “5”
- “tcp-keepalive”
- “300”
- “cluster-require-full-coverage”
- “yes”
- “cluster-slave-no-failover”
- “no”
- “no-appendfsync-on-rewrite”
- “no”
- “slave-serve-stale-data”
- “yes”
- “slave-read-only”
- “yes”
- “stop-writes-on-bgsave-error”
- “yes”
- “daemonize”
- “yes”
- “rdbcompression”
- “yes”
- “rdbchecksum”
- “yes”
- “activerehashing”
- “yes”
- “activedefrag”
- “no”
- “protected-mode”
- “no”
- “repl-disable-tcp-nodelay”
- “no”
- “repl-diskless-sync”
- “no”
- “aof-rewrite-incremental-fsync”
- “yes”
- “aof-load-truncated”
- “yes”
- “aof-use-rdb-preamble”
- “no”
- “lazyfree-lazy-eviction”
- “no”
- “lazyfree-lazy-expire”
- “no”
- “lazyfree-lazy-server-del”
- “no”
- “slave-lazy-flush”
- “no”
- “maxmemory-policy”
- “noeviction”
- “loglevel”
- “notice”
- “supervised”
- “no”
- “appendfsync”
- “everysec”
- “syslog-facility”
- “local0”
- “appendonly”
- “no”
- “dir”
- “/”
- “save”
- “900 1 300 10 60 10000”
- “client-output-buffer-limit”
- “normal 0 0 0 slave 268435456 67108864 60 pubsub 33554432 8388608 60”
- “unixsocketperm”
- “0”
- “slaveof”
- “”
- “notify-keyspace-events”
- “”
- “bind”
基本命令
官网说明: https://redis.io/commands