High-performance nosql database Kyoto cabinet Installation notes

Source: Internet
Author: User
Tags gmp

Http://fallabs.com/kyotocabinet/ official website Introduction

Kyoto cabinet is a library of key-value database management programs. Both key and value can be in binary or string format. Data storage is divided into hash and B + tree modes.

Kyoto cabinet is very fast. In hash mode, it takes 1 million seconds to insert 0.9 data, and 1.1 seconds to insert data in B + tree mode. It takes only one second to query 2 million data records. In addition, the data files of Kyoto cabinet occupy a very small amount of space. The scalability of Kyoto cabinet is also very good, and the database file can reach 8 EB. (1 EB = 1024 Pb, 1 Pb = Tb ). This is much larger than bdb's ability to manage TB of data.

Kyoto cabinet API.

  • API documents of the core library (C/C ++)
  • API documents for Java
  • API documents for python 3.x
  • API documents for python 2.x
  • API documents for Ruby
  • API documents for Perl
  • API documents for Lua
  • Kyoto cabinet:

    1. The file occupies less space.

    2. The performance is better under multiple threads. The author said that the performance of Tokyo cabinet in a single thread is better.

    3. Support for Windows

    The author is very powerful and also provides Kyoto tyrant's network interface Kyoto tycoon.

    If there are so many advantages, we plan to install it. The installation environment is centos5.5 32-bit.

    The installation procedure is as follows:

     

    Wget http://fallabs.com/kyotocabinet/pkg/kyotocabinet-1.2.25.tar.gz

    Tar zxvf kyotocabinet-1.2.25.tar.gz

     

     

     

    CD kyotocabinet-1.2.25

    ./Configure

    Make

    The result is a compilation error during the make process. Check the official installation instructions.

    Kyoto cabinet is available on Unix-like systems. At least, the following environments are supported.

    • Linux 2.6 and later (i386/x86-64/PowerPC/alpha/iSCSI)
    • FreeBSD 7.1 and later (i386/x86-64)
    • Solaris 10 and later (i386/x86-64/iSCSI)
    • Mac OS X 10.5 and later (x86-64)
    • Windows XP and later (i386/x86-64)

    gcc(GNU Compiler Collection) 4.2 or later andmake(GNU make) are required to install Kyoto cabinet with the source package. They are installed by default on Linux, FreeBSD and so on.

    As Kyoto cabinet depends on the following libraries, install them beforehand.

    • Zlib: For loss-less data compression. 1.2.3 or later is required.

    It turns out that the GCC version must be 4.2 or later.

    Check whether the GCC gcc-V Report version of centos5.5 is GCC 4.1.2. No wonder the report is incorrect.

    Install zlib Yum-y install zlib-devel first

    Then, we upgraded GCC and downloaded a gcc4.5.1 file from the Internet.

    An error occurs during GCC configuration: GCC configure: Error: Building GCC requires GMP 4.2 +, mpfr 2.3.1 + and MCM 0.8.0 +

    Note: To install GCC, you need to install the GMP, mpfr, and MPC libraries. You can download the corresponding compressed packages from ftp://gcc.gnu.org/pub/gcc/infrastructure. Since mpfr depends on GMP, while nmms depends on GMP and mpfr, it is necessary to install GMP first, followed by mpfr, and finally the nmms. Here, the three libraries are available in gmp4.3.2, mpfr2.4.2, and mpc0.8.1.

    Install GMP first. Decompress the GMP compressed package, get the source code directory gmp-4.3.2. Create a temporary compilation directory under the directory of the same level. Name it GMP-build. Then, configure the installation options, go to the GMP-build directory, and enter the following command for Configuration:

    ../Gmp-4.3.2/configure -- prefix =/usr/local/gmp-4.3.2

    Here the -- prefix option indicates where the library is to be installed, and I install it in the/usr/local/gmp-4.3.2 Directory, which will be used in subsequent installations.

    At this time, a MAKEFILE file will be generated under the GMP compilation directory, and compilation and installation will begin now.

    Make

    Make check

    Make install

    In this way, the GMP has been installed. The method for installing mpfr and nmpc is similar. Note that the dependency option should be added during configuration. The configuration commands for the following two libraries are as follows:

    ../Mpfr-2.4.2/configure -- prefix =/usr/local/mpfr-2.4.2 -- With-GMP =/usr/local/gmp-4.3.2

    ../Mpc-0.8.1/configure -- prefix =/usr/local/mpc-0.8.1 -- With-GMP =/usr/local/gmp-4.3.2 -- With-mpfr =/usr/local/mpfr-2.4.2

    After these three libraries are installed, you can officially start to install GCC.

    As before, first create a temporary gcc-build directory for compiling GCC, and then configure the installation options:

    ../Gcc-4.5.0/configure -- prefix =/usr/local/gcc-4.5.0 -- enable-threads = POSIX -- disable-checking -- disable-multilib -- enable-classes ages = C, C ++

    -- With-GMP =/usr/local/gmp-4.3.2 -- With-mpfr =/usr/local/mpfr-2.4.2 -- With-MPC =/usr/local/mpc-0.8.1

    There are many GCC configuration options. For details, refer to the installation instructions under the GCC source file directory. Only the C and C ++ compilers are installed here. (If the compilation language is not specified, it will fail during make, and some files cannot be found and other errors are reported. Therefore, we recommend that you specify the compilation language as C, C ++) then start make compilation. To be safe, you must add the location of the first three libraries in the environment variable LD_LIBRARY_PATH. type the following command:

    Export LD_LIBRARY_PATH = $ LD_LIBRARY_PATH:/usr/local/mpc-0.8.1/lib:/usr/local/gmp-4.3.2/lib:/usr/local/mpfr-2.4.2/lib

    Then re-make the compilation. After a long wait hour, the compilation is completed. This step is also available in the installation instructions, but it is optional. Directly install make install. Now GCC is fully installed. However, the new version of GCC cannot be used yet, because the new version of executable files have not been added to the command search path. Here I have created a soft link for the new GCC and G ++ commands. Enter the/usr/bin directory and type the following command to create a soft link.

    Sudo ln-S/usr/local/gcc-4.5.0/bin/GCC gcc

    Sudo ln-S/usr/local/gcc-4.5.0/bin/g ++

    Of course, the GCC and G ++ commands in the/usr/bin directory are directly linked to the new version of the GCC executable file. Before using the SDK, you have to add the paths of the preceding three libraries to the environment variable LD_LIBRARY_PATH. Otherwise, an error occurs during program compilation. Because I don't want to generate environment variables every time I compile the program, I need to edit the bashrc file in the/etc directory to configure the shell environment. Add the following statement to the file:

    LD_LIBRARY_PATH =:/usr/local/mpc-0.8.1/lib:/usr/local/gmp-4.3.2/lib:/usr/local/mpfr-2.4.2/lib:/usr/local/gcc-4.5.0/lib

    Export LD_LIBRARY_PATH

    After saving and restarting the system, you can use the newly installed GCC.

    Check the GCC version 4.5.1 In the GCC-V report after installing GCC.

    Then continue to install kyotocabinet

    Make & make install no errors reported this time

    Everything is successfully installed

    Next we will test the installation result.

     

    Create database commands

    $ kchashmgr create staffs.kch

    The result System reports an error again.

    Kchashmgr:/usr/lib/libstdc ++. so.6: Version 'glibcxx _ 3.4.9 'not found (required by kchashmgr)
    Kchashmgr:/usr/lib/libstdc ++. so.6: Version 'glibcxx _ 3.4.14 'not found (required by kchashmgr)
    Kchashmgr:/usr/lib/libstdc ++. so.6: Version 'glibcxx _ 3.4.11 'not found (required by kchashmgr)
    Kchashmgr:/usr/lib/libstdc ++. so.6: Version 'glibcxx _ 3.4.9 'not found (required by/usr/local/lib/libkyotocabinet. so.6)
    Kchashmgr:/usr/lib/libstdc ++. so.6: Version 'glibcxx _ 3.4.10 'not found (required by/usr/local/lib/libkyotocabinet. so.6)
    Kchashmgr:/usr/lib/libstdc ++. so.6: Version 'glibcxx _ 3.4.14 'not found (required by/usr/local/lib/libkyotocabinet. so.6)
    Kchashmgr:/usr/lib/libstdc ++. so.6: Version 'glibcxx _ 3.4.11 'not found (required by/usr/local/lib/libkyotocabinet. so.6)
    Why did Google use libstdc ++. so.6?

    Runls -l  /usr/lib/libstdc++. So.6
    Found
    /Usr/lib/libstdc ++. so.6->/usr/lib/libstdc ++. so.6.0.8. In fact, libstdc ++. so.6.0.10 must be used here.
    Download this file from the Internet, for the http://d.download.csdn.net/down/1670346/wwuu2010 and then delete the/usr/lib/libstdc ++. so.6->/usr/lib/libstdc ++. so.6.0.8 soft link, and re-do
    Ln-S/usr/lib/libstdc ++. so.6.10/usr/lib/libstdc ++. so.6

     

    Test again.

     

    It is not necessary to install Ubuntu server because the default GCC version is 4.4.5.

    You only need to install zlib.

    Sudo apt-Get install Zlib1g-Dev

     

    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.