ROCKSDB Installation Problem Brief Introduction

Source: Internet
Author: User
Tags virtualenv git clone

Some time ago to prepare test rocksdb, according to the Post and the official website example, during the installation process encountered some problems. Here is the version of Python that is installed under Ubuntu.

First of all, thanks to these posts for my help:

1:http://tech.uc.cn/?p=2592

2:http://bigkun.me/2014/01/22/rocksdb%e7%ac%ac%e4%b8%80%e7%af%87%ef%bc%9a%e5%ae%89%e8%a3%85/

3:http://askubuntu.com/questions/312173/installing-gflags-12-04

4:http://blog.itpub.net/16582684/viewspace-1253841/

5:http://pyrocksdb.readthedocs.org/en/latest/installation.html

Most of the code here comes from link 5 and link 4

First step: You must update Ubuntu g++ and GCC to 4.7 + (with C++11 support)

Give an example (http://lonelyprogram.blog.51cto.com/6246243/1355259)

A. Update GCC without having to remove the original GCC

sudo add-apt-repository ppa:ubuntu-toolchain-r//usr/bin//usr/ bin/gcc-4.8 50

B. Upgrade g++

apt-get Install g++-4.8

C. View version

GCC--versiong+ +--version

Step Two: Install some necessary libraries such as (build-essential libsnappy-dev zlib1g-dev libbz2-dev libgflags-dev)

apt-get install build-essentialapt-get install Libsnappy-dev Zlib1g-dev Libbz2-dev Libgflags-dev

Here are some special instructions on how to install GFlags

Http://askubuntu.com/questions/312173/installing-gflags-12-04 This post has been described in detail, you can operate, here do not repeat.

Step three: Download the installation rocksdb here is a copy installation from GitHub

git clone https://github.com/facebook/rocksdb.gitcd Rocksdb

After that, some files in the rocksdb need to be modified

+ =-o2-fno-omit-frame-pointer-momit-leaf-frame-+ =-o2-lrt-fno-omit-frame-pointer-momit-leaf-frame-  pointer in ~/. BASHRC Add export ld_preload=/lib/x86_64-linux-gnu/ Librt.so.1, and make the variable effective source ~/"undefined symbol:clock_gettime")
sudo git checkout 2.8Fbsudo make shared_lib Modify environment variables, header and link libraries and paths (directly in terminal input) $ export Cplus_include_path=${ Cplus_include_path}: ' pwd '/include$ export ld_library_path=${ld_library_path}: ' pwd ' $ export LIBRARY _path=${library_path}: ' pwd '

Specify user rights, create DATABASE (Shuren is user name)

-RFCD Rocksdb

Take the next three steps to solve the problem " Fatal error:rocksdb/slice.h:no such file or directory"

/usr/local//usr/local/include/rocksdb/  -R. /include//usr/local/include/

Above, the database installation is successful.

Fourth Step: Install Pyrocksdb ()

$ apt-get install python-virtualenv python-dev$ virtualenv pyrocks_test$ cd pyrocks_test$. Bin/
    "cython>=0.20"$ pip install git+git://Github.com/stephan-hof/pyrocksdb.git 

This pyrocksdb installation is successful, test the database

[Email protected]:/U01/rocksdb$ Pythonpython2.7.3 (default, Sep 26 2013, 20:03:06) [GCC4.6.3] on Linux2type"Help","Copyright","Credits"Or"License"  forMore information.>>>ImportRocksdb>>> db = Rocksdb. DB ("Test.db", Rocksdb. Options (create_if_missing=True))>>> Db.put (b"Key1"B"V1") >>> Db.put (b"Key2"B"V2")>>> db.Get(b"Key1")' v1 '>>>del DB

The last sentence is to close the connection.

So, you can basically use the database, specific detailed operation see http://pyrocksdb.readthedocs.org/en/latest/tutorial/index.html

ROCKSDB Installation Problem Brief Introduction

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.