Fluentd in Co-Work

61
Fluentd in Fluentd meetup in Fukuoka 2013/03/07 @Spring_MT

description

 

Transcript of Fluentd in Co-Work

Page 1: Fluentd in Co-Work

     Fluentdin

Fluentd  meetup  in  Fukuoka2013/03/07@Spring_MT

Page 2: Fluentd in Co-Work

Profiletwitter : @Spring_MTCompany : 10xLabEngineer

Page 3: Fluentd in Co-Work

Agenda

Fluentdin Co-Work appin Co-Work infra

Page 4: Fluentd in Co-Work
Page 5: Fluentd in Co-Work

SNS for Companies (like Yammer)During Closed β

Page 6: Fluentd in Co-Work
Page 7: Fluentd in Co-Work

InfraArchitecture

Page 8: Fluentd in Co-Work

10xlab  InfraALL AWS!Use VPCRuby, Fluentd and Chef in all serversgem install fluentd

Page 9: Fluentd in Co-Work

public

subnetCo-Work

subnetutility

APP

redis

worker

subnetstorage

subnetfluentd

deliver

worker

proxy

varnish+

sinatra

f f f

f f

f f

Watch

subnetnetwork

Gateway NATSSLの変換

f

f

f

f

f

f

f

f fluentd

DB(MySQL on EC2)

Page 10: Fluentd in Co-Work

Co-WorkWAFRuby on Rails

DBMySQL on EC2

KVSredis

Page 11: Fluentd in Co-Work

Fluentdin

Co-Work  App

Page 12: Fluentd in Co-Work

App

QueuingLogging

Page 13: Fluentd in Co-Work

Queuing

Page 14: Fluentd in Co-Work

QueuingResqueRuby based job queue liblary using githubMultiprocessingBackend is redis

https://github.com/defunkt/resque

Page 16: Fluentd in Co-Work

Why  Fluentd?

Page 17: Fluentd in Co-Work

app

app

app

workerworkerworkerworker

workerworkerworkerworker

workerworkerworkerworker

queueworker

queueworker

resque

resque

Page 18: Fluentd in Co-Work

app

worker

worker

worker

worker X

You write a retry processing?

If queing fail, App should retry queuing.

Page 19: Fluentd in Co-Work

app

app

appworkerworkerworkerworker

workerworkerworkerworker

workerworkerworkerworker

queueworker

queueworker

fl u ent-resque

resque

fl u ent-logger

Page 20: Fluentd in Co-Work

appworkerworkerworkerworker X X

If queuing fail, Fluentd retry queuing !Fluentd(and Logger)Buffering internallyRetrying

Page 21: Fluentd in Co-Work

Send  Queue  Data  to  Fluentd

Page 22: Fluentd in Co-Work
Page 23: Fluentd in Co-Work

Send  Resque-Queue  to  Redis

Page 24: Fluentd in Co-Work
Page 25: Fluentd in Co-Work

BreaK

http://photo.v-colors.com/2111.html

Page 26: Fluentd in Co-Work

Logging

Page 27: Fluentd in Co-Work

LoggingAccess log(nginx)PV log(rails)Ref. WEB†DB PRESS vol.

App Log(rails)

Page 28: Fluentd in Co-Work

Why  Fluentd?

Page 29: Fluentd in Co-Work

Log  FileTransferForwarding server is full m9(^Д^)プギャー

Operate transfer script?

Real-Time analysis ?

Delete log file

Page 30: Fluentd in Co-Work

Log  FileFormat and AnalysisDisjointed format (CSV? TSV? LTSV? JSON?)

Operate analysis script?

Page 31: Fluentd in Co-Work

FluentdUnified Format(JSON)Real-Time transfer and High AvailabilityEasy Setup and Easy extensionWell Tested At Big services(○HN, ○ookpad)

Page 32: Fluentd in Co-Work

Just  Do  It  !

http://d.hatena.ne.jp/tagomoris/20121029/1351491111

Page 33: Fluentd in Co-Work

Just  Do  It  !

http://d.hatena.ne.jp/tagomoris/20121029/1351491111

今でしょ

Page 34: Fluentd in Co-Work

deliver

Web Server

Web Server

Web Server

Fluentd(

Fluentd(

Fluentd(

Deriver&Fluentd&Server�

Deriver&Fluentd&Server&

(standby)�

Worker(Fluentd(Server�

Worker(Fluentd(Server�

Worker(Fluentd(Server�

Archive(Fluentd(Server�

Worker(Fluentd(Server� Resque�

File�

out_forward�

out_forward�

in_tail�

out_forward�

proxyaccess log

in_tail

appPV log

in_tail

app log logger

GrowthForecast

S3

Page 35: Fluentd in Co-Work

Analysis

Page 36: Fluentd in Co-Work

copyout_route

fluent-plugin-rewrite-tag-filter

analysisfluent-plugin-datacounter

fluent-plugin-numeric-counter

fluent-plugin-numeric-monitor

fluent-plugin-amplifier-filter

Page 37: Fluentd in Co-Work

Output

Page 38: Fluentd in Co-Work

GrowthForecastfluent-plugin-growthforecast

For visualize data

GrowthForecast

Web API for drawing graph

Perl

Page 39: Fluentd in Co-Work
Page 40: Fluentd in Co-Work
Page 41: Fluentd in Co-Work

Treasure  Data

TreasureData

Hadoop-based data store and analysis service

fluent-plugin-td

For data analysis (mainly access log)

Page 42: Fluentd in Co-Work
Page 43: Fluentd in Co-Work

S3

S3

Data Store Service in AWS

Eleven Nine

fluent-plugin-s3

For backup logs

Page 44: Fluentd in Co-Work

ikachan

ikachan

Web API for IRC

Perl

fluent-plugin-ikachan

IRC notification(Ex.fatal log)

Page 45: Fluentd in Co-Work
Page 46: Fluentd in Co-Work

Analysis  in  TDSQL Like500 GB ($299/M)Analysis using Ruby!

Page 47: Fluentd in Co-Work
Page 48: Fluentd in Co-Work
Page 49: Fluentd in Co-Work
Page 50: Fluentd in Co-Work

CollectLib

Page 51: Fluentd in Co-Work

Fluentdin

Co-Work  Infra

Page 52: Fluentd in Co-Work

WatchFor resource watchFluentd collect data and push data each notification tools.

Page 53: Fluentd in Co-Work

fluent-plugin-mysqlslowquery

Collect mysql slow query logNotify IRC through fluent-plugin-ikachan + ikachan

Page 54: Fluentd in Co-Work
Page 55: Fluentd in Co-Work

fluent-resque-stat

Collect Resque statuspending キューの残数

processed 取り出したキューの総数

queues 登録されてるキューの名前の総数

workers キューを取り出すworkerの数

working キューを処理中のworker数

failed 失敗したキュー数

servers resqueが動いてるサーバーのhostやportの情報

environmentresque_statが動いているサーバーの RAILS_ENV or

RACK_ENV(なければdevelopmentが入る)

Page 56: Fluentd in Co-Work

fluent-resque-stat

Page 57: Fluentd in Co-Work

Thank  You  !

Page 58: Fluentd in Co-Work

FluentdSetup

Page 59: Fluentd in Co-Work

Install  and  SetupInstallattion of Fluentd is AWS cloud-init(user_data)Setting Fluentd is chef-sole and capistrano

Page 60: Fluentd in Co-Work

I Extend a little above system for specifying cookbook.$ cap -S subnet=fluentd -S hosts=xfdeliver001 chef

Page 61: Fluentd in Co-Work

Launch  and  Monitoring  Process

supervisor