fluentd(td-agent)のMySQLプラグインが入らなかった。
# /usr/sbin/td-agent-gem install fluent-plugin-mysql Building native extensions. This could take a while... ERROR: Error installing fluent-plugin-mysql: ERROR: Failed to build gem native extension. /opt/td-agent/embedded/bin/ruby extconf.rb checking for ruby/thread.h... yes checking for rb_thread_call_without_gvl() in ruby/thread.h... yes checking for rb_thread_blocking_region()... yes checking for rb_wait_for_single_fd()... yes checking for rb_hash_dup()... yes checking for rb_intern3()... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lm... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lz... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lsocket... no checking for mysql_query() in -lmysqlclient... no checking for main() in -lnsl... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lmygcc... no checking for mysql_query() in -lmysqlclient... no *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/opt/td-agent/embedded/bin/ruby --with-mysql-dir --without-mysql-dir --with-mysql-include --without-mysql-include=${mysql-dir}/include --with-mysql-lib --without-mysql-lib=${mysql-dir}/lib --with-mysql-config --without-mysql-config --with-mysql-dir --without-mysql-dir --with-mysql-include --without-mysql-include=${mysql-dir}/include --with-mysql-lib --without-mysql-lib=${mysql-dir}/lib --with-mysqlclientlib --without-mysqlclientlib --with-mlib --without-mlib --with-mysqlclientlib --without-mysqlclientlib --with-zlib --without-zlib --with-mysqlclientlib --without-mysqlclientlib --with-socketlib --without-socketlib --with-mysqlclientlib --without-mysqlclientlib --with-nsllib --without-nsllib --with-mysqlclientlib --without-mysqlclientlib --with-mygcclib --without-mygcclib --with-mysqlclientlib --without-mysqlclientlib extconf failed, exit code 1 Gem files will remain installed in /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/mysql2-0.3.18 for inspection. Results logged to /opt/td-agent/embedded/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0/mysql2-0.3.18/gem_make.out
必要なライブラリがないとかなんとか。mysqlclientが問題らしいが、mysql-clientはちゃんと入ってる。
# rpm -qa | grep -i mysql MySQL-devel-5.7.4_m14-1.el6.x86_64 MySQL-client-5.7.4_m14-1.el6.x86_64 mysql-libs-5.1.73-5.el6_7.1.x86_64
ちゃんと動いてる環境も他にあって、そことの違いはmysql-sharedが入ってるかどうかだけ。 一旦gemをアンインストール。
# /usr/sbin/td-agent-gem uninstall mysql2 # /usr/sbin/td-agent-gem uninstall fluent-plugin-mysql
こっちで足りなかった、sharedのrpmを入れる。
# rpm -ivh MySQL-shared-5.7.4_m14-1.el6.x86_64.rpm Preparing... ########################################### [100%] 1:MySQL-shared ########################################### [100%]
# rpm -qa | grep -i mysql MySQL-devel-5.7.4_m14-1.el6.x86_64 MySQL-shared-5.7.4_m14-1.el6.x86_64 MySQL-client-5.7.4_m14-1.el6.x86_64 mysql-libs-5.1.73-5.el6_7.1.x86_64
gemを再インストールでちゃんと動いた。 sharedって名前からして何をしてるのか今一わからなかったんだけど、クライアント側にも入れといた方がいいみたい。
# /usr/sbin/td-agent-gem install mysql2 # /usr/sbin/td-agent-gem install fluent-plugin-mysql