最近想研究研究新浪的memcachedb,先从官方文档入手~~~
文档地址:http://memcachedb.org/memcachedb-guide-1.0.pdf
主要内容包括以下几点:
Getting Started
1.What is Memcachedb?
"Memcachedb is a distributed key-value storage system designed for persistent."
A complete memcached, but *NOT* a cache solution(Memcached is good enough for cache.)
*NO* expiration(For memcache protocol compatible, still reserved, but we do nothing.)
Totally for persistent(Transaction, replication, we do our best to achieve persistent.)
2.Why Memcachedb?
We have MySQL, we have PostgreSQL, we have a lot of RDBMSs, but
why we need Memcachedb?
@RDBMS is slow
All they have a complicated SQL engine on top of storage. Our data
requires to be stored and retrieved damnable fast.
@Not concurrent well
When thousands of clients, millions of requests happens...
@But the data we wanna store is very small size!
Cost is high if we use RDBMS.
@Many critical infrastructure services need fast, reliable data storage and retrieval, but do not need the flexibility of dynamic SQL queries.
-Index, Counter, Flags
-Identity Management(Account, Profile, User config info, Score)
-Messaging
-Personal domain name
-meta data of distributed system
-Other non-relatonal data
3.Memcachedb Features
@High performance read/write for a key-value based object
@Rapid set/get for a key-value based object, not relational. Benchmark will tell you the true later.
@High reliable persistent storage with transaction
@Transaction is used to make your data more reliable.
@High availability data storage with replication
@Replication rocks! Achieve your HA, spread your read, make your transaction durable!
@Memcache protocol compatibility
@Lots of Memcached Client APIs can be used for Memcachedb, almost in any language, Perl, C, Python, Java, ...
4.Supported Commands
Standard Memcache Commands
-‘get’ Retrieval of one or multiple items
-‘set’ "Store this data”
-‘add’ "Store this data, but only if the server *doesn’t* already hold data for this key”
-‘replace’ "Store this data, but only if the server *does* already hold data for this key”
-‘delete’ deletes one item based a key
-‘incr/decr’ Increment or decrement a numeric value. It’s atomic!
-‘stats’ shows the status of current deamon. 'stats’, 'stats malloc’,'stats maps’
Private Commands
-‘db checkpoint’ does a checkpoint manuanlly.
-‘db archive’ removes log files that are no longer needed.
-‘stats bdb’ shows the status of BerkeleyDB.
-‘rep ismaster’ shows whether the site is a master.
-‘rep whoismaster’ shows which site is a master.
-‘rep set priority’ sets the priority of a site for electing in replication.
-‘rep set ack policy’ sets ACK policy of the replication.
-‘rep set ack timeout’ sets ACK timeout value of the replication .
-‘rep set bulk’ Enable bulk transfer or not in replication.
-‘rep set request’ sets the minimum and maximum number of missing log records that a client waits before requesting retransmission.
-‘stats rep’ shows the status of Replication.
MDB In Action
1.Installation
libevent An event notification library that provides a mechanism to execute a callback function when a specific event occurs on a file descriptor or after a timeout has been reached. Now it supports /dev/poll, kqueue(2), event ports, select(2), poll(2) and epoll(4).
http://www.monkey.org/~provos/libevent/
BerkeleyDB The industry-leading open source, embeddable database engine that provides developers with fast, reliable, local persistence with zero administration.
http://www.oracle.com/technology/products/berkeley-db/db/index.html
![](http://my.oschina.net/uploads/space/2010/1223/011237_jOzS_98095.png)
![](http://my.oschina.net/uploads/space/2010/1223/011253_UHS4_98095.png)
![](http://my.oschina.net/uploads/space/2010/1223/011305_V5GP_98095.png)
2.Running Options Explained
![](http://my.oschina.net/uploads/space/2010/1223/011524_fNMz_98095.png)
![](http://my.oschina.net/uploads/space/2010/1223/011534_szg6_98095.png)
3.Managing Daemon
![](http://my.oschina.net/uploads/space/2010/1223/011738_ODYX_98095.png)
启动:
![](http://my.oschina.net/uploads/space/2010/1223/011757_MMvc_98095.png)
停止:
![](http://my.oschina.net/uploads/space/2010/1223/011810_e65h_98095.png)
4.Commands Using telnet
![](http://my.oschina.net/uploads/space/2010/1223/012042_pEpp_98095.png)
![](http://my.oschina.net/uploads/space/2010/1223/012053_tSsr_98095.png)
![](http://my.oschina.net/uploads/space/2010/1223/012105_mwWZ_98095.png)
Internals
![](http://my.oschina.net/uploads/space/2010/1223/012325_X60k_98095.png)
![](http://my.oschina.net/uploads/space/2010/1223/012334_2NZS_98095.png)
Replication
![](http://my.oschina.net/uploads/space/2010/1223/013413_aYRF_98095.png)
![](http://my.oschina.net/uploads/space/2010/1223/013425_fxyV_98095.png)
![](http://my.oschina.net/uploads/space/2010/1223/013437_UjRQ_98095.png)
![](http://my.oschina.net/uploads/space/2010/1223/013450_k4oX_98095.png)
![](http://my.oschina.net/uploads/space/2010/1223/013500_86N0_98095.png)
![](http://my.oschina.net/uploads/space/2010/1223/013508_nLmf_98095.png)
![](http://my.oschina.net/uploads/space/2010/1223/013518_tdvM_98095.png)
![](http://my.oschina.net/uploads/space/2010/1223/013528_GRRU_98095.png)
![](http://my.oschina.net/uploads/space/2010/1223/013538_kx5q_98095.png)
![](http://my.oschina.net/uploads/space/2010/1223/013547_ROsa_98095.png)
![](http://my.oschina.net/uploads/space/2010/1223/013556_Dt7j_98095.png)
![](http://my.oschina.net/uploads/space/2010/1223/013609_cOxn_98095.png)
![](http://my.oschina.net/uploads/space/2010/1223/013629_kVvp_98095.png)
![](http://my.oschina.net/uploads/space/2010/1223/013643_gvVr_98095.png)
Managing and Monitoring
1.Managing DB Files
![](http://my.oschina.net/uploads/space/2010/1223/014019_D45B_98095.png)
![](http://my.oschina.net/uploads/space/2010/1223/014030_WNbs_98095.png)
![](http://my.oschina.net/uploads/space/2010/1223/014040_jCfb_98095.png)
![](http://my.oschina.net/uploads/space/2010/1223/014050_KhUx_98095.png)
![](http://my.oschina.net/uploads/space/2010/1223/014100_yH1i_98095.png)
![](http://my.oschina.net/uploads/space/2010/1223/014110_dgVX_98095.png)
2.Monitoring
![](http://my.oschina.net/uploads/space/2010/1223/014256_NfaL_98095.png)
![](http://my.oschina.net/uploads/space/2010/1223/014256_96iA_98095.png)
![](http://my.oschina.net/uploads/space/2010/1223/014306_3CV6_98095.png)
![](http://my.oschina.net/uploads/space/2010/1223/014315_bU6c_98095.png)
![](http://my.oschina.net/uploads/space/2010/1223/014324_MN2a_98095.png)
![](http://my.oschina.net/uploads/space/2010/1223/014334_8y9p_98095.png)