12
Fluentd and MySQL MySQL Casual Talks Vol.3 (2012/04/19) LT @tagomoris NHN Japan Corp. 12420日金曜日

Fluentd and MySQL

Embed Size (px)

DESCRIPTION

about fluent-plugin-mysql (super lightening talk presentation)

Citation preview

Page 1: Fluentd and MySQL

Fluentd and MySQLMySQL Casual Talks Vol.3 (2012/04/19)

LT@tagomoris

NHN Japan Corp.

12年4月20日金曜日

Page 2: Fluentd and MySQL

What's Fluentd ?

• Log collector daemon we all loves.

• Message (key-value pairs) without schema

12年4月20日金曜日

Page 3: Fluentd and MySQL

Storage systems with Fluentd

• HDFS of Hadoop

• Amazon S3

• MongoDB

• Online aggregation and graphs

12年4月20日金曜日

Page 4: Fluentd and MySQL

RDBMS with Fluentd?

• Schema is fine!

• Schema-less fluentd message is not suitable for RDBMS....

$ gem search -r fluent-plugin-mysql

*** REMOTE GEMS ***

$

12年4月20日金曜日

Page 5: Fluentd and MySQL

If it doesn't exists,I'll write it.

無いのなら 作ってしまえプラグイン

12年4月20日金曜日

Page 6: Fluentd and MySQL

fluent-plugin-mysql

• Fluentd buffered output plugin

• https://github.com/tagomoris/fluent-plugin-mysql

• Released just before this LT!

• Now, we can do 'gem install fluent-plugin-mysql'

12年4月20日金曜日

Page 7: Fluentd and MySQL

Schema ?

12年4月20日金曜日

Page 8: Fluentd and MySQL

We have mysql_json !

• "mysql_json - a MySQL UDF for parsing JSON"

• http://blog.kazuhooku.com/2011/09/mysqljson-mysql-udf-for-parsing-json.html

• https://github.com/kazuho/mysql_json

12年4月20日金曜日

Page 9: Fluentd and MySQL

Simple configuration

<source>  type forward</source>

<match test.*>  type mysql  host localhost  database applogs  username root  sql INSERT INTO tbl SET jsondata=?  format json  flush_interval 1s</match>

12年4月20日金曜日

Page 10: Fluentd and MySQL

Coooooooool!!!!

mysql> select * from tbl where json_get(jsondata, 'pospos') like 'moge%';+----+----------------------------------------------+| id | jsondata                                     |+----+----------------------------------------------+|  2 | {"hoge":1,"pospos":"mogemogemogemogemogege"} |+----+----------------------------------------------+1 row in set (0.00 sec)

12年4月20日金曜日

Page 11: Fluentd and MySQL

Thanks !(See you next in Fluentd Casual Talks!)

12年4月20日金曜日

Page 12: Fluentd and MySQL

Schema....

• fluent-plugin-mysql also supports schema-full insert.

• like below:

<match test.*>  type mysql  host localhost  database applogs  username root  key_names status,path,rhost,agent,referer table tbl columns status,path,rhost,agent,referer  flush_interval 1s</match>

12年4月20日金曜日