一、前言
大数据的兴起造就了nosql运动,以下省略1w字。。。。。。。。
二、分类
2.1、面向列的有序存储
google bigable
hbase
hypertable
2.2、键值存储
ehcache
membase
cassandra
redis
2.3、文档数据库
MongoDB
2.4、图型数据库
Neo4j
三、Memcache特性
全运存运转
哈希方式存储
简单文本协议进行数据通信
只操作字符数据
其他类型由应用解析,序列化与反序列化
集群由应用进行控制,采用一致性哈希算法
安装:
wget http://memcached.org/latest tar -zxvf memcached-1.x.x.tar.gz cd memcached-1.x.x ./configure && make && make test && sudo make install启动:memcache -d -p 11212 -u nobody -c 1024 -m128
测试:
telnet localhost 11212
格式:
set <key> <flag> <expires> <byte>
eg:
基本就是这几条命令了,set 、get 、 delete 、flush_all
Command |
Description |
Example |
get |
Readsavalue |
getmykey |
set Setakeyunconditionally |
setmykey0605 |
|
add Addanewkey |
addnewkey0605 |
|
replace Overwriteexistingkey |
replacekey0605 |
|
append |
Appenddatatoexistingkey |
appendkey06015 |
prepend |
Prependdatatoexistingkey |
prependkey06015 |
incr |
Incrementsnumericalkeyvaluebygivennumber |
incrmykey2 |
decr |
Decrementsnumericalkeyvaluebygivennumber |
decrmykey5 |
delete Deletesanexistingkey |
deletemykey |
|
flush_all Invalidatespecificitemsimmediately |
flush_all |
|
Invalidateallitemsinnseconds |
flush_all900 |
|
stats Printsgeneralstatistics |
stats |
|
Printsmemorystatistics |
statsslabs |
|
statsmalloc |
||
Printhigherlevelallocationstatistics |
statsitems |
|
|
statsdetail |
|
statssizes |
||
Resetsstatistics |
statsreset |
|
version |
Printsserverversion. |
version |
verbosity |
Increasesloglevel |
verbosity |
quit |
Terminatetelnetsession |
quit |