数据库

 首页 > 数据库 > MongoDB > 在.net中使用mongodb数据库

在.net中使用mongodb数据库

分享到:
【字体:

    MongoDB是一个介于关系数据库和非关系数据库之间的产品,是非关系数据库当中功能最丰富,最像关系数据库的。他支持的数据结构非常松散,是类似json的bjson格式,因此可以存储比较复杂的数据类型。Mongo最大的特点是他支持的查询语言非常强大,其语法有点类似于面向对象的查询语言,几乎可以实现类似关系数据库单表查询的绝大部分功能,而且还支持对数据建立索引。
它的特点是高性能、易部署、易使用,存储数据非常方便。主要功能特性有:
面向集合存储,易存储对象类型的数据。
模式自由。
支持动态查询。
支持完全索引,包含内部对象。
支持查询。
支持复制和故障恢复。
使用高效的二进制数据存储,包括大型对象(如视频等)。
自动处理碎片,以支持云计算层次的扩展性
支持RUBY,PYTHON,JAVA,C++,PHP等多种语言。
文件存储格式为BSON(一种JSON的扩展)
可通过网络访问
所谓“面向集合”(Collenction-Orented),意思是数据被分组存储在数据集中,被称为一个集合(Collenction)。每个 集合在数据库中都有一个唯一的标识名,并且可以包含无限数目的文档。集合的概念类似关系型数据库(RDBMS)里的表(table),不同的是它不需要定 义任何模式(schema)。
模式自由(schema-free),意味着对于存储在mongodb数据库中的文件,我们不需要知道它的任何结构定义。如果需要的话,你完全可以把不同结构的文件存储在同一个数据库里。
存储在集合中的文档,被存储为键-值对的形式。键用于唯一标识一个文档,为字符串类型,而值则可以是各中复杂的文件类型。我们称这种存储形式为BSON(Binary Serialized dOcument Format)。
MongoDB服务端可运行在Linux、Windows或OS X平台,支持32位和64位应用,默认端口为27017。推荐运行在64位平台,因为MongoDB
在32位模式运行时支持的最大文件尺寸为2GB。
MongoDB把数据存储在文件中(默认路径为:/data/db),为提高效率使用内存映射文件进行管理。
以上为随便摘的,其实就是非传统的非关系数据库,现在归到文档型数据库分类之中,注意32位操作系统支持的最大文件为2GB,所以做大文件海量储存的朋友要选择64位的系统安装。开始我们的下载安装之路吧。
一、下载
MongoDB的官网是:http://www.mongodb.org/
MongoDB最新版本下载在官网的DownLoad菜单下:http://www.mongodb.org/downloads 
本人选择的是Windows 32-bit 1.8.1版本
MongoDB For .net 驱动开发包位于官网的Driver菜单下(含其它语言开发链接):https://github.com/mongodb/mongo-csharp-driver/downloads
本人操作系统为Windows7 专业版,选择MongoDB版本为Windows 32-bit 1.8.1,开发包为VS2008版本
开始我们的安装过程了
二、安装
1.解压mongodb-win32-i386-1.8.1.zip ,创建路径C:Program Filesmongodb ,将解压后的Bin文件Copy to 此文件夹下
2.C:Program Filesmongodb 下建立Data文件夹 C:Program Filesmongodbdata ,然后分别建立db,log两个文件夹,至此mongodb下有以下文件夹
C:Program Filesmongodbbin
C:Program Filesmongodbdatadb
C:Program Filesmongodbdatalog
在log文件夹下创建一个日志文件MongoDB.log,即C:Program FilesmongodbdatalogMongoDB.log
完成以上工作后,你为奇怪为什么要建立这些文件夹(因为,Mongodb安装需要这些文件夹,默认安装是不用创建,但是文件都为安装到C:data下)
3.安装类型
3.1 程序启动方式
    运行cmd.exe 进入DOS命中界面
> cd C:Program Filesmongodbbin
> C:Program Filesmongodbbin>mongod -dbpath "C:Program Filesmongodbdatadb"
执行此命令即将mongodb的数据库文件创建到C:Program Filesmongodbdatadb 目录,不出意外的会看到命令最后一行sucess的成功提示
此时数据库就已启动,该界面为Mongo的启动程序,关闭后可直接双击bin下的mongod.exe  (注意是d,这个是启动程序)
启动程序开启后,再运行mongo.exe 程序(注意没有d) ,界面如下

测试数据库操作
>help  (查看相关信息)
>db.foo.insert({a:1})    (往foo表插入a,1字段值,foo表为默认表)
>db.foo.find()                (查看foo表数据)
结果如下:
  
可以看到插入了3条记录分别人a,cctv,set 。
当mongod.exe被关闭时,mongo.exe 就无法连接到数据库了,因此每次想使用mongodb数据库都要开启mongod.exe程序,所以比较麻烦,接下来我们将
MongoDB安装为windows服务吧
3.2 windows service方式
运行cmd.exe
> cd C:Program Filesmongodbbin
> C:Program Filesmongodbbin>mongod --dbpath "C:Program Filesmongodbdatadb" --logpath "C:Program FilesmongodbdatalogMongoDB.log" --install --serviceName "MongoDB"
这里MongoDB.log就是开始建立的日志文件,--serviceName "MongoDB" 服务名为MongoDB
运行命令成功为如下图:

引时服务已经安装成功,运行
>NET START MongoDB   (开启服务)
>NET stop MongoDB   (关闭服务)
>
> C:Program Filesmongodbbin>mongod --dbpath "C:Program Filesmongodbdatadb" --logpath "C:Program FilesmongodbdatalogMongoDB.log" --remove --serviceName "MongoDB"      (删除,注意不是--install了)
其它命令可查阅help命令或官网说明。
查看服务
运行bin文件夹下mongo.exe 客户端测试一下吧。测试同3.1相同 。
到此安装就完成了。
本节问题:
为什么要用MongoDB
MongoDB for .net驱动选择
MongoDB for VS插件介绍
Demo介绍   
 一、为什么要用MongoDB
  为什么要用MongoDB取代传统关系型数据库?其实不是取代,只是对传统数据库的文档型补充。不是所有的数据都需要二维关系及多表对应的存储和查询,比如:文件的海量存储,只需Key与Value形式的存储及查询,同时这种方式的存储及查询都是高效的,可查看GirdFS,GirdFS是MongoDB的大文件存储系统,比如图片、音频、视频;数据如果不需要实时分析统计(包含读写比高的),也可以使用KV形式存储及查询。MongoDB介于缓存与数据库之间,存取速度逊于缓存但远远高于传统数据库。数据库存储以键值形式,你可能会认为对数据关系的处理及分析挖掘不及传统数据库,理论上是如此,但是MongoDB加入了对LINQ的支持,相信可以弥补其不足之处。做项目要求稳,对于MongoDB的使用我们只是对传统数据库的一个类似二级缓存的补充,cache缓存及Memcached做为一级缓存,MongoDB做为二级缓存对海量大数据的一个缓冲查询,最终才是数据库及物理文件的存储。如果你对数据的分析挖掘统计不是实时的,也可以尝试使用MongoDB直接存取数据,数据后期处理工作可通过MongoDB同步到传统数据库。(以上纯属个人理解)
      用MongoDB做海量存储,又出现另一个问题读写频率与扩展?MongoDB可以根据应用程序的需要以两种模式来运行。第一种是“单主”(single master)模式,只有一台主服务器来处理所有的写操作。读操作能从中分离出去,通过任意数量的从服务器来进行读操作,这有利于提高读的可扩展性(使用场景:Sourceforge)。对于那些写数据量很大或写频率过高,单台主服务器无法处理的应用程序,可以使用MongoDB的自动分片模式。该模式下写操作会自动分配到任意数量的“片”中(一般是一台或一组MongoDB服务器),它们负责这部分数据集的写和读。无论使用哪种模式,MongoDB都会采取“强一致性”方法(你可以把MongoDB看成CAP理论中的C-P系统)。高可用性是通过将数据复制到多个MongoDB节点来实现的,每个节点都能及时成为一个分片的主服务器——MongoDB会自动处理故障转移。这能让你在维持相当高的写可用性的同时,拥有强一致性特性,这对一些用例来说非常重要。而MongoDB的分片支持复制和故障切换:Mongo数据库支持服务器之间的数据复制,支持主-从模式及服务器之间的相互复制。MongoDB的自动分片模块 ("mongos"). 自动分片可以用于构建一个大规模的可扩展的数据库集群,这个集群可以并入动态增加的机器。(说细可参照此官方文档)
二、MongoDB for .net驱动选择
驱动源码地址:https://github.com/mongodb/mongo-csharp-driver/downloads(第一章提到的)

项目应用:
第一款:mongodb-csharp 项目地址:http://github.com/samus/mongodb-csharp  应用很广泛,更新速度也比较快,也加入了对LINQ的支持 
第二款:simple-mongodb 项目地址:http://code.google.com/p/simple-mongodb   以JSON为核心
第三款:NoRM 项目地址:http://github.com/atheken/NoRM  加入了对强类型的支持,是对一的补充
其它的也有,就不介绍了,经过综合比较选择了方案一,也就是第一章介绍的。方案一应该广泛用于项目了,并且保持较快的更新速度,同时也加了LINQ的支持,对于项目求稳的朋友是最好的选择,所以我也选择了方案一samus驱动,下载的是(samus-mongodb-csharp-0.90.0.1.zip)下载选Tar.Zip包含源码。另外一个包只有DLL。后面的文章中将一直使用samus开发包。
三、MongoDB for VS插件介绍
插件下载地址:http://www.cnblogs.com/ILoveSilence/archive/2010/08/10/mongowidget_1.html (园子里人做的)
插件和VS的数据源功能类似,想使用的就去看这篇博文吧。
四、Demo介绍
下载samus开发包后,你会发现里面已经有了samples了,那就开始我们的入门之路了

这Demo都不写了,直接拿来分析了
留意的朋友会发现,MongoDB的连接字符串是IP+端口,与传统的数据库引擎不同,包括数据的CURD操作都是键值方式,是不是有点像Memcached。
using System;
using System.Configuration;
using System.Linq;
using MongoDB;
using MongoDB.Configuration;
using MongoDB.Linq;
namespace Simple
{
    /// 
    ///   Illustrates some simple operations on the database.
    ///   Creating a database connection.
    ///   Remove some documents.
    ///   Insert some documents
    ///   Find one document
    ///   Find several documents and iterate through them.
    /// 

    internal class MainClass
    {
        private IMongoCollection categories;
        private Mongo mongo;
        private IMongoDatabase simple;
        private class MyClass
        {
            public string Name { get; set; }
            public  int Corners { get; set; }
        }
        private class SubClass : MyClass
        {
            public double Ratio { get; set; }
        }
        public static void Main(string[] args)
        {
            #region 以下为被屏蔽源码部分,我们先从SetUp方法开始
            //var config = new MongoConfigurationBuilder();
            //// COMMENT OUT FROM HERE
            //config.Mapping(mapping =>
            //{
            //    mapping.DefaultProfile(profile =>
            //    {
            //        profile.SubClassesAre(t => t.IsSubclassOf(typeof(MyClass)));
            //    });
            //    mapping.Map();
            //    mapping.Map();
            //});
            //// TO HERE
            //config.ConnectionString("Server=127.0.0.1");
            //using (Mongo mongo = new Mongo(config.BuildConfiguration()))
            //{
            //    mongo.Connect();
            //    try
            //    {
            //        var db = mongo.GetDatabase("TestDb");
            //        var collection = db.GetCollection();
            //        MyClass square = new MyClass()
            //        {
            //            Corners = 4,
            //            Name = "Square"
            //        };
            //        MyClass circle = new MyClass()
            //        {
            //            Corners = 0,
            //            Name = "Circle"
            //        };
            //        SubClass sub = new SubClass()
            //        {
            //            Name = "SubClass",
            //            Corners = 6,
            //            Ratio = 3.43
            //        };
            //        collection.Save(square);
            //        collection.Save(circle);
            //        collection.Save(sub);
            //        var superclass = (from item in db.GetCollection("MyClass").Linq()
            //                    where item.Corners > 1
            //                    select item.Corners).ToList();
            //        var subclass = (from item in db.GetCollection("MyClass").Linq()
            //                        where item.Ratio > 1
            //                        select item.Corners).ToList();
            //        Console.WriteLine("Count by LINQ on typed collection: {0}", collection.Linq().Count(x => x.Corners > 1));
            //        Console.WriteLine("Count by LINQ on typed collection2: {0}", db.GetCollection().Linq().Count(x => x.Corners > 1));
            //        //Console.WriteLine("Count by LINQ on typed collection3: {0}", db.GetCollection().Count(new { Corners = Op.GreaterThan(1) }));
            //        Console.WriteLine("Count on typed collection: {0}", collection.Count(new { Corners = Op.GreaterThan(1) }));
            //        var coll = db.GetCollection("MyClass");
            //        var count = coll.Count(new Document("Corners", Op.GreaterThan(1)));
            //        Console.WriteLine("Count: {0}", count);
            //        Console.ReadKey();
            //    }
            //    finally
            //    {
            //        mongo.Disconnect();
            //    }
            //}
            #endregion
            var main = new MainClass();
            main.Setup();
            main.Run();
            Console.ReadLine();
        }
        /// 
        ///   Setup the collection and insert some data into it.
        /// 

        public void Setup()
        {
            //从配置文件读取连接字符串 IP+端口
            var connstr = ConfigurationManager.AppSettings["simple"];
            if(String.IsNullOrEmpty(connstr))
                throw new ArgumentNullException("Connection string not found.");
            //创建Mongo数据服务及连接
            mongo = new Mongo(connstr);
            mongo.Connect();
            //获取数据库实例(如果该实例不存,就会自动创建simple实例)
            simple = mongo["simple"];
            //获取表名(如果该表名不存在,就会自动创建categories表名)
            categories = simple.GetCollection("categories");
            //添加记录前清除所有记录
            Clean();
            var names = new[] {"Bluez", "Jazz", "Classical", "Rock", "Oldies", "Heavy Metal"};
            //循环插入记录 doucment会自动生成键值_id,id的编码体现了数据的插入顺序
            foreach(var name in names)
                categories.Insert(new Document {{"name", name}});
        }
        public void Clean()
        {
            //删除document name 为Jazz的记录
            categories.Remove(new Document {{"name", "Jazz"}}); //remove documents with the name Jazz.
            //删除所有记录集
            categories.Remove(new Document()); //remove everything from the categories collection.
        }
        public void Run()
        {
            //查找单条记录 参数类型为Document
            var category = categories.FindOne(new Document {{"name", "Bluez"}});
            Console.WriteLine("The id findOne" + category["_id"]);
            //更新1 用键值ID读取对象,并更新字段值,保存
            var selector = new Document {{"_id", category["_id"]}};
            category["name"] = "Bluess";
            //The following will do the same thing.
            categories.Save(category);
            Console.WriteLine("Category after one update " + categories.FindOne(selector));
            //更新2 Update参数1去更新参数2并保存
            category["name"] = "Blues";
            categories.Update(category, selector);
            Console.WriteLine("Category after two updates " + categories.FindOne(selector));
            //Find it by _id that has been converted to a string now.
            var id = (category["_id"]).ToString();
            //注意: 这里id.ToString()与id.ToOid() (为什么类扩展这个方法,我也没明白,是不是id!=24 位会出现转义字符要替换掉)
            Console.WriteLine(string.Format("Found by string id[{0}] converted back to Oid[{1}]",id.ToString(),id.ToOid()));
            Console.WriteLine(categories.FindOne(new Document {{"_id", id.ToOid()}}));
            //Find(new Document()) is equivalent to FindAll();
            //Specifying the cursor in a using block will close it on the server if we decide not
            //to iterate through the whole thing.
            Console.WriteLine("输出所有对象.........");
            using(var all = categories.Find(new Document()))
            {
                foreach(var doc in all.Documents)
                    Console.WriteLine(doc.ToString());
            }
            mongo.Disconnect();
        }
    }
}
//类扩展ToOid方法到string中
public static class OidExtensions
{
    public static Oid ToOid(this string str)
    {
        if(str.Length == 24)
            return new Oid(str);
        return new Oid(str.Replace(""", ""));
    }
}
以上为MongoDB的数据库连接及CRUD操作(Document方式),我们来测试一下,数据库实例,表,记录是否创建成功了呢?
打开上一章提到的Bin文件夹下的Mongo.exe程序 按图示输入命令查看

入门Demo就演示到这里了,有点简单,我也在是一边学习一边分享。Demo就不提供下载了,都在samus里面,只是我这边加了注释。
上一节我们在samus的simple例子简单的入门了,这一节将要探讨的问题写个简要
对象存储
继续关系对象的存储
LINQ体现
类关系分析
一、对象存储
继续在samus源码上分析,依然是simple的例子。Demo中.net 3.5特性基本上都涉及了。
 public static void Main(string[] args)
        {
            #region 以下为Mongo配置及关系映射部分
            //var config = new MongoConfigurationBuilder();
            //COMMENT OUT FROM HERE
            //config.Mapping(mapping =>
            //{
            //    mapping.DefaultProfile(profile =>
            //    {
            //        profile.SubClassesAre(t => t.IsSubclassOf(typeof(MyClass)));
            //    });
            //    mapping.Map();
            //    mapping.Map();
            //});
            // TO HERE
             #endregion
            //config.ConnectionString("Server=127.0.0.1");
            //using (Mongo mongo = new Mongo(config.BuildConfiguration()))
            using (Mongo mongo = new Mongo("Server=127.0.0.1"))
            {
                mongo.Connect();
                try
                {
                    //索引器方式mogo["TestDb"]
                    var db = mongo.GetDatabase("TestDb");
                    //老版不支持泛型的时候写法是这样的db.GetCollection("Name") ->看源码重构了一个MongoCollection_1类
                    //将老版方法重构为db.GetCollection("Name");
                    //此方法其实将类名反射为集合 db.GetCollection("MyClass")
                    var collection = db.GetCollection();
                    //.net 3.5集合初始化特性 创建3个对象(2个MyClass,1个子类SubClass)
                    MyClass square = new MyClass()
                    {
                        Corners = 4,
                        Name = "Square"
                    };
                    MyClass circle = new MyClass()
                    {
                        Corners = 0,
                        Name = "Circle"
                    };
                    SubClass sub = new SubClass()
                    {
                        Name = "SubClass",
                        Corners = 6,
                        Ratio = 3.43
                    };
                    //保存对象
                    collection.Save(square);
                    collection.Save(circle);
                    collection.Save(sub);
                    #region LINQ写法读取数据
                    //var superclass = (from item in db.GetCollection("MyClass").Linq()
                    //                  where item.Corners > 1
                    //                  select item.Corners).ToList();
                    //var subclass = (from item in db.GetCollection("MyClass").Linq()
                    //                where item.Ratio > 1
                    //                select item.Corners).ToList();
                    #endregion
                    //Lambda写法
                    //读取集合MyClass所有对象
                    Console.WriteLine("Count by LINQ on typed collection: {0}", collection.Linq().Count(x => x.Corners > 1));
                    //读取集合为SubClass的对象(由于SubClass被保存到MyClass集合中了,故结果为0)
                    Console.WriteLine("Count by LINQ on typed collection2: {0}", db.GetCollection().Linq().Count(x => x.Corners > 1));
                    //Console.WriteLine("Count by LINQ on typed collection3: {0}", db.GetCollection().Count(new { Corners = Op.GreaterThan(1) }));
                    //注:op 是Document的子类 虽然我们存的是其它对象,但所有的对象最终都是以Document类型存储的,
                    //也就意味检索数据也是Document方式查找或统计了,以下Lambda方式的统计就体现了
                    //在基类中大家可以看到都是count(new Document())方式及条件查询的,这里介绍完了,下面的代码就容易理解了
                    Console.WriteLine("Count on typed collection: {0}", collection.Count(new { Corners = Op.GreaterThan(1) }));
                    var count = collection.Count(new Document("Corners", Op.GreaterThan(1)));
                    Console.WriteLine("Count: {0}", count);
                    Console.ReadKey();
                }
                finally
                {
                    mongo.Disconnect();
                }
            }
            //var main = new MainClass();
            //main.Setup();
            //main.Run();
            Console.ReadLine();
        }
看一下结果:

在打开mongo.exe查看一下结果

是不是很奇怪,MyClass,SubClass对象又没有标记为可序列化,如何就被保存下来了?难道是通过反射对实现的,看看源码

二、继续关系对象的存储
当数据保存为文档记录时,MongoDB是如何识别这个两类是有继承关系的呢?我们接着下面的代码修改一下继续
先删除上次的记录,在mongo.exe中运行db.MyClass.drop() 删除集合中的数据,查看更多操作集合的命令可执行db.MyClass.help
mongo.exe脚本命令官方介绍用的是Javascript脚本,从命名可以看出是它的影子。mongo.exe的脚本学习可参照这个链接
http://special.csdn.net/mongodb/index.html 
        public static void Main(string[] args)
        {
            #region 以下为Mongo配置及关系映射部分
            var config = new MongoConfigurationBuilder();
            //COMMENT OUT FROM HERE 建立两者的关系
            config.Mapping(mapping =>
            {
                mapping.DefaultProfile(profile =>
                {
                    profile.SubClassesAre(t => t.IsSubclassOf(typeof(MyClass)));
                });
                mapping.Map();
                mapping.Map();
            });
            // TO HERE
             #endregion
            config.ConnectionString("Server=127.0.0.1");
            //将配置注入Mongo类中
            using (Mongo mongo = new Mongo(config.BuildConfiguration()))
            {
                mongo.Connect();
                try
                {
                    //索引器方式mogo["TestDb"]
                    var db = mongo.GetDatabase("TestDb");
                    //老版不支持泛型的时候写法是这样的db.GetCollection("Name") ->看源码重构了一个MongoCollection_1类
                    //将老版方法重构为db.GetCollection("Name");
                    //此方法其实将类名反射为集合 db.GetCollection("MyClass")
                    var collection = db.GetCollection();
                    //.net 3.5集合初始化特性 创建3个对象(2个MyClass,1个子类SubClass)
                    MyClass square = new MyClass()
                    {
                        Corners = 4,
                        Name = "Square"
                    };
                    MyClass circle = new MyClass()
                    {
                        Corners = 0,
                        Name = "Circle"
                    };
                    SubClass sub = new SubClass()
                    {
                        Name = "SubClass",
                        Corners = 6,
                        Ratio = 3.43
                    };
                    //保存对象
                    collection.Save(square);
                    collection.Save(circle);
                    collection.Save(sub);
                    #region LINQ写法读取数据
                    //var superclass = (from item in db.GetCollection("MyClass").Linq()
                    //                  where item.Corners > 1
                    //                  select item.Corners).ToList();
                    //var subclass = (from item in db.GetCollection("MyClass").Linq()
                    //                where item.Ratio > 1
                    //                select item.Corners).ToList();
                    #endregion
                    //Lambda写法
                    //读取集合MyClass所有对象
                    Console.WriteLine("Count by LINQ on typed collection: {0}", collection.Linq().Count(x => x.Corners > 1));
                    //读取集合为SubClass的对象(由于SubClass被保存到MyClass集合中了,故结果为0)
                    Console.WriteLine("Count by LINQ on typed collection2: {0}", db.GetCollection().Linq().Count(x => x.Corners > 1));
                    //Console.WriteLine("Count by LINQ on typed collection3: {0}", db.GetCollection().Count(new { Corners = Op.GreaterThan(1) }));
                    //注:op 是Document的子类 虽然我们存的是其它对象,但所有的对象最终都是以Document类型存储的,
                    //也就意味检索数据也是Document方式查找或统计了,以下Lambda方式的统计就体现了
                    //在基类中大家可以看到都是count(new Document())方式及条件查询的,这里介绍完了,下面的代码就容易理解了
                    Console.WriteLine("Count on typed collection: {0}", collection.Count(new { Corners = Op.GreaterThan(1) }));
                    var count = collection.Count(new Document("Corners", Op.GreaterThan(1)));
                    Console.WriteLine("Count: {0}", count);
                    Console.ReadKey();
                }
                finally
                {
                    mongo.Disconnect();
                }
            }
            //var main = new MainClass();
            //main.Setup();
            //main.Run();
            Console.ReadLine();
        }
结果:

再看mongo.exe中的记录:
 
三、LINQ的体现
View Code
  #region LINQ写法读取数据
                    var myCollection = (from item in db.GetCollection("MyClass").Linq()
                                      where item.Corners > 1
                                        select item).ToList();
                    foreach (MyClass my in myCollection)
                    {
                        Console.WriteLine(my.Name+":"+my.Corners.ToString());
                    }
                    var subCollection = (from item in db.GetCollection("MyClass").Linq()
                                    where item.Ratio > 1
                                    select item).ToList();
                    foreach (SubClass subClass in subCollection)
                    {
                        Console.WriteLine(subClass.Name+":"+subClass.Ratio.ToString());
                    }
      
分享到:
10分钟安装mongodb集群教程
本次配置的是学习环境。在学习MongoDB的过程中,64位Win7操作系统下配置了一个集群,顺便将配置过程做成了批处理程序,用于反复的修改配置、安装、卸载,从而加速学习进程。刚学习MongoDB不久,有考虑不周之处,敬请谅解。 目录结构(请下载附件,并使用64位Win7操作系统) driver目录下载地址:http://downloads.mongodb.o...
NoSQL数据库概览及其与SQL语法的比较(1)
【文章摘要】 HBase是一个高可靠性、高性能、面向列、可伸缩的分布式存储系统,同时也是知名的NoSQL数据库之一。NoSQL数据库的产生就是为了解决大规模数据集合多重数据种类带来的挑战,尤其是大数据应用的难题。 本文对NoSQL数据库的定义、分类、特征、当前比较流行的NoSQL数据库系统等进行了简单的介绍,并对N...
  •         php迷,一个php技术的分享社区,专属您自己的技术摘抄本、收藏夹。
  • 在这里……