tair官网:
其他
根据 的安装部署文档,自己编译,遇到编译错误。淘宝的人啊,你们都不在其他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 tairsh bootstrap.sh./configure --with-boost=/usr --with-release=yesmake
经过查错,发现错误主要就三个左右,源码上的错误有:
+++ 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+using namespace __gnu_cxx;+using namespace std; namespace tair { typedef hash_map , hash > bucket_server_map;+++ b/src/dataserver/update_log.hpp@@ -22,6 +22,7 @@ #include #include "data_entry.hpp" #include "file_op.hpp"+#include 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 operationcollect2: error: ld returned 1 exit statusmake[2]: *** [tairclient] Error 1make[2]: Leaving directory `/root/Desktop/tair-2.3-update/src/client'make[1]: *** [all-recursive] Error 1make[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的
TODO:如何使用tair-client-java or CPP等
ps:cnblogs会吧 .. \ .. \ 替换为 cnblogs的域名。当然是去掉空格的。