獨立於應用系統和分析系統的日誌收集服務器編程
- 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