Couchbase 环境搭建与使用(C#)

Couchbase

Couchbase Server (前身是 Membase) 是一个分布式的面向文档的 NoSQL 数据库管理系统,该系统联合了 CouchDB 的简单和可靠以及 Memcached 的高性能。

安装

下载相应的版本文件 http://www.couchbase.com/nosql-databases/downloads?gtmRefId=FixedCTA-Download#download_form

安装图解转自:http://blog.csdn.net/qq415734794/article/details/7865826

单击setup后跳到http://localhost:8091/index.html

C#使用

Couchbase中创建 Data Bukets 名称为TestA,密码设置为123456

下载 客户端引用  http://packages.couchbase.com/clients/net/1.1/Couchbase-Net-Client-1.1.6.zip 

 static void Main(string[] args)
        {
            var key = "cottrell_brewing-old_yankee_ale"; 
            var clientConfiguration = new CouchbaseClientConfiguration();
            clientConfiguration.Bucket = "TestA";
            clientConfiguration.BucketPassword = "123456";
            clientConfiguration.Urls.Add(new Uri("http://10.4.5.31:8091/pools/default"));
            clientConfiguration.SocketPool.ReceiveTimeout = new TimeSpan(0, 0, 111);
            clientConfiguration.SocketPool.ConnectionTimeout = new TimeSpan(0, 0, 111);
            clientConfiguration.SocketPool.DeadTimeout = new TimeSpan(0, 0, 111);
            var client = new CouchbaseClient(clientConfiguration);
            var result = client.Store(StoreMode.Set, key, "dsfdsf");

            if (result)
            {
                var savedBeer = client.Get(key);
                Console.WriteLine("Found beer: " + savedBeer.ToString());
            }
            Console.Read();
        }

 

posted @ 2015-11-30 17:35  释迦苦僧  阅读(939)  评论(0编辑  收藏  举报