页首Html代码

返回顶部

ubuntu或者fedora下编译淘宝tair key-value-db的开源内存数据库

你看到的这个文章来自于http://www.cnblogs.com/ayanmw

tair官网:http://tair.taobao.org/

其他 http://www.oschina.net/p/tair

根据http://code.taobao.org/p/tair/wiki/index/ 的安装部署文档,自己编译,遇到编译错误。淘宝的人啊,你们都不在其他linux下测试吗?弱智错误。

淘宝tair一般都是在centos下编译安装的,在fedora ubuntu下编译都有错误。

    • 确保安装了automake autoconfig 和 libtool,使用automake --version查看,一般情况下已安装
    • 获得底层库 tbsys 和 tbnet的源代码:(svn checkout http://code.taobao.org/svn/tb-common-utils/trunk/ tb-common-utils).
    • 获得tair源代码:(svn checkout http://code.taobao.org/svn/tair/trunk/ tair).
    • 安装boost-devel库,在用rpm管理软件包的os上可以使用rpm -q boost-devel查看是否已安装该库
cd tair

sh bootstrap.sh

./configure --with-boost=/usr --with-release=yes

make

经过查错,发现错误主要就三个左右,源码上的错误有:

复制代码
+++ b/src/common/data_entry.hpp
@@ -28,6 +28,9 @@ namespace tair
 {
    namespace common {
       using namespace tair::util;
+      using namespace std;
+      using namespace __gnu_cxx;
+      
       class data_entry {
       public:
          data_entry()




+++ b/src/configserver/server_info.hpp
@@ -25,6 +25,7 @@
 namespace tair {
   namespace config_server {
     using namespace std;
+    using namespace __gnu_cxx;
     class node_info;
     class group_info;
 #pragma pack(1)




+++ b/src/dataserver/table_manager.hpp
@@ -27,6 +27,8 @@
 
 #include <boost/dynamic_bitset.hpp>
 
+using namespace __gnu_cxx;
+using namespace std;
 namespace tair {
 
    typedef hash_map<int, vector<uint64_t>, hash<int> > bucket_server_map;





+++ b/src/dataserver/update_log.hpp
@@ -22,6 +22,7 @@
 #include <tbsys.h>
 #include "data_entry.hpp"
 #include "file_op.hpp"
+#include <stddef.h>
 
 namespace tair {
    using namespace tair::storage::fdb;




+++ b/src/storage/mdb/mem_cache.hpp
@@ -26,6 +26,8 @@
 #include "mem_pool.hpp"
 #include "tblog.h"
 #include "mdb_define.hpp"
+using namespace std;
+using namespace __gnu_cxx;
 namespace tair {
 #pragma pack(1)
   struct mdb_item
复制代码

缺少namespace导致提示vector和hash_map是未定义的,我无语,centos和fedora下的g++就差别这么大么?

还有一个错误,在编译的时候 到src/client/的时候出现错误

复制代码
/bin/sh .. / .. /libtool --tag=CXX   --mode=link g++  -O2 -finline-functions -Wall -DBOOST_SPIRIT_THREADSAFE -D__USE_LARGEFILE64 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -lpthread -lz -L/usr/lib -lboost_thread-mt    -o tairclient tair_client.o libtairclientapi.la /usr/lib/libtbnet.a /usr/lib/libtbsys.a   
libtool: link: g++ -O2 -finline-functions -Wall -DBOOST_SPIRIT_THREADSAFE -D__USE_LARGEFILE64 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -o .libs/tairclient tair_client.o  -L/usr/lib ./.libs/libtairclientapi.so -lpthread -lz -lboost_thread-mt /usr/lib/libtbnet.a /usr/lib/libtbsys.a -Wl,-rpath -Wl,/root/tair_bin/lib
/usr/bin/ld: skipping incompatible /usr/lib/libboost_thread-mt.so when searching for -lboost_thread-mt
/usr/bin/ld: /usr/lib/libtbsys.a(tbtimeutil.o): undefined reference to symbol 'clock_gettime@@GLIBC_2.2.5'
/usr/bin/ld: note: 'clock_gettime@@GLIBC_2.2.5' is defined in DSO /lib64/librt.so.1 so try adding it to the linker command line
/lib64/librt.so.1: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make[2]: *** [tairclient] Error 1
make[2]: Leaving directory `/root/Desktop/tair-2.3-update/src/client'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/Desktop/tair-2.3-update/src'
make: *** [all-recursive] Error 1
复制代码

还有fedora有提示 clock_gettime是在库/usr/lib64/librt.so.1 只要添加这个库就到src/client/Makefile的 CXXFLAGS= 后面,也可以添加-lrt 即可。

编译总算是完成了。

make install 后安装到~/tair_bin/

然后修改etc目录下的 

configserver.conf dataserver.conf group.conf

sbin/tair_server -f etc/dataserver.conf

sbin/tair_cfg_srv -f etc/configserver.conf

就可以运行服务了。结束服务根据 tair_bin/tair.sh 里面的内容,可以知道怎么结束:kill `cat logs/server.pid`

TODO:关于如何使用tair-server 开始探讨

 

淘宝tair的运行方式,其实我感觉跟mongodb redis mysql 都一样,都是运行一个独立的服务器,然后通过客户端连接的。跟我之前接触的leveldb不同,leveldb没有提供这种方式,而是直接嵌入代码,直接执行代码。

tair的客户端有许多语言的支持,这里只说下java的

http://code.taobao.org/p/tair-client-java/src/

TODO:如何使用tair-client-java or CPP等

 

ps:cnblogs会吧 .. \ .. \ 替换为 cnblogs的域名。当然是去掉空格的。

 

转载请注明出处:http://www.cnblogs.com/ayanmw 我会很高兴的!

posted @   ayanmw  阅读(2207)  评论(0编辑  收藏  举报
编辑推荐:
· .NET制作智能桌面机器人:结合BotSharp智能体框架开发语音交互
· 软件产品开发中常见的10个问题及处理方法
· .NET 原生驾驭 AI 新基建实战系列:向量数据库的应用与畅想
· 从问题排查到源码分析:ActiveMQ消费端频繁日志刷屏的秘密
· 一次Java后端服务间歇性响应慢的问题排查记录
阅读排行:
· 互联网不景气了那就玩玩嵌入式吧,用纯.NET开发并制作一个智能桌面机器人(四):结合BotSharp
· Vite CVE-2025-30208 安全漏洞
· 《HelloGitHub》第 108 期
· MQ 如何保证数据一致性?
· 一个基于 .NET 开源免费的异地组网和内网穿透工具
历史上的今天:
2012-05-02 Oracle11g之用户密码过期与修改用户密码|ArcSDE10因oracle用户密码过期而无法连接oracle数据库问题的解决

页脚Html代码

点击右上角即可分享
微信分享提示