ファイル・ストレージのパラレル・ツールの使用
パラレル・ファイル・ツール・スイートは、tar、rmおよびcpのパラレル・バージョンを提供します。これらのツールは大きなファイル・システムに対するリクエストをパラレル実行できるため、データ保護操作のパフォーマンスを最大化できます。
ツールキットには次のものが含まれています:
partar: tarballsをパラレルで作成および抽出するには、このコマンドを使用します。ノート
partarツールでは、GNUの基本的なtarPOSIX 1003.1-1990形式で作成されたtarファイルの抽出がサポートされています。他のアーカイブ形式(PAXなど)で作成されたファイルはサポートされていません。parrm: このコマンドを使用して、ディレクトリをパラレルで再帰的にremoveできます。parcp: ディレクトリをパラレルに再帰的にcopyするには、このコマンドを使用します。
パラレル・ファイル・ツールのインストール
ツール・スイートは、Oracle Linux、Red Hat Enterprise LinuxおよびCentOSのRPMとして配布されます。
Oracle Linuxインスタンスにパラレル・ファイル・ツールをインストールするには:
- 宛先インスタンスでターミナル・ウィンドウを開きます。
- 次のコマンドを入力します。
sudo yum install -y fss-parallel-tools
Oracle Linux 8インスタンスにパラレル・ファイル・ツールをインストールするには:
- 宛先インスタンスでターミナル・ウィンドウを開きます。
- 次のコマンドを使用して、必要に応じてOracle Linux開発者リポジトリをインストールします:
dnf install oraclelinux-developer-release-el8 - 次のコマンドを使用して、開発者リポジトリからパラレル・ファイル・ツールをインストールします:
dnf --enablerepo=ol8_developer install fss-parallel-tools
CentOSおよびRed Hat 6.xにパラレル・ファイル・ツールをインストールするには:
- 宛先インスタンスでターミナル・ウィンドウを開きます。
- 次のコマンドを入力します。
sudo wget http://yum.oracle.com/public-yum-ol6.repo -O /etc/yum.repos.d/public-yum-ol6.repo sudo wget http://yum.oracle.com/RPM-GPG-KEY-oracle-ol6 -O /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle sudo yum --enablerepo=ol6_developer install fss-parallel-tools
- 宛先インスタンスでターミナル・ウィンドウを開きます。
- 次のコマンドを入力します。
sudo wget http://yum.oracle.com/public-yum-ol7.repo -O /etc/yum.repos.d/public-yum-ol7.repo sudo wget http://yum.oracle.com/RPM-GPG-KEY-oracle-ol7 -O /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle sudo yum --enablerepo=ol7_developer install fss-parallel-tools
ツールの使用- 基本的な例
次に、Oracle Cloud Infrastructure File Storageでの様々なツールの一般的な使用方法の簡単な例を示します。
この例では、parcpを使用して、/source内のディレクトリ"folder"を/destinationにコピーします。-Pオプションは、使用するパラレル・スレッドの数を設定するために使用します。
$parcp -P 16 /source/folder /destination次の例では、parcpを使用して、/source内のディレクトリ"folder"のコンテンツを/destinationにコピーします。"folder"ディレクトリ自体はコピーされません。
$parcp -P 16 /source/folder/. /destination.tarアーカイブを作成し、それをtarballとしてディレクトリに格納します。次の例では、tarballの作成に使用されるディレクトリの名前はexampleです。 $partar pcf example.tar example -P 16exampleです。tarballは/testディレクトリ内に作成されます。$partar pcf example.tar example -P 16 -C /testツールの使用 - 高度な例
次に、より高度なシナリオでの様々なツールの使用方法の例を示します。
partarを使用して.tarアーカイブを作成するときに、どのファイルおよびフォルダを含めるかを指定できます。次のようなディレクトリがあるとします:
[opc@example sourcedir]$ ls -l
total 180
-rw-r-----. 1 opc opc 0 Apr 15 02:55 example2020-04-15_02-55-33_217107549.error
-rw-r-----. 1 opc opc 10 Apr 15 03:18 example2020-04-15_02-55-33_217107549.log
-rw-rw-r--. 1 opc opc 12 Apr 15 03:18 example2020-04-15_03-18-13_267771997.error
-rw-rw-r--. 1 opc opc 10 Apr 15 03:18 example2020-04-15_03-18-13_267771997.log
-rwxr-xr-x. 1 opc opc 37 Nov 30 2017 File1.txt
-rwxr-xr-x. 1 opc opc 15 Dec 1 2017 File2.txt
-rwxr-xr-x. 1 opc opc 39 Nov 30 2017 File3.txt
-rwxr-xr-x. 1 opc opc 57 Dec 1 2017 File4.txt
次のコマンドは、次のような.tarアーカイブを作成します:
- 指定した名前の
mydirディレクトリが含まれます。 File1.txt、File2.txt、File3.txtおよびFile4.txtが含まれます。- すべての
.logおよび.errorファイルが除外されます。 .tarボールが/sourcedirから/mnt/destinationdirに送信されます.tarアーカイブが抽出されます
[opc@example sourcedir]$ sudo partar cf - mydir --exclude '*.log*' --exclude '*.err*' | sudo partar xf - -C /mnt/destinationdir
/mnt/destinationdir/mytarでls -lを実行すると、目的のファイルのみがコピーされたことが表示されます。
[opc@example mytar]$ ls -l
total 148
-rwxr-xr-x. 1 opc opc 37 Nov 30 2017 File1.txt
-rwxr-xr-x. 1 opc opc 15 Dec 1 2017 File2.txt
-rwxr-xr-x. 1 opc opc 39 Nov 30 2017 File3.txt
-rwxr-xr-x. 1 opc opc 57 Dec 1 2017 File4.txtディレクトリまたはファイルをアーカイブから除外する場合は、そのディレクトリまたはファイルの名前のみを指定します。--excludeオプションでは、絶対パスの使用はサポートされていません。--excludeオプションで絶対パスを使用すると、指定したディレクトリまたはファイルは.tarアーカイブから除外されません。たとえば、testingというディレクトリをソース・ディレクトリのパスから除外する必要がある場合は、次のようなコマンドでそれを指定します:
sudo partar pczf name_of_tar_file.tar.gz /<path_source_directory> --exclude=testing
ソース・ディレクトリのパスにある
--excludeパターンと一致するすべてのファイルまたはディレクトリがpartarアーカイブから除外されます。parcpを使用して異なるディレクトリ間でコピーするときに、どのファイルおよびフォルダを含めるかを指定できます。次のようなディレクトリがあるとします:
[opc@example sourcedir]$ ls -l
total 180
-rw-r-----. 1 opc opc 0 Apr 15 02:55 example2020-04-15_02-55-33_217107549.error
-rw-r-----. 1 opc opc 10 Apr 15 03:18 example2020-04-15_02-55-33_217107549.log
-rw-rw-r--. 1 opc opc 12 Apr 15 03:18 example2020-04-15_03-18-13_267771997.error
-rw-rw-r--. 1 opc opc 10 Apr 15 03:18 example2020-04-15_03-18-13_267771997.log
-rwxr-xr-x. 1 opc opc 37 Nov 30 2017 File1.txt
-rwxr-xr-x. 1 opc opc 15 Dec 1 2017 File2.txt
-rwxr-xr-x. 1 opc opc 39 Nov 30 2017 File3.txt
-rwxr-xr-x. 1 opc opc 57 Dec 1 2017 File4.txtまず、除外するファイルのリストを含む.txtファイルを作成します。この例では、/home/opc/list.txtです。
次のコマンドは、sourcedirの内容を/mnt/destinationdirにコピーします。また:
File1.txt、File2.txtおよびFile3.txtがコピーされます。/home/opc/list.txtに示すように、File4.txtファイル、.logファイル、.errorファイルが除外されます。
[opc@example ~]$ cat /home/opc/list.txt
File4.txt
*.log*
*.err*
[opc@example ~]$ date; time sudo parcp --exclude-from=/home/opc/list.txt -P 16 --restore /sourcedir /mnt/destinationdir;
date Mon Jun 1 15:58:30 GMT 2020
real 9m55.820s
user 0m3.602s
sys 1m5.441s
Mon Jun 1 16:08:25 GMT 2020/mnt/destinationdirでls -lを実行すると、目的のファイルのみがコピーされたことが表示されます。[opc@example destinationdir]$ ls -l
total 91
-rwxr-xr-x. 1 opc opc 37 Nov 30 2017 File1.txt
-rwxr-xr-x. 1 opc opc 15 Dec 1 2017 File2.txt
-rwxr-xr-x. 1 opc opc 39 Nov 30 2017 File3.txtparcpでの--restoreオプションは、rsyncで-a -r -xおよび-Hオプションを使用するのと似ています。(rsync(1) - Linuxのmanページを参照してください。)-Pオプションは、使用するパラレル・スレッドの数を設定するために使用します。
restoreオプションには次の動作が含まれます:
- ディレクトリの中を再帰的に処理
- ファイル・システムの境界で停止
- ハード・リンク、シンボリック・リンク、権限、変更時間、グループ、所有者および特殊ファイル(
named socketsやfifoファイルなど)を保持
$parcp -P 16 --restore /source/folder/ /destinationparcpを--restoreおよび--deleteオプションとともに使用して、ソース・フォルダとターゲット・フォルダ間でファイルを同期できます。これは、rsyncをパラレルに使用することと同じです。ソース・ディレクトリのファイルが追加または削除された場合、このコマンドを定期的に実行して、宛先ディレクトリに同じファイルを追加または削除できます。cronジョブでこのコマンド・オプションを使用することで、同期を自動化できます。
sudo parcp -P 32 --restore --delete /source/folder/ /destination