差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
ja:documentation:pandorafms:technical_annexes:16_elastic_search_backup [2024/08/22 08:21] – [Elastic Search バックアップ] junichi | ja:documentation:pandorafms:technical_annexes:16_elastic_search_backup [2024/10/11 22:56] (現在) – [Elastic Search バックアップ] junichi | ||
---|---|---|---|
行 1: | 行 1: | ||
- | ====== Elastic Search バックアップ ====== | + | ====== Elastic Search バックアップとリストア |
{{indexmenu_n> | {{indexmenu_n> | ||
行 6: | 行 7: | ||
<WRAP center round info 90%> | <WRAP center round info 90%> | ||
- | From NG 774 version, Pandora FMS incorporates [[en: | + | From NG 774 version, Pandora FMS incorporates [[:en: |
</ | </ | ||
行 22: | 行 23: | ||
<wrap #ks1 /> | <wrap #ks1 /> | ||
- | ===== ElasticSearch のバックアップとリストア (ELK) ===== | ||
- | スナップショットを使用した ElasticSearch サーバからのデータ移行は比較的高速です。 まず、サーバのデータのバックアップが作成され、後で復元するためにリポジトリに保存されます。 | + | ===== バックアップコピーの作成 |
+ | |||
+ | <WRAP center round info 90%> | ||
+ | |||
+ | The machine to be backed up is called the " | ||
+ | |||
+ | </ | ||
+ | |||
+ | <WRAP center round info 90%> | ||
- | ==== スナップショット ==== | ||
バックアップが行われるマシンは " | バックアップが行われるマシンは " | ||
+ | |||
+ | </ | ||
* ソースマシンにて | * ソースマシンにて | ||
- | 1) 設定ファイル "elasticsearch.yml" を編集します。 | + | Modify the configuration file '' |
- | | + | 設定ファイル " |
+ | |||
+ | <code bash> | ||
+ | vi / | ||
+ | |||
+ | </ | ||
+ | |||
+ | Add the following line: | ||
次の行を追加します。 | 次の行を追加します。 | ||
- | | + | < |
+ | path.repo: / | ||
- | {{ wiki: Elk1.png? | + | </ |
- | 2) 設定ファイルに追記したディレクトリを作成します。 | + | Create the directory previously added to the configuration file: |
- | mkdir -p / | + | 設定ファイルに追記したディレクトリを作成します。 |
- | 3) ディレクトリのパーミッションとユーザを設定します。 | + | <code bash> |
+ | mkdir -p / | ||
- | < | ||
- | chmod 700 / | ||
- | chown elasticsearch: | ||
</ | </ | ||
- | 4) サービスを再起動します。 | + | Grant read and write permissions to directory and user: |
- | / | + | ディレクトリのパーミッションとユーザを設定します。 |
- | 5) 次のコマンドでバックアップを作成します。 | + | <code bash> |
+ | chmod 700 / | ||
+ | chown elasticsearch: | ||
- | curl -XPUT http:// | + | </code> |
- | 6) 生成されたバックアップをアーカイブファイルにします。 | + | Restart service: |
+ | |||
+ | サービスを再起動します。 | ||
+ | |||
+ | <code bash> | ||
+ | / | ||
- | < | ||
- | cd / | ||
- | tar -zcvf elastic_backup.tar.gz backups/ | ||
</ | </ | ||
- | 7) リストアを行うターゲットマシンへ、ソースマシンのバックアップファイルをコピーします。 | + | Make backup: |
- | * ターゲットマシンにて | + | バックアップを作成します。 |
- | | + | <code bash> |
+ | curl -XPUT http:// | ||
+ | |||
+ | </ | ||
+ | |||
+ | Compress backup: | ||
+ | |||
+ | バックアップを圧縮します。 | ||
+ | |||
+ | <code bash> | ||
+ | cd / | ||
+ | tar -zcvf elastic_backup.tar.gz backups/ | ||
+ | |||
+ | </ | ||
+ | |||
+ | From the target machine copy the compressed backup of the source machine. | ||
+ | |||
+ | リストアを行うターゲットマシンへ、ソースマシンのバックアップファイルをコピーします。 | ||
+ | |||
+ | <code bash> | ||
+ | scp -P 41122 root@<dir_ip_origin>:/ | ||
+ | |||
+ | </ | ||
+ | |||
+ | <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%> | ||
- | ' | ||
</ | </ | ||
- | <WRAP center round important 60%> | + | <WRAP center round tip 90%> |
- | インポートするマシンの ElasticSearch のバージョンがデータのエクスポートをサポートしていることが重要です。上記の例では、ターゲットマシンの ElasticSearch はソースマシンと同じもしくはそれ以上のバージョンである必要があります。そうでなければ、最初に ElasticSearch をアップデートする必要があります。 | + | |
+ | * **scp** コマンドを利用するには、ソースマシンに ssh サーバがインストールされ、ターゲットマシンに ssh クライアントがインストールされている必要があります。 | ||
+ | * インポートするマシンの ElasticSearch のバージョンがデータのエクスポートをサポートしていることが重要です。上記の例では、ターゲットマシンの ElasticSearch はソースマシンと同じもしくはそれ以上のバージョンである必要があります。そうでなければ、最初に ElasticSearch をアップデートする必要があります。 | ||
</ | </ | ||
- | ==== バックアップのリストア ==== | + | <wrap #ks2 /> |
+ | |||
+ | ===== バックアップのリストア ===== | ||
+ | |||
+ | * **On the target machine** | ||
* ターゲットマシンにて | * ターゲットマシンにて | ||
- | 1) ソースマシンでバックアップを作成するときに行ったのと同じように、設定ファイルの "elasticsearch.yml" を編集します。 | + | Modify the configuration file '' |
- | | + | [[# |
+ | |||
+ | <code bash> | ||
+ | vi / | ||
+ | |||
+ | </ | ||
+ | |||
+ | Add the following line: | ||
次の行を追加します。 | 次の行を追加します。 | ||
- | | + | < |
+ | path.repo: / | ||
- | {{ wiki: Elk2.png? | + | </ |
- | 2) 設定ファイルに追記したディレクトリを作成します。 | + | Create the directory previously added to the configuration file: |
- | mkdir -p / | + | 設定ファイルに追記したディレクトリを作成します。 |
- | 3) ディレクトリのパーミッションとユーザを設定します。 | + | <code bash> |
+ | mkdir -p / | ||
- | < | ||
- | chmod 700 / | ||
- | chown elasticsearch: | ||
</ | </ | ||
- | 4) サービスを再起動します。 | + | Grant read and write permissions to the directory: |
- | / | + | ディレクトリのパーミッションとユーザを設定します。 |
- | 5) ソースマシンからコピーしたバックアップを展開します。 | + | <code bash> |
+ | chmod 700 / | ||
+ | chown elasticsearch: | ||
- | tar -xzvf /home/ | + | </code> |
- | 6) スナップショットがある場所でリポジトリを作成します。 | + | Restart the service: |
- | < | + | サービスを再起動します。 |
+ | |||
+ | < | ||
+ | / | ||
+ | |||
+ | </ | ||
+ | |||
+ | Unzip the backup imported from the source machine: | ||
+ | |||
+ | ソースマシンからコピーしたバックアップを展開します。 | ||
+ | |||
+ | <code bash> | ||
+ | tar -xzvf / | ||
+ | |||
+ | </ | ||
+ | |||
+ | Create the repositories where the snapshots are located: | ||
+ | |||
+ | スナップショットがある場所でリポジトリを作成します。 | ||
+ | |||
+ | <code bash> | ||
curl -X PUT " | curl -X PUT " | ||
行 125: | 行 205: | ||
} | } | ||
' | ' | ||
+ | |||
</ | </ | ||
- | 7) インデックスを閉じます。 | + | Close the indexes: |
- | | + | インデックスを閉じます。 |
+ | |||
+ | <code bash> | ||
+ | curl -XPOST http:// | ||
+ | |||
+ | </ | ||
+ | |||
+ | <WRAP center round tip 90%> | ||
+ | |||
+ | The asterisk shows all indexes starting with that name, ''< | ||
- | <WRAP center round tip 60%> | ||
- | アスタリスクは、その名前で始まるすべてのインデックスを示します。 | ||
</ | </ | ||
- | 8) バックアップをインポートします。 | + | <WRAP center round tip 90%> |
- | 最初に、バックアップをリポジトリへコピーします。 | + | アスタリスクは、その名前 ''< |
- | cp <name of the snapshot.dat> | + | </WRAP> |
- | 大文字を使わずにファイル名を変更します。 | + | Import the backup, first copy the backup to the repository: |
- | mv my_backup_location/< | + | バックアップをリポジトリにインポートします。 |
- | 以下が重要です。 | + | <code bash> |
+ | cp < | ||
- | curl -X POST " | + | </code> |
- | 9) 最後に、インデックスを再度開きます。 | + | Rename the file without capital letters: |
- | | + | ファイル名を大文字なしに変更します。 |
+ | |||
+ | <code bash> | ||
+ | mv my_backup_location/< | ||
+ | |||
+ | </ | ||
+ | |||
+ | Finally, it is imported: | ||
+ | |||
+ | インポートされます。 | ||
+ | |||
+ | <code bash> | ||
+ | curl -X POST " | ||
+ | |||
+ | </ | ||
+ | |||
+ | Finally, reopen the indexes: | ||
+ | |||
+ | 最後に、インデックスを再度開きます。 | ||
+ | |||
+ | <code bash> | ||
+ | curl -XPOST http:// | ||
+ | |||
+ | </ | ||
[[ja: | [[ja: | ||
+ |