👌

msgpack requires Ruby version >= 2.4.エラー解決

2022/04/27に公開

EFK(ElasticSearch fluentd Kibana)のデータ基盤構築でトラブったので解決方法を紹介します。

エラー内容

[root@localhost bin]# ./fluent-gem install fluent-plugin-elasticsearch
ERROR:  Error installing fluent-plugin-elasticsearch:
        msgpack requires Ruby version >= 2.4.

やったこと

Rubyのバージョンアップ

$ yum install -y ruby-devel
$ git clone https://github.com/rbenv/rbenv.git ~/.rbenv
$ cd ~/.rbenv && src/configure && make -C src
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
$ ~/.rbenv/bin/rbenv init
$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
$ source ~/.bash_profile
$ git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
$ rbenv -v
$ yum install -y openssl-devel readline-devel zlib-devel
$ rbenv install 2.7.6
$ rbenv global 2.7.6
$ ruby -v

v2.7.6にアップグレードしました。

[root@localhost bin]# ruby -v
ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a) [x86_64-linux]
[root@localhost bin]#

それでもエラーが変わらず。。。。

次にやったこと

td-agentのバージョンを2->3に上げた
まずはtd-agentv2のアンインストール

$ yum remove -y td-agent

つぎにv3のインストール

$ curl -L https://toolbelt.treasuredata.com/sh/install-redhat-td-agent3.sh | sh

無事プラグインのインストールができました

[root@localhost bin]# ./fluent-gem install fluent-plugin-elasticsearch
Fetching: fluent-plugin-elasticsearch-5.2.2.gem (100%)
Successfully installed fluent-plugin-elasticsearch-5.2.2
Parsing documentation for fluent-plugin-elasticsearch-5.2.2
Installing ri documentation for fluent-plugin-elasticsearch-5.2.2
Done installing documentation for fluent-plugin-elasticsearch after 0 seconds
1 gem installed
[root@localhost bin]#
``

Discussion