LoginSignup
1
0

RedHat9.3にfluentd package 5 (LTS)がcurlでインストールできない場合の解決方法

Last updated at Posted at 2024-03-26

公式ドキュメント推奨方法でのインストールを試みる(失敗する)

RedHatとCentOSは以下のようにcurlでrpmリポジトリからインストールする方法が推奨されている。

$ curl -fsSL https://toolbelt.treasuredata.com/sh/install-redhat-fluent-package5-lts.sh | sh

実行結果

[root@ip-xxx-xx-x-xx etc]# curl -fsSL https://toolbelt.treasuredata.com/sh/install-redhat-fluent-package5-lts.sh | sh
==============================
 fluent-package Installation Script 
==============================
This script requires superuser access to install rpm packages.
You will be prompted for your password by sudo.
Fluentd Project                                                                                                                                                          41 kB/s | 3.0 kB     00:00    
TreasureData                                                                                                                                                            1.2 kB/s | 565  B     00:00    
Errors during downloading metadata for repository 'treasuredata':
  - Status code: 404 for https://packages.treasuredata.com/2/redhat/9/x86_64/repodata/repomd.xml (IP: xx.xxx.xx.xxx)
エラー: repo 'treasuredata' のメタデータのダウンロードに失敗しました : Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
TreasureData                                                                                                                                                            5.7 kB/s | 565  B     00:00    
Errors during downloading metadata for repository 'treasuredata':
  - Status code: 404 for https://packages.treasuredata.com/2/redhat/9/x86_64/repodata/repomd.xml (IP: xx.xxx.xx.xx)
エラー: repo 'treasuredata' のメタデータのダウンロードに失敗しました : Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

Installation completed. Happy Logging!

https://packages.treasuredata.com/2/redhat/9/x86_64/repodata/repomd.xml が404でインストールは失敗する。

実行されたスクリプトの中身を確認

echo "=============================="
echo " fluent-package Installation Script "
echo "=============================="
echo "This script requires superuser access to install rpm packages."
echo "You will be prompted for your password by sudo."

# clear any previous sudo permission
sudo -k

# run inside sudo
sudo sh <<SCRIPT

  # add GPG key
  rpm --import https://packages.treasuredata.com/GPG-KEY-td-agent
  rpm --import https://packages.treasuredata.com/GPG-KEY-fluent-package

  # add fluent-package repository to yum
  cat >/etc/yum.repos.d/fluent-package-lts.repo <<'EOF';
[fluent-package-lts]
name=Fluentd Project
baseurl=https://packages.treasuredata.com/lts/5/redhat/\$releasever/\$basearch
enabled=1
gpgcheck=1
gpgkey=https://packages.treasuredata.com/GPG-KEY-td-agent
       https://packages.treasuredata.com/GPG-KEY-fluent-package
EOF

  # update your sources
  yum check-update

  # install the toolbelt
  yes | yum install -y fluent-package

SCRIPT

# message
echo ""
echo "Installation completed. Happy Logging!"
echo ""

$releasever$basearch に対応するパッケージが存在しない事が原因だろうか。
Installation completed. Happy Logging! は失敗しても出力される。

パッケージのURLを直接指定してrpmコマンドでインストールを試みる(成功する)

https://td-agent-package-browser.herokuapp.com/lts/5/redhat/9/x86_64
このページから最新バージョンのリンクURLをコピーし、以下のコマンドで実行してみる。

[root@ip-xxx-xx-x-xx etc]# rpm -ivh https://s3.amazonaws.com/packages.treasuredata.com/lts/5/redhat/9/x86_64/fluent-package-5.0.2-1.el9.x86_64.rpm
https://s3.amazonaws.com/packages.treasuredata.com/lts/5/redhat/9/x86_64/fluent-package-5.0.2-1.el9.x86_64.rpm を取得中
Verifying...                          ################################# [100%]
準備しています...                      ################################# [100%]
更新中 / インストール中...
   1:fluent-package-5.0.2-1.el9       ################################# [100%]
inactive

今度はインストールできたようなので起動してみる。

起動確認

[root@ip-xxx-xx-x-xx etc]# sudo systemctl start fluentd.service
[root@ip-xxx-xx-x-xx etc]# sudo systemctl status fluentd.service
● fluentd.service - fluentd: All in one package of Fluentd
     Loaded: loaded (/usr/lib/systemd/system/fluentd.service; disabled; preset: disabled)
     Active: active (running) since Fri 2024-03-22 17:08:34 JST; 4s ago
       Docs: https://docs.fluentd.org/
    Process: 413837 ExecStart=/opt/fluent/bin/fluentd --log $FLUENT_PACKAGE_LOG_FILE --daemon /var/run/fluent/fluentd.pid $FLUENT_PACKAGE_OPTIONS (code=exited, status=0/SUCCESS)
   Main PID: 413843 (fluentd)
      Tasks: 9 (limit: 11776)
     Memory: 80.5M
        CPU: 1.690s
     CGroup: /system.slice/fluentd.service
             ├─413843 /opt/fluent/bin/ruby /opt/fluent/bin/fluentd --log /var/log/fluent/fluentd.log --daemon /var/run/fluent/fluentd.pid
             └─413846 /opt/fluent/bin/ruby -Eascii-8bit:ascii-8bit /opt/fluent/bin/fluentd --log /var/log/fluent/fluentd.log --daemon /var/run/fluent/fluentd.pid --under-supervisor

 3月 22 17:08:33 ip-xxx-xx-x-xx.ap-northeast-1.compute.internal systemd[1]: /usr/lib/systemd/system/fluentd.service:19: PIDFile= references a path below legacy directory /var/run/, updating /var/run/>
 3月 22 17:08:33 ip-xxx-xx-x-xx.ap-northeast-1.compute.internal systemd[1]: Starting fluentd: All in one package of Fluentd...
 3月 22 17:08:34 ip-xxx-xx-x-xx.ap-northeast-1.compute.internal systemd[1]: Started fluentd: All in one package of Fluentd.

起動できた。
/etc/fluent/fluentd.conf にconfファイルも作成されている。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0