ja:documentation:pandorafms:technical_annexes:16_elastic_search_backup

差分

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

この比較画面へのリンク

次のリビジョン
前のリビジョン
ja:documentation:pandorafms:technical_annexes:16_elastic_search_backup [2021/06/17 13:35] – 作成 - 外部編集 127.0.0.1ja:documentation:pandorafms:technical_annexes:16_elastic_search_backup [2024/10/11 22:56] (現在) – [Elastic Search バックアップ] junichi
行 1: 行 1:
-====== Elastic Search バックアップ ====== +====== Elastic Search バックアップとリストア ======  
 {{indexmenu_n>16}} {{indexmenu_n>16}}
  
 [[ja:documentation:start|Pandora FMS ドキュメント一覧に戻る]] [[ja:documentation:start|Pandora FMS ドキュメント一覧に戻る]]
  
-===== ElasticSearch のバックアップとリストア (ELK) =====+<WRAP center round info 90%>
  
-スナップショットを使用した ElasticSearch サーバからのデータ移行は比較的速です。 まず、サーバのデータバックアップが作成され、後で復元ためにリポジトリに保存されます。+From NG 774 version, Pandora FMS incorporates [[:en:documentation:pandorafms:technical_annexes:38_opensearch_installation|OpenSearch]] for //log// monitoring, this topic is only valid for version 773 or previous versions. 
 + 
 +</WRAP> 
 + 
 +<WRAP center round info 90%> 
 + 
 +バージョン NG 774 から、Pandora FMS は //ログ// 監視用に [[ja:documentation:pandorafms:technical_annexes:38_opensearch_installation|OpenSearch]] を組み込んでいます。このトピックはバージョン 773 およびそれ以前のバージョンにのみ有効です。 
 + 
 +</WRAP> 
 + 
 +Data migration from an Elasticsearch server using snapshots is relatively quick. First, the server data is backed up and then stored in a repository for later restoration. 
 + 
 +スナップショットを使用した Elasticsearch サーバからのデータ移行は比較的速です。まず、サーバのデータバックアップ、後で復元できようにリポジトリに保存ます。 
 + 
 +<wrap #ks1 /> 
 + 
 + 
 +===== バックアップコピーの作成 ===== 
 + 
 +<WRAP center round info 90%> 
 + 
 +The machine to be backed up is called the "source machine" and the machine to be restored is called the "target machine"
 + 
 +</WRAP> 
 + 
 +<WRAP center round info 90%>
  
-==== スナップショット ==== 
 バックアップが行われるマシンは "ソースマシン" と呼ばれ、復元が行われるマシンは "ターゲットマシン" と呼ばれます。 バックアップが行われるマシンは "ソースマシン" と呼ばれ、復元が行われるマシンは "ターゲットマシン" と呼ばれます。
 +
 +</WRAP>
  
   * ソースマシンにて   * ソースマシンにて
  
-1) 設定ファイル "elasticsearch.yml" を編集します。+Modify the configuration file ''elasticsearch.yml'':
  
-  vi /etc/elasticsearch/elasticsearch.yml+設定ファイル "elasticsearch.yml" を編集します。 
 + 
 +<code bash> 
 +vi /etc/elasticsearch/elasticsearch.yml 
 + 
 +</code> 
 + 
 +Add the following line:
  
 次の行を追加します。 次の行を追加します。
  
-  path.repo: /usr/local/var/backups/+<code> 
 +path.repo: /usr/local/var/backups/
  
-{{ wiki: Elk1.png?600 }}+</code>
  
-2) 設定ファイルに追記したディレクトリを作成します。+Create the directory previously added to the configuration file:
  
-  mkdir -p /usr/local/var/backups/+設定ファイルに追記したディレクトリを作成します。
  
-3) ディレクトリのパーミッションとユーザを設定します。+<code bash> 
 +mkdir -p /usr/local/var/backups/
  
-<code> 
- chmod 700 /usr/local/var/backups 
- chown elasticsearch:elasticsearch /usr/local/var/backups 
 </code> </code>
  
-4) サービスを再起動します。+Grant read and write permissions to directory and user:
  
-  /etc/init.d/elasticsearch restart+ディレクトリのパーミッションとユーザを設定します。
  
-5) 次のコマンドでバックアップを作成します。+<code bash> 
 +chmod 700 /usr/local/var/backups 
 +chown elasticsearch:elasticsearch /usr/local/var/backups
  
-  curl -XPUT http://localhost:9200/_snapshot/my_backup -d '{"type": "fs", "settings": {"compress": "true", "location": "/usr/local/var/backups/"}}'+</code>
  
-6) 生成されたバックアップをアカイブファイルにします。+Restart service: 
 + 
 +ビスを再起動します。 
 + 
 +<code bash> 
 +/etc/init.d/elasticsearch restart
  
-<code> 
- cd /usr/local/var/ 
- tar -zcvf elastic_backup.tar.gz backups/ 
 </code> </code>
  
-7) リストアを行うターゲットマシンへ、ソースマシンのバックアップファイルをコピーします。+Make backup:
  
-  * ターゲトマシンにて+クアップを作成します。
  
-  scp -P 41122 root@<ipOrigen>:/root/elastic_backup.tar.gz /home/user/backup+<code bash> 
 +curl -XPUT http://localhost:9200/_snapshot/my_backup -d '{"type": "fs", "settings": {"compress": "true", "location": "/usr/local/var/backups/"}}}' 
 + 
 +</code> 
 + 
 +Compress backup: 
 + 
 +バックアップを圧縮します。 
 + 
 +<code bash> 
 +cd /usr/local/var/ 
 +tar -zcvf elastic_backup.tar.gz backups/ 
 + 
 +</code> 
 + 
 +From the target machine copy the compressed backup of the source machine. 
 + 
 +リストアを行うターゲットマシンへ、ソースマシンのバックアップファイルをコピーします。 
 + 
 +<code bash> 
 +scp -P 41122 root@<dir_ip_origin>:/root/elastic_backup.tar.gz /home/user/backup 
 + 
 +</code> 
 + 
 +<WRAP center round tip 90%> 
 + 
 +  * To use the **scp** command, an SSH server must be installed on the source machine and at least one SSH client must be installed on the target machine. 
 +  * It is important that the version of Elasticsearch on the target machine is compatible with the data export, i.e. in this case the source machine must have the same or higher version. If not, you must first upgrade Elasticsearch on the target machine.
  
-<WRAP center round tip 60%> 
-'scp' コマンドを利用するには、ソースマシンに ssh サーバがインストールされ、ターゲットマシンに ssh クライアントがインストールされている必要があります。 
 </WRAP> </WRAP>
  
-<WRAP center round important 60%> +<WRAP center round tip 90%> 
-インポートするマシンの ElasticSearch のバージョンがデータのエクスポートをサポートしていることが重要です。上記の例では、ターゲットマシンの ElasticSearch はソースマシンと同じもしくはそれ以上のバージョンである必要があります。そうでなければ、最初に ElasticSearch をアップデートする必要があります。+ 
 +  * **scp** コマンドを利用するには、ソースマシンに ssh サーバがインストールされ、ターゲットマシンに ssh クライアントがインストールされている必要があります。 
 +  * インポートするマシンの ElasticSearch のバージョンがデータのエクスポートをサポートしていることが重要です。上記の例では、ターゲットマシンの ElasticSearch はソースマシンと同じもしくはそれ以上のバージョンである必要があります。そうでなければ、最初に ElasticSearch をアップデートする必要があります。 
 </WRAP> </WRAP>
  
-==== バックアップのリストア ====+<wrap #ks2 /> 
 + 
 +===== バックアップのリストア ====
 + 
 +  * **On the target machine** 
   * ターゲットマシンにて   * ターゲットマシンにて
  
-1) ソースマシンでバックアップを作成するときに行ったのと同じように、設定ファイルの "elasticsearch.yml" を編集します。+Modify the configuration file ''elasticsearch.yml'' in the same way as in [[#ks1|create the backup on the source machine]]:
  
-  vi /etc/elasticsearch/elasticsearch.yml+[[#ks1|ソースマシンでバックアップを作成]]するときに行ったのと同じように、設定ファイルの "elasticsearch.yml" を編集します。 
 + 
 +<code bash> 
 +vi /etc/elasticsearch/elasticsearch.yml 
 + 
 +</code> 
 + 
 +Add the following line:
  
 次の行を追加します。 次の行を追加します。
  
-  path.repo: /usr/local/var/backups/+<code> 
 +path.repo: /usr/local/var/backups/
  
-{{ wiki: Elk2.png?600 }}+</code>
  
-2) 設定ファイルに追記したディレクトリを作成します。+Create the directory previously added to the configuration file:
  
-  mkdir -p /usr/local/var/backups/+設定ファイルに追記したディレクトリを作成します。
  
-3) ディレクトリのパーミッションとユーザを設定します。+<code bash> 
 +mkdir -p /usr/local/var/backups/
  
-<code> 
- chmod 700 /usr/local/var/backups 
- chown elasticsearch:elasticsearch /usr/local/var/backups 
 </code> </code>
  
-4) サービスを再起動します。+Grant read and write permissions to the directory:
  
-  /etc/init.d/elasticsearch restart+ディレクトリのパーミッションとユーザを設定します。
  
-5) ソースマシンからコピーしたバックアップを展開します。+<code bash> 
 +chmod 700 /usr/local/var/backups 
 +chown elasticsearch:elasticsearch /usr/local/var/backups
  
-  tar -xzvf /home/user/backup/elastic_backup.tar.gz -C /usr/local/var/backups+</code>
  
-6) スナップショットがある場所でリポジトリを作成します。+Restart the service:
  
-<code>+サービスを再起動します。 
 + 
 +<code bash> 
 +/etc/init.d/elasticsearch restart 
 + 
 +</code> 
 + 
 +Unzip the backup imported from the source machine: 
 + 
 +ソースマシンからコピーしたバックアップを展開します。 
 + 
 +<code bash> 
 +tar -xzvf /home/user/backup/elastic_backup.tar.gz -C /usr/local/var/backups 
 + 
 +</code> 
 + 
 +Create the repositories where the snapshots are located: 
 + 
 +スナップショットがある場所でリポジトリを作成します。 
 + 
 +<code bash>
 curl -X PUT "localhost:9200/_snapshot/my_backup" -H 'Content-Type: application/json' -d' curl -X PUT "localhost:9200/_snapshot/my_backup" -H 'Content-Type: application/json' -d'
  
行 107: 行 205:
 } }
 ' '
 +
 +</code>
 +
 +Close the indexes:
 +
 +インデックスを閉じます。
 +
 +<code bash>
 +curl -XPOST http://localhost:9200/< indexes_names >-*/_close
 +
 </code> </code>
  
-7) インデックスを閉じます。+<WRAP center round tip 90%>
  
-  curl -XPOST http://localhost:9200/<indexname>-*/_close+The asterisk shows all indexes starting with that name, ''indexes_names >''.
  
-<WRAP center round tip 60%> 
-アスタリスクは、その名前で始まるすべてのインデックスを示します。 
 </WRAP> </WRAP>
  
-8) バックアップをインポートします。+<WRAP center round tip 90%>
  
-最初にックアップリポジトリへコピーします。+アスタリスクはその名前 ''< indexes_names >'' で始まるすべてのインデックします。
  
-  cp <name of the snapshot.dat> my_backup_location/+</WRAP>
  
-大文字を使わずにファイル名を変更します。+Import the backup, first copy the backup to the repository:
  
-  mv my_backup_location/<name of snapshot.dat> my_backup_location/snap1+バックアップをリポジトリにインポートします。
  
-以下が重要です。+<code bash> 
 +cp <name_snapshot.dat> my_backup_location/
  
-  curl -X POST "localhost:9200/_snapshot/my_backup/snap1/_restore?wait_for_completion=true"+</code>
  
-9) 最後に、インデックスを再度開きます。+Rename the file without capital letters:
  
-  curl -XPOST http://localhost:9200/<indexname>-*/_open+ファイル名を大文字なしに変更します。 
 + 
 +<code bash> 
 +mv my_backup_location/<name_snapshot.dat> my_backup_location/snap1 
 + 
 +</code> 
 + 
 +Finally, it is imported: 
 + 
 +インポートされます。 
 + 
 +<code bash> 
 +curl -X POST "localhost:9200/_snapshot/my_backup/snap1/_restore?wait_for_completion=true" 
 + 
 +</code> 
 + 
 +Finally, reopen the indexes: 
 + 
 +最後に、インデックスを再度開きます。 
 + 
 +<code bash> 
 +curl -XPOST http://localhost:9200/< indexes_names >-*/_open 
 + 
 +</code>
  
 [[ja:documentation:start|Pandora FMS ドキュメント一覧に戻る]] [[ja:documentation:start|Pandora FMS ドキュメント一覧に戻る]]
 +
  • ja/documentation/pandorafms/technical_annexes/16_elastic_search_backup.1623936950.txt.gz
  • 最終更新: 2021/06/17 13:35
  • by 127.0.0.1