NOSQL 2 NOSQL Name Type Store Language Memcached

  • Slides: 30
Download presentation
NOSQL入门

NOSQL入门

2. NOSQL产品 Name Type Store Language -----------------------Memcached K-V Memory C Mongo. DB K-V Document

2. NOSQL产品 Name Type Store Language -----------------------Memcached K-V Memory C Mongo. DB K-V Document C++ Graph. DB Graph C# Neo 4 j Graph Java ……

Mongo. DB特性 Distributed ¡ Document ¡ Schema-Free , No-Schema ¡ JSONBSON ¡ Ruby、Python、C#、PHP、Java、C ¡

Mongo. DB特性 Distributed ¡ Document ¡ Schema-Free , No-Schema ¡ JSONBSON ¡ Ruby、Python、C#、PHP、Java、C ¡ windows、linux、unix、Mac. OS ¡ Cloud ¡

3. 部署 1. Memcached部署 2. Mongo. DB部署

3. 部署 1. Memcached部署 2. Mongo. DB部署

3. 1. Memcached部署

3. 1. Memcached部署

Windows下服务安装命令 sc create Memcachedserver 11212 binpath= "c: memcached. exe -d runservice -m 256 -p

Windows下服务安装命令 sc create Memcachedserver 11212 binpath= "c: memcached. exe -d runservice -m 256 -p 11212 -c 5000" start= auto displayname= "Memcached server (11212)" sc description Memcachedserver 11212 " 缓存服务:端口 11212。"

Shell telnet localhost 11212 ¡ Set 1001 0 0 5 ¡ Get 1001 0

Shell telnet localhost 11212 ¡ Set 1001 0 0 5 ¡ Get 1001 0 0 5 ¡ Stats ¡ Flush_all ¡

3. 2. Mongo. DB部署 Single 单机、单实例 ¡ Master-Slave 主从 ¡ Sharding 分片 ¡

3. 2. Mongo. DB部署 Single 单机、单实例 ¡ Master-Slave 主从 ¡ Sharding 分片 ¡

Master-Slave

Master-Slave

Sharding

Sharding

Windows下单实例启动 cd c:  ¡ mkdir datadbsingle ¡ cd c: mongodbbin ¡ mongod -dbpath

Windows下单实例启动 cd c: ¡ mkdir datadbsingle ¡ cd c: mongodbbin ¡ mongod -dbpath c: datadbsingle port 30001 ¡

Shell cd c: mongodbbin mongo -host localhost -port 30001 Show dbs Use mydb Db.

Shell cd c: mongodbbin mongo -host localhost -port 30001 Show dbs Use mydb Db. book. insert({name: ”good book”}) Db. book. insert({title: ”good book 2”}) Db. find({name: ”good book”}) ¡

4. 应用开发 4. 1. Memcached Client ¡ 4. 2. Mongo. DB Client ¡

4. 应用开发 4. 1. Memcached Client ¡ 4. 2. Mongo. DB Client ¡

4. 1. Memcached Client 驱动Memcached. Client. Library. dll ¡ 接口 Memcached. Client bool Set(string

4. 1. Memcached Client 驱动Memcached. Client. Library. dll ¡ 接口 Memcached. Client bool Set(string key , object o) object Get(string key) Hashtable Get. Multiple(string[] keys) object[] Get. Multiple. Array(string[] keys) bool Delete(string key) bool Replace(string key, object o) ¡

4. 2. Mongo. DB Client 驱动Mongo. DB. Driver. dll、 Mongo. DB. Bson. dll ¡

4. 2. Mongo. DB Client 驱动Mongo. DB. Driver. dll、 Mongo. DB. Bson. dll ¡ 接口 Mongo. Server(Database. Server) Mongo. Database(Database) Mongo. Collection(Table) Insert、 Insert. Batch、Find、Remove、 Update ¡

5. 总结 NOSQL概念 ¡ Memcached和Mongo. DB应用 ¡

5. 总结 NOSQL概念 ¡ Memcached和Mongo. DB应用 ¡