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: