ja:documentation:07_technical_annexes:10_share_var_spool_directory_between_several_pandora_servers

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン 前のリビジョン
ja:documentation:07_technical_annexes:10_share_var_spool_directory_between_several_pandora_servers [2023/07/20 05:29] – [NFS サーバの設定] junichija:documentation:07_technical_annexes:10_share_var_spool_directory_between_several_pandora_servers [Unknown date] (現在) – 削除 - 外部編集 (Unknown date) 127.0.0.1
行 1: 行 1:
-====== サーバデータディレクトリの複数 Pandora サーバでの共有 ======  
-{{indexmenu_n>10}} 
- 
-[[ja:documentation:start|Pandora FMS ドキュメント一覧に戻る]] 
- 
-===== 概要 ===== 
- 
-Pandora FMS データサーバは、 /var/spool/pandora/data_in ディレクトリを利用し、ソフトウエアエージェントに送受信する情報を管理します。 
- 
-このディレクトリはまた、Pandora コンソールからもアクセスできる必要があります。エージェントに送信する設定やコレクションにアクセスするためです。 
- 
-複数のコンソールと複数のサーバがある場合、それぞれのコンソールは、サーバが対応しているエージェントを管理することができます。 
- 
-ここで、複数の Pandora サーバが共通の環境で動作している場合を想定します。 
- 
-{{  :wiki:nfs_schema.png  }} 
- 
-それぞれのサーバのエージェントは、<i>data_in</i> フォルダを使って割り当てられたデータサーバと通信します。単一コンソールで、複数のデータサーバがある構成では、共通の情報として <i>spool</i> を共有するために NFS を使ってエージェント管理を一元化します。 
- 
-<WRAP center round tip 60%> 
-コレクションの管理を簡単にするため、異なるコンソール間での //pandora_console/attachment// フォルダの共有も必要です。 
-</WRAP> 
- 
-<WRAP center round tip 60%> 
- 
-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 [[:en:documentation:07_technical_annexes:10_share_var_spool_directory_between_several_pandora_servers#configuring_tentacle_server_for_nfs_concurrent_access|Tentacle server is configured for concurrent access]] to XML files. 
- 
-</WRAP> 
- 
-<WRAP center round tip 60%> 
-HA 環境では data_in の //conf//, //md5//, //collections//, //netflow// フォルダーを共有する必要があり、//pandora_console/attachment// フォルダーも共有することをお勧めします。 //data_in// フォルダ自体は**共有してはいけません**。ただし、XML ファイルに対して[[:ja:documentation:07_technical_annexes:10_share_var_spool_directory_between_several_pandora_servers#tentacle_サーバを_nfs_同時アクセス用に設定する|Tentacle サーバが同時アクセスするように設定されている場合]]を除きます。 
-</WRAP> 
- 
-===== NFS 設定 ===== 
- 
-==== はじめに ==== 
-<i>nfs-utils</i>パッケージを **NFS でディレクトリを共有するすべてのシステム**にインストールします。 
- 
-  yum install -y nfs-utils 
- 
-==== NFS サーバの設定 ==== 
- 
-<WRAP center round important 60%> 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. </WRAP> 
- 
-<WRAP center round important 60%> 
-NFS サーバは、Pandora FMS サーバとは **別サーバ** であることが重要です。Pandora FMS サーバの 1つが NFS サーバーとして設定されていて、クライアントが接続できない障害があった場合、共有ファイルはアクセスできなくなり、Pandora FMS における **エラーの原因** となります。 
-</WRAP> 
- 
-Edit the file ''/etc/exports'' adding the following: 
- 
-''/etc/export'' を編集し、次の行を加えます。 
- 
-<code> 
-/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) 
-</code> 
- 
-ここで、[CLIENT_IP] は、リソースを共有するシステムの IP アドレスを意味します。  
- 
-<code> 
-/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) 
-</code> 
- 
-システムのファイアーウォールがある場合は、必要なポートを開けます。 
- 
-<code> 
-# CentOS 
-firewall-cmd --permanent --zone=public --add-service=nfs 
-firewall-cmd --reload 
-</code> 
- 
-設定が完了したらサービスを開始します。 
- 
-<code> 
-# CentOS 
-service rpcbind start 
-service nfs-server start 
-service nfs-lock start 
-service nfs-idmap start 
-</code> 
- 
-システム起動時に NFS が開始されるように設定します。 
- 
-<code> 
-chkconfig rpcbind on 
-chkconfig nfs-server on 
-chkconfig nfs-lock on 
-chkconfig nfs-idmap on 
-</code> 
- 
-/etc/export の設定を変更したら、nfs-server を再起動します。 
- 
-  systemctl restart nfs-server 
- 
-==== NFS クライアントの設定 ==== 
-最初にディレクトリをバックアップします。 
- 
-  mv /var/spool/pandora/data_in /var/spool/pandora/data_in_locale 
- 
-**<u>注意</u>>** apache がインストールされていないシステムの場合(インストールは必須ではありません)は、競合が発生しないように /etc/passwd および /etc/group に apache を追加します。 
- 
-<code> 
-echo "apache:x:48:48:Apache:/usr/share/httpd:/sbin/nologin" >> /etc/passwd 
-echo "apache:x:48:" >> /etc/group 
-</code> 
- 
-フォルダーのパーミッションを確認します。 
- 
-<code> 
-chown pandora:apache /var/spool/pandora/data_in 
-chmod 770 /var/spool/pandora/data_in 
-</code> 
- 
- 
-リモートのディスクをマウントできるか確認します。 
- 
-<code> 
-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 
-</code> 
- 
-ここで、[IP_SERVIDOR_NFS] は、NFS サービスを提供するサーバの IP アドレスです。  
- 
-例: 
- 
-<code> 
-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 
-</code> 
- 
-上記のコマンドが失敗した場合は、以下を確認します。 
-  * ファイアーウォールの状態 
-  * root で実行しているかどうか 
-  * マウントポイントのディレクトリが存在するかどうか 
- 
-ここまでですべて問題がなければ、再起動した時に自動的にマウントされるように **/etc/fstab** を設定します。 
- 
-/etc/fstab ファイルに次の行を追加します。 
- 
-<code> 
-[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 
-</code> 
- 
-ここで、[NFS_SERVER_IP] は、NFS サービスを提供しているサーバの IP アドレスです。  
- 
-===== Tentacle サーバを NFS 同時アクセス用に設定する ===== 
- 
-環境の準備ができたら、両方のコンピュータの Tentacle サーバを設定して、XML ファイルが別々のフォルダーに分散されるようにし、データサーバーが両方の Pandora FMS サーバでファイルを処理するときの同時実行を回避します。 
- 
-それには、/var/spool/pandora/data_in ディレクトリに 2つのフォルダを作成します。 
- 
-<code> 
-mkdir /var/spool/pandora/data_in/xml_srv1 
-mkdir /var/spool/pandora/data_in/xml_srv2 
-</code> 
- 
-両方のディレクトリのパーミッションを調整します。 
- 
-<code> 
-chmod pandora:apache /var/spool/pandora/data_in/xml_srv1 
-chmod pandora:apache /var/spool/pandora/data_in/xml_srv2 
-</code> 
- 
-/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 サーバの設定ファイルを次のように編集します。 
- 
-<code> 
-# 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 
-</code> 
- 
-<code> 
-# 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 
-</code> 
- 
-すべての変更が完了したら、両方のサーバで pandora_server サービスと tentacle_serverd サービスの両方を再起動します。 
- 
-[[ja:documentation:start|Pandora FMS ドキュメント一覧に戻る]] 
-===== (OBSOLETE) GlusterFS 設定 ===== 
- 
-GlusterFS を使用すると、サーバ間で Pandora FMS のキーディレクトリを共有できるため、いずれかのサーバがアクセスできない場合でもデータを利用できます。 
-このシステムのにより、常にアクティブなリソースがあり、すべてのサーバが機能していなくてもデータにアクセスできます。 
- 
-==== 必要条件 ==== 
-  * **Selinux** は無効化もしくは正しくルールを設定する必要があります。 
-  * **ファイアーウォール** は無効化または正しくルールを設定する必要があります。 
-    * **ポート 24009/tcp** が開いている必要があります。 
-  * **/etc/hosts** ファイルに前サーバの名前と IP アドレスが設定されている必要があります。 
-  * **パーティショニングをしていない追加ディスク** を全サーバに用意する必要があります。 
- 
- 
-==== パッケージインストール ==== 
-GlusterFS をインストールするために、現状のバージョンを検索します。 
- 
-  yum search centos-release-gluster 
- 
-最新の LTS 安定バージョンをインストールします。 
- 
-<code> 
-yum install centos-release-gluster37 
-yum install glusterfs glusterfs-cli glusterfs-libs glusterfs-fuse 
-</code> 
- 
-==== XFS パーティションの作成 (ブロック) ==== 
-<WRAP center round tip 60%> 
-このガイドでは、サンプルサーバとして //gluster1.example.com// および //gluster2.example.com// を用います。 
-</WRAP> 
- 
-/dev/xvdb ディスクを使って新たな物理ボリュームを作成します。 
- 
-<code> 
-pvcreate /dev/xvdb 
-   Physical volume “/dev/xvdb” successfully created 
-</code> 
- 
-/var/xvdb にボリュームグループを作成します。 
- 
-<code> 
-vgcreate vg_gluster /dev/xvdb 
-   Volume group “vg_gluster”  successfully created 
-</code> 
- 
-両クラスタノードの XFS ブロックとして brick1 ボリュームを作成します。割り当てる容量を //-L// パラメータで指定します。 
- 
-<code> 
-lvcreate -L 5G -n brick1 vg_gluster 
- Logical volume "brick1" created. 
-</code> 
- 
-他には、ディスクのパーセンテージで容量を割り当てることもできます。 
- 
-  lvcreate -l 100%FREE -n brick1 vg_gluster 
- 
-ファイルシステムを XFS として設定します。 
- 
-  mkfs.xfs /dev/vg_gluster/brick1 
- 
-マウントポイントを作成し、XFS ブロックをマウントします。 
- 
-<code> 
-mkdir -p /glusterfs/brick1 
-mount /dev/vg_gluster/brick1 /glusterfs/brick1 
-</code> 
- 
-/etc/fstab ファイルを開き、次の行を追加します。 
- 
-  /dev/vg_gluster/brick1 /glusterfs/brick1 xfs defaults 0 0 
- 
-両ノードで、glusterfsd.service を有効化し、開始します。 
- 
-  systemctl enable glusterd.service --now 
- 
-最初の GlusterFS ノードから 2台目へ接続し、信頼されたプール(ストレージクラスタ)を作成します。 
- 
-<code> 
- gluster peer probe gluster2.example.com 
-   peer probe: success. 
-</code> 
- 
-クラスタの相手を確認します。 
- 
-<code> 
-gluster peer status 
-  Number of Peers: 1 
-  Hostname: gluster2.example.com 
-  Uuid: e528dc23-689c-4306-89cd-1d21a2153057 
-   
-   State: Peer in Cluster (Connected) 
-</code> 
- 
-==== HA ボリュームの作成 ==== 
-**HA 同期ボリューム** を作成するためには、両ノードの XFS パーティション /glusterfs/brick1 を利用します。 
- 
-/glusterfs/brick1 マウントポイントにサブフォルダを作成します。GlusterFS が動作するために必要です。 
- 
-  mkdir /glusterfs/brick1/brick 
- 
-GlusterFS 同期ボリュームを作成します。 
- 
-<WRAP center round important 60%> 
-このコマンドは、**1台のノードでのみ** 実行します。(例では //gluster1.example.com//) 
-</WRAP> 
- 
-<code> 
-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 
-</code> 
- 
-<code> 
-gluster volume start glustervol1 
-  volume start: glustervol1: success 
-</code> 
- 
-GlusterFS ボリュームを確認します。 
- 
-<code> 
-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 
-</code> 
- 
- 
-==== クライアントでのボリュームのマウント ==== 
-GlusterFS のクライアントパッケージをインストールします。 
- 
-  yum install glusterfs glusterfs-fuse attr -y 
- 
-Pandora FMS ファイルのためのフォルダを作成します。 
- 
-  mkdir /pandora_files/ 
- 
-<WRAP center round tip 60%> 
-/pandora_files/ というパスは例です。任意のフォルダを利用できます。 
-</WRAP> 
- 
-クライアントで 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/ にマウントしたら、このフォルダ内に必要なディレクトリすべてを作成します。 
- 
-<code> 
-cd /pandora_files/ 
-mkdir collections md5 conf netflow attachment 
-</code> 
- 
-オリジナルの /var/spooll/pandora/data_in フォルダから、一通りコピーします。 
- 
-<code> 
-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/ 
-</code> 
- 
-古いフォルダを削除します。 
- 
-<code> 
-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 
-</code> 
- 
-両方のサーバでシンボリックリンクを作成します。 
- 
-<code> 
-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/ 
-</code> 
- 
-<WRAP center round tip 60%> 
-これで設定は完了で、両サーバで Pandora FMS のキーディレクトリを共有するようになります。共有ボリュームを増やしたい場合は、このガイドの次の章(ボリュームの追加)を参照してください。 
-</WRAP> 
- 
-==== ボリュームの追加 ==== 
-GlusterFS ボリュームは、ブロック数を増やすことにより停止することなく容量を拡張することができます。 
- 
-それには、最初のステップど同様に次のように新たなディスクを作成する必要があります。 
- 
-<code> 
-lvcreate -L 5G -n brick2 vg_gluster 
-  Logical volume "brick2" created. 
-</code> 
- 
-XFS として設定します。 
- 
-  mkfs.xfs /dev/vg_gluster/brick2 
- 
-新たなマウントポイントを作成し、新たなブロックをマウントします。 
- 
-<code> 
-mkdir -p /bricks/brick2 
-mount /dev/vg_gluster/brick2 /bricks/brick2 
-</code> 
- 
-/etc/fstab に追記します。 
- 
-  /dev/vg_gluster/brick2 /bricks/brick2 xfs defaults 0 0 
- 
-新たなブロックのフォルダを作成します。 
- 
-  mkdir /glusterfs/brick2/brick 
- 
-ボリュームを拡大します。 
- 
-<code> 
-gluster volume add-brick glustervol1 gluster1.example.com:/glusterfs/brick2/brick \ 
-gluster2.example.com:/glusterfs/brick2/brick 
-</code> 
- 
-ボリュームを確認します。 
- 
-<code> 
-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 
-</code> 
- 
-リバランシングの前にディスク使用量を確認します。 
- 
-  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/07_technical_annexes/10_share_var_spool_directory_between_several_pandora_servers.1689830993.txt.gz
  • 最終更新: 2023/07/20 05:29
  • by junichi