且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

MongoDB C Driver and APIinstances linux MongoDB安装配置

更新时间:2022-09-08 22:26:36

<一,linux平台MongoDB安装配置>在这我们使用的Centos6 yum部署的,你想搞编译,自个干!

MongoDB C Driver and APIinstances linux MongoDB安装配置

无auth,启动mongodb

MongoDB C Driver and APIinstances linux MongoDB安装配置

创建账户

MongoDB C Driver and APIinstances linux MongoDB安装配置

重新开启认证登陆

再此用上次的dbpath启动报如下错误,附上错误解决方法

MongoDB C Driver and APIinstances linux MongoDB安装配置

Ok,搞定

MongoDB C Driver and APIinstances linux MongoDB安装配置

MongoDB C Driver and APIinstances linux MongoDB安装配置

命令行关闭数据库

MongoDB C Driver and APIinstances linux MongoDB安装配置

基于yum部署的mongoDB启动控制脚本保存在/etc/init.d/  只针对RHEL内核系统衍生版本,请自行定位,(其实编译和yum,维护工具孰好孰坏?尺度不同,结果各异)

MongoDB C Driver and APIinstances linux MongoDB安装配置

编译的哥们请用如下控制脚本

MongoDB C Driver and APIinstances linux MongoDB安装配置

<二,主要目标在这,搞定MongoDB C driver API>

1,following guide will step you through the process of downloading, building, and installing the current release of the MongoDB C Driver

 MongoDB C driver下载

wget https://github.com/mongodb/mongo-c-driver/releases/download/0.98.0/mongo-c-driver-0.98.0.tar.gz

Minimal dependencies are needed to build the MongoDB C driver. Optionally,
if you want Kerberos (GSSAPI) or SSL support, you need to install libsasl2 and OpenSSL libraries and development headers respectively



sudo make install or su -c "make install";

MongoDB C Driver and APIinstances linux MongoDB安装配置

<三,MongoDB C API>

offical Doc借鉴瞻仰!

http://api.mongodb.org/c/current/?_ga=1.106192963.110691070.1411522327

http://docs.mongodb.org/manual/reference/connection-string/

Connection String URI Format,Standard Connection String Format,standard URI connection scheme:

mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]

Example:

MongoDB replic set

mongodb://Ruiy1.cc:27017,Ruiy2.cc:7788/?replicaSet=byRuiy
Connection String Options Crrrent pass

Start live Battle
为了保证大家能愉快的在这一块玩耍,请确保你的MongoDB C driver已经正确安装,Ruiy Tip("Action:Behavior",{"be a light sleeper!",,,,,}),见图吧,说多了就是废话了!

MongoDB C Driver and APIinstances linux MongoDB安装配置

1,Example01
emoving a document from a collection

MongoDB C Driver and APIinstances linux MongoDB安装配置

Total Cost Of Ownership

MongoDB C Driver and APIinstances linux MongoDB安装配置

MongoDB C Driver and APIinstances linux MongoDB安装配置

Exec Command

MongoDB C Driver and APIinstances linux MongoDB安装配置

未完待续!

另一警醒篇

http://www.cnblogs.com/ruiy/p/mongoDbStatementBasic.html