memcached 數據存儲

1、memcached簡介、安裝自行google

2、memcached監控與數據導出

   在memcached源碼目錄下的scripts目錄中一個perl語言的的腳本,可用於對memcache進行一些日常查詢與監控

   用法如下:  

#./memcached-tool 
Usage: memcached-tool <host[:port]> [mode]
       memcached-tool 10.0.0.5:11211 display    # shows slabs
       memcached-tool 10.0.0.5:11211            # same.  (default is display)
       memcached-tool 10.0.0.5:11211 stats      # shows general stats
       memcached-tool 10.0.0.5:11211 dump       # dumps keys and values
       memcached-tool 10.0.0.5:11211 move 7 9   # takes 1MB slab from class #7
                                                # to class #9.
You can only move slabs around once memory is totally allocated, and only
once the target class is full.  (So you can't move from #6 to #9 and #7
to #9 at the same itme, since you'd have to wait for #9 to fill from
the first reassigned page)

    2.1  memcache狀態查詢

#./memcached-tool 192.168.10.1:11211 stats
#192.168.10.1:11211 Field       Value
         accepting_conns           1
                   bytes           0
              bytes_read          20
           bytes_written           5
               cmd_flush           0
                 cmd_get           0
                 cmd_set           0
   connection_structures           3
        curr_connections           2
              curr_items           0
               evictions           0
                get_hits           0
              get_misses           0
          limit_maxbytes    67108864
     listen_disabled_num           0
                     pid       18088
            pointer_size          32
           rusage_system    0.000999
             rusage_user    0.000000
                 threads           2
                    time  1422969575
       total_connections           4
             total_items           0
                  uptime       25344
                 version       1.2.8

    是不是so eay


    2.2  導出memcache內在中的key與value值,命令如下:

  # ./memcached-tool 192.168.10.1:11211 dump >./memcachekeys

    是不是很簡單,當時我心情也和你一樣;不過別高興太早,經過大量數據測試,發現導出的key與內在的key數量不同,要少很多;後來經過大量google得之,memcached自身有緩衝區大小限制,最大2M。這個問題至今沒有得到解決,如有大神或路過的兄弟有此問題解決方法,請mail之[email protected]

       2.3   memcached數據導入

  #nc 192.168.10.1 11211 <./memcachekeys

    right! key-value導入如此簡單

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章