独立于应用系统和分析系统的日志收集服务器编程
- Scribe从各类数据源上收集数据,放到共享队列上,而后push到后端的中央存储系统上。当中央存储系统出现故障时,scribe能够暂时把日志写到本地文件中,待中央存储系统恢复性能后,scribe把本地日志续传到中央存储系统上。
良好的水平扩展性能后端
- 支持多种编程语言,使用Thrift
- 高性能、低消耗,使用Libevent
- 多种存储格式
- 支持HFDS
- 能够与应用集成
- 灵活的日志缓存大小
- 多线程/消息队列
转发写日志请求缓存
category='test' message='hello world' log_entry = scribe.LogEntry(category, message) socket = TSocket.TSocket(host='localhost', port=1456) transport = TTransport.TFramedTransport(socket) protocol = TBinaryProtocol.TBinaryProtocol(trans=transport, strictRead=False, strictWrite=False) client = scribe.Client(iprot=protocol, oprot=protocol) transport.open() result = client.Log(messages=[log_entry]) transport.close()
$msg1['category'] = 'hello'; $msg1['message'] = 'world'; $entry1 = new LogEntry($msg1); $messages = array($entry1); $socket = new TSocket('183.61.6.104', 1463, true); $transport = new TFramedTransport($socket); $protocol = new TBinaryProtocol($transport, false, false); $scribe_client = new scribeClient($protocol, $protocol); $transport->open(); $exit_code = $scribe_client->Log($messages); $transport->close();
设计服务服务器
- 逻辑处理+请求转发 Nginx Scribe
- 无状态 == 水平扩展性
- Create a service iff required
- Create a common framework and toolset that will allow for easier creation of services
- Use the right language, library and tool for the task