日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

【Redis】client客户端 工具 redis-cli

發布時間:2023/12/10 数据库 42 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【Redis】client客户端 工具 redis-cli 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

語法:redis-cli -h 192.168.20.33 -p 6379

如果是連接本機,并且采用默認的端口,可以直接用redis-cli

# pwd /root/test/redis-5.0.12/src # ./redis-cli 127.0.0.1:6379> //已經進入控制臺

可以輸入一些簡單的命令進行測試:

set foo 100 incr foo append foo xxx get foo

詳細解釋:

用法:redis-cli [OPTIONS] [cmd [arg [arg ...]]] -h <主機ip>,默認是127.0.0.1 -p <端口>,默認是6379 -a <密碼>,如果redis加鎖,需要傳遞密碼 --help,顯示幫助信息

想知道更多參數和用法,可以用help命令,help前面添加2個短橫線:

[root@localhost redis-5.0.12]# src/redis-cli --help Usage: redis-cli [OPTIONS] [cmd [arg [arg ...]]]-h <hostname> Server hostname (default: 127.0.0.1).-p <port> Server port (default: 6379).-s <socket> Server socket (overrides hostname and port).-a <password> Password to use when connecting to the server.You can also use the REDISCLI_AUTH environmentvariable to pass this password more safely(if both are used, this argument takes predecence).-u <uri> Server URI.-r <repeat> Execute specified command N times.-i <interval> When -r is used, waits <interval> seconds per command.It is possible to specify sub-second times like -i 0.1.-n <db> Database number.-x Read last argument from STDIN.-d <delimiter> Multi-bulk delimiter in for raw formatting (default: \n).-c Enable cluster mode (follow -ASK and -MOVED redirections).--raw Use raw formatting for replies (default when STDOUT isnot a tty).--no-raw Force formatted output even when STDOUT is not a tty.--csv Output in CSV format.--stat Print rolling stats about server: mem, clients, ...--latency Enter a special mode continuously sampling latency.If you use this mode in an interactive session it runsforever displaying real-time stats. Otherwise if --raw or--csv is specified, or if you redirect the output to a nonTTY, it samples the latency for 1 second (you can use-i to change the interval), then produces a single outputand exits.--latency-history Like --latency but tracking latency changes over time.Default time interval is 15 sec. Change it using -i.--latency-dist Shows latency as a spectrum, requires xterm 256 colors.Default time interval is 1 sec. Change it using -i.--lru-test <keys> Simulate a cache workload with an 80-20 distribution.--replica Simulate a replica showing commands received from the master.--rdb <filename> Transfer an RDB dump from remote server to local file.--pipe Transfer raw Redis protocol from stdin to server.--pipe-timeout <n> In --pipe mode, abort with error if after sending all data.no reply is received within <n> seconds.Default timeout: 30. Use 0 to wait forever.--bigkeys Sample Redis keys looking for keys with many elements (complexity).--memkeys Sample Redis keys looking for keys consuming a lot of memory.--memkeys-samples <n> Sample Redis keys looking for keys consuming a lot of memory.And define number of key elements to sample--hotkeys Sample Redis keys looking for hot keys.only works when maxmemory-policy is *lfu.--scan List all keys using the SCAN command.--pattern <pat> Useful with --scan to specify a SCAN pattern.--intrinsic-latency <sec> Run a test to measure intrinsic system latency.The test will run for the specified amount of seconds.--eval <file> Send an EVAL command using the Lua script at <file>.--ldb Used with --eval enable the Redis Lua debugger.--ldb-sync-mode Like --ldb but uses the synchronous Lua debugger, inthis mode the server is blocked and script changes arenot rolled back from the server memory.--cluster <command> [args...] [opts...]Cluster Manager command and arguments (see below).--verbose Verbose mode.--no-auth-warning Don't show warning message when using password on commandline interface.--help Output this help and exit.--version Output version and exit.Cluster Manager Commands:Use --cluster help to list all available cluster manager commands. '提示進一步查看--cluster的幫助信息'Examples:cat /etc/passwd | redis-cli -x set mypasswdredis-cli get mypasswdredis-cli -r 100 lpush mylist xredis-cli -r 100 -i 1 info | grep used_memory_human:redis-cli --eval myscript.lua key1 key2 , arg1 arg2 arg3redis-cli --scan --pattern '*:12345*'

進一步查看--cluster集群配置的幫助信息,這時省略help前面的2個短橫線即可:

[root@localhost redis-5.0.12]# src/redis-cli --cluster help Cluster Manager Commands:create host1:port1 ... hostN:portN--cluster-replicas <arg>check host:port--cluster-search-multiple-ownersinfo host:portfix host:port--cluster-search-multiple-ownersreshard host:port--cluster-from <arg>--cluster-to <arg>--cluster-slots <arg>--cluster-yes--cluster-timeout <arg>--cluster-pipeline <arg>--cluster-replacerebalance host:port--cluster-weight <node1=w1...nodeN=wN>--cluster-use-empty-masters--cluster-timeout <arg>--cluster-simulate--cluster-pipeline <arg>--cluster-threshold <arg>--cluster-replaceadd-node new_host:new_port existing_host:existing_port--cluster-slave--cluster-master-id <arg>del-node host:port node_idcall host:port command arg arg .. argset-timeout host:port millisecondsimport host:port--cluster-from <arg>--cluster-copy--cluster-replacehelp

參考:
《redis-cli,Redis命令行工具》

總結

以上是生活随笔為你收集整理的【Redis】client客户端 工具 redis-cli的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。