ja:documentation:pandorafms:technical_annexes:10_share_var_spool_directory_between_several_pandora_servers

サーバデータディレクトリの複数 Pandora サーバでの共有

Sorry, the requested topic was removed from the official Pandora FMS documentation. Please check the last version in which it was published, the 772.

申し訳ありませんが、こちらのトピックは Pandora FMS の公式ドキュメントから削除されました。 公開された最後のバージョンである 772 を確認してください。

(OBSOLETE)

Pandora FMS データサーバは、 /var/spool/pandora/data_in ディレクトリを利用し、ソフトウエアエージェントに送受信する情報を管理します。

このディレクトリはまた、Pandora コンソールからもアクセスできる必要があります。エージェントに送信する設定やコレクションにアクセスするためです。

複数のコンソールと複数のサーバがある場合、それぞれのコンソールは、サーバが対応しているエージェントを管理することができます。

ここで、複数の Pandora サーバが共通の環境で動作している場合を想定します。

それぞれのサーバのエージェントは、<i>data_in</i> フォルダを使って割り当てられたデータサーバと通信します。単一コンソールで、複数のデータサーバがある構成では、共通の情報として <i>spool</i> を共有するために NFS を使ってエージェント管理を一元化します。

コレクションの管理を簡単にするため、異なるコンソール間での pandora_console/attachment フォルダの共有も必要です。

It's mandatory to share data_in's conf, md5, collections and netflow folders for HA environments, and we recommend to share the pandora_console/attachment folder as well. The data_in folder itself must not be shared, unless Tentacle server is configured for concurrent access to XML files.

HA 環境では data_in の conf, md5, collections, netflow フォルダーを共有する必要があり、pandora_console/attachment フォルダーも共有することをお勧めします。 data_in フォルダ自体は共有してはいけません。ただし、XML ファイルに対してTentacle サーバが同時アクセスするように設定されている場合を除きます。

<i>nfs-utils</i>パッケージを NFS でディレクトリを共有するすべてのシステムにインストールします。

yum install -y nfs-utils

It's very important for the NFS server to be a separate server from those of Pandora FMS. If one of them were configured as NFS server and there were any errors prevented the client from connecting, the shared files would not be accesible, causing errors in Pandora FMS.

NFS サーバは、Pandora FMS サーバとは 別サーバ であることが重要です。Pandora FMS サーバの 1つが NFS サーバーとして設定されていて、クライアントが接続できない障害があった場合、共有ファイルはアクセスできなくなり、Pandora FMS における エラーの原因 となります。

Edit the file /etc/exports adding the following:

/etc/export を編集し、次の行を加えます。

/var/spool/pandora/data_in/conf [IP_CLIENTE](rw,sync,no_root_squash,no_all_squash)
/var/spool/pandora/data_in/collections [IP_CLIENTE](rw,sync,no_root_squash,no_all_squash)
/var/spool/pandora/data_in/md5 [IP_CLIENTE](rw,sync,no_root_squash,no_all_squash)
/var/spool/pandora/data_in/netflow [IP_CLIENTE](rw,sync,no_root_squash,no_all_squash)
/var/www/html/pandora_console/attachment [IP_CLIENTE](rw,sync,no_root_squash,no_all_squash)

ここで、[CLIENT_IP] は、リソースを共有するシステムの IP アドレスを意味します。

/var/spool/pandora/data_in/conf 192.168.70.10(rw,sync,no_root_squash,no_all_squash)
/var/spool/pandora/data_in/collections 192.168.70.10(rw,sync,no_root_squash,no_all_squash)
/var/spool/pandora/data_in/md5 192.168.70.10(rw,sync,no_root_squash,no_all_squash)
/var/spool/pandora/data_in/netflow 192.168.70.10(rw,sync,no_root_squash,no_all_squash)
/var/www/html/pandora_console/attachment 192.168.70.10(rw,sync,no_root_squash,no_all_squash)

システムのファイアーウォールがある場合は、必要なポートを開けます。

# CentOS
firewall-cmd --permanent --zone=public --add-service=nfs
firewall-cmd --reload

設定が完了したらサービスを開始します。

# CentOS
service rpcbind start
service nfs-server start
service nfs-lock start
service nfs-idmap start

システム起動時に NFS が開始されるように設定します。

chkconfig rpcbind on
chkconfig nfs-server on
chkconfig nfs-lock on
chkconfig nfs-idmap on

/etc/export の設定を変更したら、nfs-server を再起動します。

systemctl restart nfs-server

最初にディレクトリをバックアップします。

mv /var/spool/pandora/data_in /var/spool/pandora/data_in_locale

<u>注意</u» apache がインストールされていないシステムの場合(インストールは必須ではありません)は、競合が発生しないように /etc/passwd および /etc/group に apache を追加します。

echo "apache:x:48:48:Apache:/usr/share/httpd:/sbin/nologin" >> /etc/passwd
echo "apache:x:48:" >> /etc/group

フォルダーのパーミッションを確認します。

chown pandora:apache /var/spool/pandora/data_in
chmod 770 /var/spool/pandora/data_in

リモートのディスクをマウントできるか確認します。

mount -t nfs [IP_SERVIDOR_NFS]:/var/spool/pandora/data_in/conf /var/spool/pandora/data_in/conf
mount -t nfs [IP_SERVIDOR_NFS]:/var/spool/pandora/data_in/md5 /var/spool/pandora/data_in/md5
mount -t nfs [IP_SERVIDOR_NFS]:/var/spool/pandora/data_in/collections /var/spool/pandora/data_in/collections
mount -t nfs [IP_SERVIDOR_NFS]:/var/spool/pandora/data_in/netflow /var/spool/pandora/data_in/netflow

ここで、[IP_SERVIDOR_NFS] は、NFS サービスを提供するサーバの IP アドレスです。

例:

mount -t nfs 192.168.70.10:/var/spool/pandora/data_in/conf /var/spool/pandora/data_in/conf
mount -t nfs 192.168.70.10:/var/spool/pandora/data_in/md5 /var/spool/pandora/data_in/md5
mount -t nfs 192.168.70.10:/var/spool/pandora/data_in/collections /var/spool/pandora/data_in/collections
mount -t nfs 192.168.70.10:/var/spool/pandora/data_in/netflow /var/spool/pandora/data_in/netflow

上記のコマンドが失敗した場合は、以下を確認します。

  • ファイアーウォールの状態
  • root で実行しているかどうか
  • マウントポイントのディレクトリが存在するかどうか

ここまでですべて問題がなければ、再起動した時に自動的にマウントされるように /etc/fstab を設定します。

/etc/fstab ファイルに次の行を追加します。

[NFS_SERVER_IP]:/var/spool/pandora/data_in/conf    /var/spool/pandora/data_in/conf   nfs defaults 0 0
[NFS_SERVER_IP]:/var/spool/pandora/data_in/md5    /var/spool/pandora/data_in/md5   nfs defaults 0 0
[NFS_SERVER_IP]:/var/spool/pandora/data_in/collections    /var/spool/pandora/data_in/collections   nfs defaults 0 0
[NFS_SERVER_IP]:/var/spool/pandora/data_in/netflow    /var/spool/pandora/data_in/netflow    nfs defaults 0 0
[NFS_SERVER_IP]:/var/www/html/pandora_console/attachment    /var/www/html/pandora_console/attachment    nfs defaults 0 0

ここで、[NFS_SERVER_IP] は、NFS サービスを提供しているサーバの IP アドレスです。

環境の準備ができたら、両方のコンピュータの Tentacle サーバを設定して、XML ファイルが別々のフォルダーに分散されるようにし、データサーバーが両方の Pandora FMS サーバでファイルを処理するときの同時実行を回避します。

それには、/var/spool/pandora/data_in ディレクトリに 2つのフォルダを作成します。

mkdir /var/spool/pandora/data_in/xml_srv1
mkdir /var/spool/pandora/data_in/xml_srv2

両方のディレクトリのパーミッションを調整します。

chmod pandora:apache /var/spool/pandora/data_in/xml_srv1
chmod pandora:apache /var/spool/pandora/data_in/xml_srv2

/etc/init.d/tentacle_serverd ファイル内で XML ファイルフォルダの設定をするための TENTACLE_EXT_OPTS の値を編集します。

TENTACLE_EXT_OPTS="-i.*\.conf:conf;.*\.md5:md5;.*\.zip:collections"

サーバ 1 では、次のようになります。

TENTACLE_EXT_OPTS="-i.*\.conf:conf;.*\.md5:md5;.*\.zip:collections;.*\.data:xml_srv1"

サーバ 2 では、次のようになります。

TENTACLE_EXT_OPTS="-i.*\.conf:conf;.*\.md5:md5;.*\.zip:collections;.*\.data:xml_srv2"

最後に、両方の Pandora FMS サーバの設定ファイルを次のように編集します。

# Pandora FMS server number 1
# incomingdir:  It defines directory where incoming data packets are stored
# You could set directory relative to base path or absolute, starting with /
incomingdir /var/spool/pandora/data_in/xml_srv1
# Pandora FMS server number 2
# incomingdir:  It defines directory where incoming data packets are stored
# You could set directory relative to base path or absolute, starting with /
incomingdir /var/spool/pandora/data_in/xml_srv2

すべての変更が完了したら、両方のサーバで pandora_server サービスと tentacle_serverd サービスの両方を再起動します。

Pandora FMS ドキュメント一覧に戻る

GlusterFS を使用すると、サーバ間で Pandora FMS のキーディレクトリを共有できるため、いずれかのサーバがアクセスできない場合でもデータを利用できます。 このシステムのにより、常にアクティブなリソースがあり、すべてのサーバが機能していなくてもデータにアクセスできます。

  • Selinux は無効化もしくは正しくルールを設定する必要があります。
  • ファイアーウォール は無効化または正しくルールを設定する必要があります。
    • ポート 24009/tcp が開いている必要があります。
  • /etc/hosts ファイルに前サーバの名前と IP アドレスが設定されている必要があります。
  • パーティショニングをしていない追加ディスク を全サーバに用意する必要があります。

GlusterFS をインストールするために、現状のバージョンを検索します。

yum search centos-release-gluster

最新の LTS 安定バージョンをインストールします。

yum install centos-release-gluster37
yum install glusterfs glusterfs-cli glusterfs-libs glusterfs-fuse

このガイドでは、サンプルサーバとして gluster1.example.com および gluster2.example.com を用います。

/dev/xvdb ディスクを使って新たな物理ボリュームを作成します。

pvcreate /dev/xvdb
   Physical volume “/dev/xvdb” successfully created

/var/xvdb にボリュームグループを作成します。

vgcreate vg_gluster /dev/xvdb
   Volume group “vg_gluster”  successfully created

両クラスタノードの XFS ブロックとして brick1 ボリュームを作成します。割り当てる容量を -L パラメータで指定します。

lvcreate -L 5G -n brick1 vg_gluster
 Logical volume "brick1" created.

他には、ディスクのパーセンテージで容量を割り当てることもできます。

lvcreate -l 100%FREE -n brick1 vg_gluster

ファイルシステムを XFS として設定します。

mkfs.xfs /dev/vg_gluster/brick1

マウントポイントを作成し、XFS ブロックをマウントします。

mkdir -p /glusterfs/brick1
mount /dev/vg_gluster/brick1 /glusterfs/brick1

/etc/fstab ファイルを開き、次の行を追加します。

/dev/vg_gluster/brick1 /glusterfs/brick1 xfs defaults 0 0

両ノードで、glusterfsd.service を有効化し、開始します。

systemctl enable glusterd.service --now

最初の GlusterFS ノードから 2台目へ接続し、信頼されたプール(ストレージクラスタ)を作成します。

 gluster peer probe gluster2.example.com
   peer probe: success.

クラスタの相手を確認します。

gluster peer status
  Number of Peers: 1
  Hostname: gluster2.example.com
  Uuid: e528dc23-689c-4306-89cd-1d21a2153057
  
   State: Peer in Cluster (Connected)

HA 同期ボリューム を作成するためには、両ノードの XFS パーティション /glusterfs/brick1 を利用します。

/glusterfs/brick1 マウントポイントにサブフォルダを作成します。GlusterFS が動作するために必要です。

mkdir /glusterfs/brick1/brick

GlusterFS 同期ボリュームを作成します。

このコマンドは、1台のノードでのみ 実行します。(例では gluster1.example.com)

gluster volume create glustervol1 replica 2 transport tcp gluster1.example.com:/glusterfs/brick1/brick \
gluster2.example.com:/glusterfs/brick1/brick
  volume create: glustervol1: success: please start the volume to access data
gluster volume start glustervol1
  volume start: glustervol1: success

GlusterFS ボリュームを確認します。

gluster volume info all
  Volume Name: glustervol1
  Type: Replicate
  Volume ID: 6953a675-f966-4ae5-b458-e210ba8ae463
  Status: Started
  Number of Bricks: 1 x 2 = 2
  Transport-type: tcp
  Bricks:
  Brick1: gluster1.example.com:/glusterfs/brick1/brick
  Brick2: gluster2.example.com:/glusterfs/brick1/brick
  Options Reconfigured:
   performance.readdir-ahead: on

GlusterFS のクライアントパッケージをインストールします。

yum install glusterfs glusterfs-fuse attr -y

Pandora FMS ファイルのためのフォルダを作成します。

mkdir /pandora_files/

/pandora_files/ というパスは例です。任意のフォルダを利用できます。

クライアントで GlusterFS ボリュームをマウントします。

mount -t glusterfs gluster1.example.com:/glustervol1 /pandora_files/

/etc/fstab へ次の行を追加します。

gluster1.example.com:/glustervol1 /pandora_files glusterfs defaults,_netdev 0 0

パーティションを /pandora_files/ にマウントしたら、このフォルダ内に必要なディレクトリすべてを作成します。

cd /pandora_files/
mkdir collections md5 conf netflow attachment

オリジナルの /var/spooll/pandora/data_in フォルダから、一通りコピーします。

cp -rp /var/spool/pandora/data_in/conf /pandora_files/
cp -rp /var/spool/pandora/data_in/md5 /pandora_files/
cp -rp /var/spool/pandora/data_in/collections /pandora_files/
cp -rp /var/spool/pandora/data_in/netflow /pandora_files/
cp -rp /var/www/html/pandora_console/attachment /pandora_files/

古いフォルダを削除します。

rm -rf /var/spool/pandora/data_in/conf
rm -rf /var/spool/pandora/data_in/md5
rm -rf /var/spool/pandora/data_in/collections
rm -rf /var/spool/pandora/data_in/netflow
rm -rf /var/www/html/pandora_console/attachment

両方のサーバでシンボリックリンクを作成します。

ln -s /pandora_files/conf /var/spool/pandora/data_in/
ln -s /pandora_files/md5 /var/spool/pandora/data_in/
ln -s /pandora_files/collections /var/spool/pandora/data_in/
ln -s /pandora_files/netflow /var/spool/pandora/data_in/
ln -s /pandora_files/attachment /var/www/html/pandora_console/

これで設定は完了で、両サーバで Pandora FMS のキーディレクトリを共有するようになります。共有ボリュームを増やしたい場合は、このガイドの次の章(ボリュームの追加)を参照してください。

GlusterFS ボリュームは、ブロック数を増やすことにより停止することなく容量を拡張することができます。

それには、最初のステップど同様に次のように新たなディスクを作成する必要があります。

lvcreate -L 5G -n brick2 vg_gluster
  Logical volume "brick2" created.

XFS として設定します。

mkfs.xfs /dev/vg_gluster/brick2

新たなマウントポイントを作成し、新たなブロックをマウントします。

mkdir -p /bricks/brick2
mount /dev/vg_gluster/brick2 /bricks/brick2

/etc/fstab に追記します。

/dev/vg_gluster/brick2 /bricks/brick2 xfs defaults 0 0

新たなブロックのフォルダを作成します。

mkdir /glusterfs/brick2/brick

ボリュームを拡大します。

gluster volume add-brick glustervol1 gluster1.example.com:/glusterfs/brick2/brick \
gluster2.example.com:/glusterfs/brick2/brick

ボリュームを確認します。

gluster volume info glustervol1
  Volume Name: glustervol1
  Type: Distributed-Replicate
  Volume ID: 6953a675-f966-4ae5-b458-e210ba8ae463
  Status: Started
  Number of Bricks: 2 x 2 = 4
  Transport-type: tcp
  Bricks:
  Brick1: gluster1.example.com:/glusterfs/brick1/brick
  Brick2: gluster2.example.com:/glusterfs/brick1/brick
  Brick3: gluster1.example.com:/glusterfs/brick2/brick
  Brick4: gluster2.example.com:/glusterfs/brick2/brick

リバランシングの前にディスク使用量を確認します。

df -h | grep brick

リバランス:

gluster volume rebalance glustervol1 start

リバランスの確認:

gluster volume rebalance glustervol1 status

ディスク使用量の再確認:

df -h | grep brick

ブロック内のファイル確認:

ls -l /glusterfs/brick*/brick/
  • ja/documentation/pandorafms/technical_annexes/10_share_var_spool_directory_between_several_pandora_servers.txt
  • 最終更新: 2024/02/19 05:02
  • by junichi