zoukankan      html  css  js  c++  java
  • Redis客户端基本操作以及查看慢查询

    1.连接

    redis-cli.exe -h 127.0.0.1 -p 6379

    2.验证密码

    λ redis-cli.exe -h 127.0.0.1 -p 6379
    127.0.0.1:6379> auth 密码

    3. redis key值获取

        keys * 获取当前数据下所有KEY值

        get  key  

      select 2 切换到第二个数据库

    127.0.0.1:6379> keys *
    (empty list or set)
    127.0.0.1:6379> keys *
    1) "1234"
    2) "2234"
    127.0.0.1:6379> get 1234
    "1234"
    127.0.0.1:6379> select 2
    OK
    

      4. info命令

    redis Info 命令基本语法如下:

    redis 127.0.0.1:6379> INFO [section]
    

      

    127.0.0.1:6379[2]> INFO
    # Server
    redis_version:3.0.501
    redis_git_sha1:00000000
    redis_git_dirty:0
    redis_build_id:ba05b51e58eb9205
    redis_mode:standalone
    os:Windows
    arch_bits:64
    multiplexing_api:WinSock_IOCP
    process_id:7436
    run_id:fac1a3e90e49c55b4709ed5f772a9831ef112f36
    tcp_port:6379
    uptime_in_seconds:2256
    uptime_in_days:0
    hz:10
    lru_clock:15351291
    config_file:
    
    # Clients
    connected_clients:2
    client_longest_output_list:0
    client_biggest_input_buf:0
    blocked_clients:0
    
    # Memory
    used_memory:712936
    used_memory_human:696.23K
    used_memory_rss:675288
    used_memory_peak:566399016
    used_memory_peak_human:540.16M
    used_memory_lua:36864
    mem_fragmentation_ratio:0.95
    mem_allocator:jemalloc-3.6.0
    
    # Persistence
    loading:0
    rdb_changes_since_last_save:5
    rdb_bgsave_in_progress:0
    rdb_last_save_time:1542075691
    rdb_last_bgsave_status:ok
    rdb_last_bgsave_time_sec:-1
    rdb_current_bgsave_time_sec:-1
    aof_enabled:0
    aof_rewrite_in_progress:0
    aof_rewrite_scheduled:0
    aof_last_rewrite_time_sec:-1
    aof_current_rewrite_time_sec:-1
    aof_last_bgrewrite_status:ok
    aof_last_write_status:ok
    
    # Stats
    total_connections_received:29836
    total_commands_processed:99662
    instantaneous_ops_per_sec:0
    total_net_input_bytes:600911
    total_net_output_bytes:783597
    instantaneous_input_kbps:0.00
    instantaneous_output_kbps:0.00
    rejected_connections:20002
    sync_full:0
    sync_partial_ok:0
    sync_partial_err:0
    expired_keys:1
    evicted_keys:0
    keyspace_hits:27
    keyspace_misses:2
    pubsub_channels:0
    pubsub_patterns:0
    latest_fork_usec:0
    migrate_cached_sockets:0
    
    # Replication
    role:master
    connected_slaves:0
    master_repl_offset:0
    repl_backlog_active:0
    repl_backlog_size:1048576
    repl_backlog_first_byte_offset:0
    repl_backlog_histlen:0
    
    # CPU
    used_cpu_sys:4.75
    used_cpu_user:3.69
    used_cpu_sys_children:0.00
    used_cpu_user_children:0.00
    
    # Cluster
    cluster_enabled:0
    
    # Keyspace
    db0:keys=2,expires=0,avg_ttl=0
    

      

    5. slowlog get 10    慢查询语句, 在上一个节中有讲过

         参照 http://www.cnblogs.com/huamei2008/p/8850047.html

    10.0.0.80:6380> slowlog get 10
     1) 1) (integer) 1017859
        2) (integer) 1542078045
        3) (integer) 15600
        4) 1) "HMSET"
           2) "CME_6E1812_1_20181113"
           3) "x00>xabKWIxd6"
           4) "x00>xabKWIxd6xf6xb7x01x00xecxb7x01x00xf6xb7x01x00xecxb7x01x00x1dx00x00x00yxf03x01"
     2) 1) (integer) 1017858
        2) (integer) 1542078044
        3) (integer) 15600
        4) 1) "HMSET"
           2) "CFFEX_ZJ-IH1812_1_20181113"
           3) "x00>xabKWIxd6"
           4) "x00>xabKWIxd6xe4^x00x00xda^x00x00xe2^x00x00xe2^x00x00x00x00x00yxf03x01"
     3) 1) (integer) 1017857
        2) (integer) 1542078016
        3) (integer) 15600
        4) 1) "HMSET"
           2) "DCE_DS-j1901_1_20181113"
           3) "x00>xabKWIxd6"
           4) "x00>xabKWIxd6x05Zx00x00xe7Yx00x00xfbYx00x00xe7Yx00x00fx04x00x00yxf03x01"
    

      

    6.  Redis自身性能压测:

       命令:

      redis-benchmark -p 6379 -c 20000 -n 50000

        -h 表示IP

        -p 表示端口

        -c 表示连接数

        -n表示请求数

        -t 后面跟请求方式, 如get

    参考资料:http://www.runoob.com/redis/redis-data-types.html 

    https://www.cnblogs.com/huamei2008/p/8850165.html
    http://www.cnblogs.com/huamei2008/p/8850047.html

  • 相关阅读:
    unity, texture import settings
    unity, 最简单的additive shader
    unity, shader input and output
    unity, multi pass shader中的surface pass
    unity, 荧光效果(bloom)
    unity, 查看内置shader源码
    unity, Find References In Scene
    unity 主循环
    unity 显示帧率
    HttpUrlConnection的setDoOutput与setDoInput的区别
  • 原文地址:https://www.cnblogs.com/Martianhh/p/9951121.html
Copyright © 2011-2022 走看看