linux的redis常用命令
linux的redis常用命令
Linux下redis为我们提供了丰富的命令。下面由学习啦小编为大家整理了linux下redis常用命令的相关知识,希望对大家有帮助!
linux的redis常用命令1、redis-benchmark
redis基准信息,redis服务器性能检测
redis-benchmark -h localhost -p 6379 -c 100 -n 100000
100个并发连接,100000个请求,检测host为localhost 端口为6379的redis服务器性能
[root@Architect redis-1.2.6]# redis-benchmark -h localhost -p 6379 -c 100 -n 100000
====== PING ======
10001 requests completed in 0.41 seconds
学习啦在线学习网 50 parallel clients
学习啦在线学习网 3 bytes payload
学习啦在线学习网 keep alive: 1
学习啦在线学习网 0.01% <= 0 milliseconds
学习啦在线学习网 23.09% <= 1 milliseconds
85.82% <= 2 milliseconds
95.60% <= 3 milliseconds
97.20% <= 4 milliseconds
97.96% <= 5 milliseconds
98.83% <= 6 milliseconds
学习啦在线学习网 99.41% <= 7 milliseconds
99.70% <= 8 milliseconds
学习啦在线学习网 99.99% <= 9 milliseconds
学习啦在线学习网 100.00% <= 12 milliseconds
24274.27 requests per second
linux的redis常用命令2、redis-cli
redis-cli -h localhost -p 6380 monitor
Dump all the received requests in real time;
学习啦在线学习网 监控host为localhost,端口为6380,redis的连接及读写操作
学习啦在线学习网 [root@Architect redis-1.2.6]# redis-cli -h localhost -p 6380 monitor
+OK
+1289800615.808225 "monitor"
+1289800615.839079 "GET" "name"
+1289800615.853694 "PING"
+1289800615.853783 "PING"
+1289800615.854646 "PING"
学习啦在线学习网 +1289800615.854974 "PING"
学习啦在线学习网 +1289800615.857693 "PING"
+1289800615.866862 "PING"
学习啦在线学习网 +1289800615.871944 "PING"
学习啦在线学习网 redis-cli -h localhost -p 6380 info
Provide information and statistics about the server ;
学习啦在线学习网 提供host为localhost,端口为6380,redis服务的统计信息
学习啦在线学习网 [root@Architect redis-1.2.6]# redis-cli -h localhost -p 6380 info
学习啦在线学习网 redis_version:2.0.4
redis_git_sha1:00000000r
edis_git_dirty:0
arch_bits:32
学习啦在线学习网 multiplexing_api:epoll
学习啦在线学习网 process_id:21990
uptime_in_seconds:490580
uptime_in_days:5
connected_clients:103
学习啦在线学习网 connected_slaves:0
blocked_clients:0
学习啦在线学习网 used_memory:4453240
used_memory_human:4.25M
学习啦在线学习网 changes_since_last_save:200
学习啦在线学习网 bgsave_in_progress:0
last_save_time:1290394640
学习啦在线学习网 bgrewriteaof_in_progress:0
total_connections_received:809
学习啦在线学习网 total_commands_processed:44094018
expired_keys:0
学习啦在线学习网 hash_max_zipmap_entries:64
学习啦在线学习网 hash_max_zipmap_value:512
学习啦在线学习网 pubsub_channels:0
pubsub_patterns:0
学习啦在线学习网 vm_enabled:0
role:slave
学习啦在线学习网 master_host:localhost
学习啦在线学习网 master_port:6379
master_link_status:up
学习啦在线学习网 master_last_io_seconds_ago:18
学习啦在线学习网 db0:keys=1319,expires=0
linux的redis常用命令3、redis-stat
redis-stat host localhost port 6380 overview
Print general information about a Redis instance;
学习啦在线学习网 实时打印出host为localhost,端口为6380,redis实例的总体信息
学习啦在线学习网 [root@Architect redis-1.2.6]# redis-stat port 6380 overview ------- data ------ ------------ load ----------------------------- - childs - keys used-mem clients requests connections 1319 5.37M 103 44108021 (+44108021) 810 1319 5.38M 103 44108124 (+103) 810 1319 5.38M 103 44108225 (+101) 810 1319 5.39M 103 44108326 (+101) 810 1319 5.40M 103 44108427 (+101) 810 1319 5.41M 103 44108528 (+101) 810
redis-stat host localhost port 6380 overview
学习啦在线学习网 Measure Redis server latency;
输出host为localhost,端口为6380,redis服务中每个请求的响应时长
学习啦在线学习网 [root@Architect redis-1.2.6]# redis-stat port 6380 latency1: 0.16 ms2: 0.11 ms3: 0.15 ms4: 0.11 ms5: 0.18 ms6: 0.14 ms