Install MongoDB and C ++ Client

Source: Internet
Author: User
Tags install mongodb

Good

 

Install MongoDB and C ++ client-Vincent's log-Netease blog

Install MongoDB and C ++ Client  

17:40:07| Category:Server| Tag:  |Font Size LargeMediumSmall Subscription

Source: http://hi.baidu.com/kissdev/blog/item/b275a14e9a82d9dcd0c86a57.html

Mongdb is a high-performance and scalable no-SQL database product. It is applicable to key-value query management and relational data management. The operating language is mainly JavaScript, the access interface provides multiple types of interfaces, such as C/C ++/PHP/perl/Python (driver ).

Environment: centos 64-bit

1. Server Installation

# Download the binary server compiled by mongdb

Wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-1.8.1.tgz

Tar xvzf mongodb-linux-x86_64-1.8.1.tgz

Mkdir/trackerdb

CD mongodb-linux-x86_64-1.8.1

# Specify the data directory And start the mongod Server

Bin/mongod -- dbpath/trackerdb -- nohttpinterface

 

2. Client installation

(1) Compile boost

Detach an existing boost

Rpm-e -- allmatches boost-devel

Install and compile boost 1.4.2 through jam

Wget "http://downloads.sourceforge.net/project/boost/boost/1.42.0/boost_1_42_0.tar.bz2? R = http % 3A % 2f % 2fsourceforge.net % 2 fprojects % 2 fboost % 2 ffiles % 2 fboost % 2f1. 42.0% 2f & TS = 1302909648 & use_mirror = cdnetworks-kr-1"

Tar xvjf boost_1_42_0.tar.bz2

CD boost_000042_0

CD tools/JAM

./Build_dist.sh
CD SRC

./Build. Sh

Generate jam

Ll bin. linuxx86_64/bjam

CD ../../../

Tools/JAM/src/bin. linuxx86_64/bjam toolset = GCC variant = debug threading = multi -- with-program_options -- With-filesystem -- with-date_time -- With-thread -- prefix =/usr/local-d + 2

After compilation

CP stage/lib/*/usr/local/lib

CP-r boost/usr/local/include

Ldconfig

(2) download the C ++ driver and compile the example.Program

Wget http://downloads.mongodb.org/cxx-driver/mongodb-linux-x86_64-v1.8-latest.tgz

Tar xvzf mongodb-linux-x86_64-v1.8-latest.tgz

CD mongo-cxx-driver-v1.8/

Scons (you need to install the python make tool scons, yum install scons, which is available on the Dag library in advance)

Libjavasclient. A will be generated

CD client/Examples

G ++-I.../../mongo-L.../clienttest. cpp-l1_client-lboost_thread-lboost_filesystem-lboost_program_options

./Clienttest. The test result is as follows:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.