安装失败
troycheng opened this issue · 11 comments
多次尝试,均是失败在:
chmod: 无法访问"thirdparty/tars/tools/tars2cpp": 没有那个文件或目录
日志输出如下:
[root@rdqa-ocr-3-69 build]# python tseer_deploy.py
[INFO] 2018-06-12 18:53:31 Starting deploy tars...
[INFO] 2018-06-12 18:53:31 Deploy tars success!
[INFO] 2018-06-12 18:53:31 Starting deploy tseer...
[INFO] 2018-06-12 18:53:31 Starting install etcd...
[ERROR] 2018-06-12 18:55:28 check etcd failed, see log /home/data/tseer/etcd//log
[INFO] 2018-06-12 18:53:31 Starting resolve dependency...
[INFO] 2018-06-12 18:55:28 resolve depedency rapidjson...
[SUCC] 2018-06-12 18:55:28 Successfully resolve dependency
[INFO] 2018-06-12 18:53:31 Starting build tseer...
[INFO] 2018-06-12 18:59:12 start build tseer...
chmod: 无法访问"thirdparty/tars/tools/tars2cpp": 没有那个文件或目录
[ERROR] 2018-06-12 18:59:12 make install seer failed, see log tseer_make.log.
另外,check etcd failed是缺少 etcd 的 bin 文件,第一次成功之后,清空环境重新执行脚本,每次都会出现这个错误
查看安装脚本是因为默认 gcc 版本较低为4.4.7,更换高版本 gcc 4.8.3解决,因为编译选项中使用了-std=c++11。
那么,文档中要求的 gcc 4.1.2及以上即可,这个是否需要更改呢?
另外,在 tars 没有实际编译成功的时候,脚本返回 Deploy tars success! 也是有问题的
解决了 tars 的编译问题,继续执行脚本,在 tseer 的编译中又出现了问题,这回是缺失文件,日志如下:
-- Configuring done
-- Generating done
-- Build files have been written to: /home/tcheng/tools/TSeer
[ 8%] Built target TSEERSERVER_TARS_HEADER
[ 10%] Building CXX object TseerServer/src/CMakeFiles/TseerServer.dir/StoreProxy.cpp.o
[ 11%] Building CXX object TseerServer/src/CMakeFiles/TseerServer.dir/EtcdDataCache.cpp.o
[ 12%] Building CXX object TseerServer/src/CMakeFiles/TseerServer.dir/MysqlHandle.cpp.o
[ 14%] Building CXX object TseerServer/src/CMakeFiles/TseerServer.dir/QueryImp.cpp.o
[ 15%] Building CXX object TseerServer/src/CMakeFiles/TseerServer.dir/reg_roll_logger.cpp.o
[ 17%] Building CXX object TseerServer/src/CMakeFiles/TseerServer.dir/RequestEtcdCallback.cpp.o
[ 18%] Building CXX object TseerServer/src/CMakeFiles/TseerServer.dir/ApiRegImp.cpp.o
[ 20%] Building CXX object TseerServer/src/CMakeFiles/TseerServer.dir/EtcdHandle.cpp.o
[ 21%] Building CXX object TseerServer/src/CMakeFiles/TseerServer.dir/EtcdHost.cpp.o
[ 22%] Building CXX object TseerServer/src/CMakeFiles/TseerServer.dir/BaseHandle.cpp.o
[ 24%] Building CXX object TseerServer/src/CMakeFiles/TseerServer.dir/TSeerServer.cpp.o
[ 25%] Building CXX object TseerServer/src/CMakeFiles/TseerServer.dir/StoreCache.cpp.o
[ 27%] Building CXX object TseerServer/src/CMakeFiles/TseerServer.dir/ReapThread.cpp.o
In file included from /home/tcheng/tools/TSeer/TseerServer/src/ReapThread.cpp:18:0:
/home/tcheng/tools/TSeer/TseerServer/src/FileWriterFactory.h:58:13: 错误:‘TC_Functor’不是一个类型名
typedef TC_Functor<uint32_t, TL::TLMaker<const string &>::Result> hash_functor;
^
/home/tcheng/tools/TSeer/TseerServer/src/FileWriterFactory.h:76:5: 错误:‘hash_functor’不是一个类型名
hash_functor _hashf;
^
/home/tcheng/tools/TSeer/TseerServer/src/FileWriterFactory.h: 在成员函数‘tars::TC_ThreadRecLock* FileWriterFactory::getRecLock(const FileTask&)’中:
/home/tcheng/tools/TSeer/TseerServer/src/FileWriterFactory.h:63:47: 错误:‘_hashf’在此作用域中尚未声明
size_t hashcode = _hashf(task.filePath);
^
make[2]: *** [TseerServer/src/CMakeFiles/TseerServer.dir/ReapThread.cpp.o] 错误 1
make[1]: *** [TseerServer/src/CMakeFiles/TseerServer.dir/all] 错误 2
make: *** [all] 错误 2
[ 8%] Built target TSEERSERVER_TARS_HEADER
[ 10%] Building CXX object TseerServer/src/CMakeFiles/TseerServer.dir/ReapThread.cpp.o
In file included from /home/tcheng/tools/TSeer/TseerServer/src/ReapThread.cpp:18:0:
/home/tcheng/tools/TSeer/TseerServer/src/FileWriterFactory.h:58:13: 错误:‘TC_Functor’不是一个类型名
typedef TC_Functor<uint32_t, TL::TLMaker<const string &>::Result> hash_functor;
^
/home/tcheng/tools/TSeer/TseerServer/src/FileWriterFactory.h:76:5: 错误:‘hash_functor’不是一个类型名
hash_functor _hashf;
^
/home/tcheng/tools/TSeer/TseerServer/src/FileWriterFactory.h: 在成员函数‘tars::TC_ThreadRecLock* FileWriterFactory::getRecLock(const FileTask&)’中:
/home/tcheng/tools/TSeer/TseerServer/src/FileWriterFactory.h:63:47: 错误:‘_hashf’在此作用域中尚未声明
size_t hashcode = _hashf(task.filePath);
^
make[2]: *** [TseerServer/src/CMakeFiles/TseerServer.dir/ReapThread.cpp.o] 错误 1
make[1]: *** [TseerServer/src/CMakeFiles/TseerServer.dir/all] 错误 2
make: *** [all] 错误 2
看日志是缺少声明,搜索得知,TC_Functor原本是在 tars/include/util/tc_functor.h 这个文件里定义的,但查看下载的 tars 包里面,并没有这个文件,查看 Tars 的 master 里面也没有,在 tags 里看,V1.4.0和V1.3.0里面有这个文件,但 master 里并没有……
....
从 V1.4.0版本里面 copy 了 tc_functor.h及其依赖的头文件tc_toki.h,放到tars/include/util目录下,在文件TseerServer/src/FileWriterFactory.h里面添加include后这部分编译通过,紧接着编译其它项目()又遇到未添加-std=c++11选项,将对应CMakeLists.txt的
set(CMAKE_CXX_FLAGS "-g -O2 -Wall -Wno-deprecated")
改为:
set(CMAKE_CXX_FLAGS "-std=c++11 -g -O2 -Wall -Wno-deprecated")
可以继续编译,再接着编译,又遇到std::make_pair 类型推导的问题:
/home/tcheng/tools/TSeer/TseerAgent/src/HeartBeatReportThread.cpp:112:102: 错误:对‘make_pair(std::string, std::string&)’的调用没有匹配的函数
apiKeyContext.insert(std::make_pair<string, string>(std::string("KEY_INFO"), keys));
^
/home/tcheng/tools/TSeer/TseerAgent/src/HeartBeatReportThread.cpp:112:102: 附注:备选是:
In file included from /usr/local/include/c++/4.8.3/bits/stl_algobase.h:64:0,
from /usr/local/include/c++/4.8.3/bits/char_traits.h:39,
from /usr/local/include/c++/4.8.3/string:40,
from /usr/local/include/c++/4.8.3/stdexcept:39,
from /home/tcheng/tools/TSeer/thirdparty/tars/include/util/tc_ex.h:20,
from /home/tcheng/tools/TSeer/thirdparty/tars/include/util/tc_thread.h:23,
from /home/tcheng/tools/TSeer/TseerAgent/src/HeartBeatReportThread.h:20,
from /home/tcheng/tools/TSeer/TseerAgent/src/HeartBeatReportThread.cpp:17:
/usr/local/include/c++/4.8.3/bits/stl_pair.h:276:5: 附注:template<class _T1, class _T2> constexpr std::pair<typename std::__decay_and_strip<_Tp>::__type, typename std::__decay_and_strip<_T2>::__type> std::make_pair(_T1&&, _T2&&)
make_pair(_T1&& __x, _T2&& __y)
^
/usr/local/include/c++/4.8.3/bits/stl_pair.h:276:5: 附注: template argument deduction/substitution failed:
原因是std::make_pair 会根据参数自动推导类型,而显式指定参数类型为<string, string>后,根据传入的参数,std::make_pair 会认为参数类型是两个右值引用,而 keys 是个左值,因此出错,修改办法是去掉显示的声明,将TseerAgent/src/HeartBeatReportThread.cpp:112行更改为:
apiKeyContext.insert(std::make_pair("KEY_INFO", keys));
编译通过
至此,整个编译才能顺利进行,还没运行使用,如有问题再来补充
编译通过,服务也都启起来了,但使用起来还是有不少不清不楚的地方,希望示例能够在完善一些,细节方面能够打磨的更完善一下,比如:web 界面为何不能设置 idc?查看etcd日志里面提示
{"errorCode":100,"message":"Key not found","cause":"/idc_rule","index":3656}
这个在哪里设置?
心跳超时连接一开启所有添加的实例都是 inactive,这个是agent 的心跳包还是客户端调用接口回报的?
等等一系列实际使用中的问题
过了一晚 TSeerServer 自己 Core 了:
(gdb) bt
#0 0x00007f95ce5ccec5 in _IO_vfscanf_internal () from /lib64/libc.so.6
#1 0x00007f95ce5e1685 in vsscanf () from /lib64/libc.so.6
#2 0x00007f95ce5db6e8 in sscanf () from /lib64/libc.so.6
#3 0x00007f95ce615152 in __tzset_parse_tz () from /lib64/libc.so.6
#4 0x00007f95ce61632e in __tzfile_compute () from /lib64/libc.so.6
#5 0x00007f95ce615cb7 in __tz_convert () from /lib64/libc.so.6
#6 0x000000000046eba1 in tars::TC_Logger<tars::RollWriteT, tars::TC_RollBySize>::stream(int) ()
at /home/tcheng/tools/TSeer/thirdparty/tars/include/util/tc_logger.h:727
#7 0x000000000046ed3e in tars::TC_Logger<tars::RollWriteT, tars::TC_RollBySize>::debug() ()
at /home/tcheng/tools/TSeer/thirdparty/tars/include/util/tc_logger.h:689
#8 0x00000000004957ec in RequestEtcdCallback::responseClient(int, long, std::vector<Tseer::RouterData, std::allocatorTseer::RouterData > const&) () at /home/tcheng/tools/TSeer/TseerServer/src/RequestEtcdCallback.cpp:1299
#9 0x00000000004a1b8c in RequestEtcdCallback::onResponse(bool, tars::TC_HttpResponse&) ()
at /home/tcheng/tools/TSeer/TseerServer/src/RequestEtcdCallback.cpp:168
#10 0x0000000000609a81 in tars::TC_HttpAsync::AsyncRequest::doReceive() ()
at /home/tcheng/tools/TSeer/build/Tars/cpp/util/src/tc_http_async.cpp:264
#11 0x0000000000609be1 in tars::TC_HttpAsync::process(tars::TC_AutoPtrtars::TC_HttpAsync::AsyncRequest&, int) ()
at /home/tcheng/tools/TSeer/build/Tars/cpp/util/src/tc_http_async.cpp:462
#12 0x0000000000609d2d in tars::TC_HttpAsync::run() () at /home/tcheng/tools/TSeer/build/Tars/cpp/util/src/tc_http_async.cpp:505
#13 0x0000000000610acf in tars::TC_ThreadPool::ThreadWorker::run() ()
at /home/tcheng/tools/TSeer/build/Tars/cpp/util/src/tc_thread_pool.cpp:60
#14 0x00000000005f7e7a in tars::TC_Thread::threadEntry(tars::TC_Thread*) ()
at /home/tcheng/tools/TSeer/build/Tars/cpp/util/src/tc_thread.cpp:93
#15 0x00007f95cf0b6aa1 in start_thread () from /lib64/libpthread.so.0
#16 0x00007f95ce660aad in clone () from /lib64/libc.so.6
@loveyacper 可否抽空看一下,是哪一块儿的问题?
我看下,之前的问题是由于tars提升到cpp11,这边没有同步更新导致;
core问题我看下,这里可能是收到非法http数据,不健壮导致
你也可以把之前修正推一个PR,非常欢迎
心跳是业务服务方的,一般是默认不开启的,意思是对第三方服务零侵入;
而容错和负载均衡是在agent做的,用户通过ApiRouteResultUpdate反馈给agent调用结果,agent根据调用成功失败最终决定是否屏蔽节点。
感谢推送!
依赖的是tc_loki吧。。