5 ExadataへのOracle Machine Learning for Rのインストール
この章では、Oracle Exadataデータベース・マシンへのOracle R DistributionおよびOML4Rサーバーのインストール方法を説明します。この章の内容は、次のとおりです。
- Exadata上のOracle Machine Learning for Rについて
 ExadataはOML4Rに最も適したプラットフォームです。
- DCLIを使用したExadataへのOracle Machine Learning for Rのインストール
 DCLIを使用して、ExadataへのOML4Rのインストールを簡略化できます。
- DCLIを使用しないOracle Machine Learning for RのOracle RACへのインストール
 DCLIを使用できない場合に、Oracle Real Application Clusters (Oracle RAC)データベースにOML4Rをインストールする方法。
5.1 ExadataでのOracle Machine Learning for Rについて
ExadataはOML4Rに最も適したプラットフォームです。
OML4RのR計算の並列リソースは、Exadataの大規模なパラレル・グリッド・インフラストラクチャを活用します。
ノート:
OML4Rのバージョンは、サーバーと各クライアント・コンピュータで同じである必要があります。また、Rのバージョンは、サーバーと各クライアント・コンピュータで同じである必要があります。サポートされている構成については、「Oracle Machine Learning for Rのデータベース・ユーザーの作成」を参照してください。OML4RをExadataにインストールするには:
- 
                           各ノードで、次の手順を実行します。 - 
                                 Oracle R Distributionのインストール 
- 
                                 環境の確認および構成 
- 
                                 OML4RサーバーおよびSupporting Packagesのインストール 
 
- 
                                 
- 
                           最初のノードでのみ、必要に応じてOML4Rユーザーを作成します。または、OML4Rを使用するように既存のデータベース・ユーザーを構成します。次を参照してください。 
分散コマンドライン・インタフェース(DCLI)を使用することで、ExadataへのOML4Rのインストール・プロセスを簡略化できます。
5.2 DCLIを使用したExadataへのOracle Machine Learning for Rのインストール
DCLIを使用してExadataへのOML4Rのインストールを簡略化できます。
DCLIを使用することで、1つのコマンドを使用して、複数のExadataコンピュート・ノードにOracle R DistributionおよびOML4Rサーバーをインストールできます。次の例に、このユーティリティの基本構文を説明する、DCLIのヘルプ・オプションの出力を示します。
関連項目:
DCLIの詳細は、My Oracle SupportのWebサイトに移動し、カスタマ・サポートIDでログインして、検索ボックスにDCLIと入力してください。
                     
例5-1 DCLIのヘルプ・オプションの出力
$ dcli -h
 
Distributed Shell for Oracle Storage
 
This script executes commands on multiple cells in parallel threads.
The cells are referenced by their domain name or ip address.
Local files can be copied to cells and executed on cells.
This tool does not support interactive sessions with host applications.
Use of this tool assumes ssh is running on local host and cells.
The -k option should be used initially to perform key exchange with
cells.  User may be prompted to acknowledge cell authenticity, and
may be prompted for the remote user password.  This -k step is serialized
to prevent overlayed prompts.  After -k option is used once, then
subsequent commands to the same cells do not require -k and will not require
passwords for that user from the host.
Command output (stdout and stderr) is collected and displayed after the
copy and command execution has finished on all cells.
Options allow this command output to be abbreviated.
Return values:
 0 -- file or command was copied and executed successfully on all cells
 1 -- one or more cells could not be reached or remote execution returned
      non-zero status.
 2 -- An error prevented any command execution
Examples:
 dcli -g mycells -k
 dcli -c stsd2s2,stsd2s3 vmstat
 dcli -g mycells cellcli -e alter iormplan active
 dcli -g mycells -x reConfig.scl
 
usage: dcli [options] [command]
options:
 --version           show program's version number and exit
 -c CELLS            comma-separated list of cells
 -d DESTFILE         destination directory or file
 -f FILE             file to be copied
 -g GROUPFILE        file containing list of cells
 -h, --help          show help message and exit
 -k                  push ssh key to cell's authorized_keys file
 -l USERID           user to login as on remote cells (default: celladmin)
 -n                  abbreviate non-error output
 -r REGEXP           abbreviate output lines matching a regular expression
 -s SSHOPTIONS       string of options passed through to ssh
 --scp=SCPOPTIONS    string of options passed through to scp if different from
                     sshoptions
 --serial            serialize execution over the cells
 -t                  list target cells
 --unkey             drop keys from target cells' authorized_keys file
 -v                  print extra messages to stdout
 --vmstat=VMSTATOPS  vmstat command options
 -x EXECFILE         file to be copied and executed
次の各トピックでは、DCLIを使用したOML4Rコンポーネントのインストールについて説明しています。
- DCLIを使用したExadataコンピュート・ノードへのOracle R Distributionのインストール
 複数のExadataのLinuxコンピュート・ノードにOracle R DistributionをインストールするためのDCLIの実行方法。
- DCLIを使用した12c以前のExadataコンピュート・ノードへのOML4Rサーバーのインストール
 DCLIを使用してOracle Database 12c以前の複数のExadata Linuxコンピュート・ノードにOML4Rサーバーをインストールする方法。
- DCLIを使用した18c以降のExadataコンピュート・ノードへのOML4Rサーバーのインストール
 DCLIを使用してOracle Database 18c以降の複数のExadata Linuxコンピュート・ノードにOML4Rサーバーをインストールする方法。
- Oracle Machine Learning for Rサーバー用のDCLIコマンドのサマリー
 次の例に、Linux ExadataシステムへのOML4RおよびSupporting Packagesのインストールで使用するDCLIコマンドをリストします。
5.2.1 DCLIを使用したExadataコンピュート・ノードへのOracle R Distributionのインストール
複数のExadata Linuxコンピュート・ノードにOracle R DistributionをインストールするためのDCLIの実行方法。
コマンドは、ExadataへのOracle R Distributionインストール用のDCLIコマンドのサマリーにまとめられています。
重要:
インストールを開始する前に、Oracle Machine Learning for R向けのRのインストールでOracle R Distributionのインストール手順を確認してください。
DCLIを使用してExadataにOracle R Distributionをインストールするには、次のステップを実行します。
- 
                              各計算ノードでDCLIに対する自動認証を有効化するようにExadata環境を構成します。 - 
                                    rootユーザーのSSH公開キー-秘密キーを生成します。任意のノードで次のコマンドをrootで実行します。 $ ssh-keygen -N '' -f /.ssh/id_dsa -t dsa このコマンドによって、rootユーザーのホーム・ディレクトリの .sshサブディレクトリに公開キーおよび秘密キーのファイルが生成されます。
- 
                                    テキスト・エディタで、ラック内のすべての計算ノードの名前を含むファイルを作成します。1行に1つのノード名を指定します。たとえば、2ノード・クラスタの nodesファイルには、次のようなエントリが含まれます。$ cat nodes exadb01 exadb02 
- 
                                    全ノードでSSH信頼を確立するために、 -kオプションを使用してDCLIコマンドを実行します。-kオプションによって、DCLIが各ノードに順に(並行にではなく)接触し、各ノードのパスワードの入力が求められます。$ dcli -t -g nodes -l root -k -s "\-o StrictHostkeyChecking=no" -kを使用したDCLIは、SSH信頼およびユーザー等価関係を確立します。この後のDCLIコマンドではパスワードの入力は求められません。
 
- 
                                    
- 
                              インターネット接続が使用できる場合はyumを使用してOracle R Distributionをインストールします。それ以外の場合は、Oracle R Distributionおよびオペレーティング・システムの依存関係を手動でインストールします。 ord-linux-x86_64-Rversion-Exadataversion.tar.gzファイルをOracle Supportにリクエストします。ここでのRversionは、インストールするOracle R Distributionのバージョンであり、Exadataversionは、imageinfoコマンドの実行によるExadataバージョンの出力です。- 
                                    My Oracle Supportにログインします。 
- 
                                    問合せをクリックします。 
- 
                                    yumおよびインターネット・アクセスを使用できない場合は、My Oracle Supportからこのファイルへのアクセスをリクエストします。 ord-linux-x86_64-Rversion-Exadataversion.tar.gz 
- 
                                    権限が付与されたら、rootとして任意の計算ノードにログインし、ファイルをダウンロードします。 
 
- 
                                    
- 
                              ディレクトリを作成し、このディレクトリにダウンロードしたファイルをすべてのノードにレプリケートします。たとえば、次のコマンドは、ディレクトリ /home/oracle/ORDを作成し、ファイルord-linux-x86_64-Rversion-Exadataversion.tar.gzをこのディレクトリにレプリケートします。$ dcli -t -g nodes -l root mkdir -p /home/oracle/ORD $ dcli -t -g nodes -l root -f ord-linux-x86_64-Rversion-Exadataversion.tar.gz -d /home/oracle/ORD/ord-linux-x86_64-Rversion-Exadataversion.tar.gz
- 
                              このファイルを圧縮解除およびuntarして、全ノードに依存RPMをレプリケートします。 $ dcli -t -g nodes -l root tar xvfz /home/oracle/ORD/ord-linux-x86_64-Rversion-Exadataversion.tar.gz -C /home/oracle/ORD $ ls /home/oracle/ORD/ord-linux-x86_64-Rversion-Exadataversion.tar.gzまたは、Oracle Public YumサーバーからこれらのRPMをダウンロードすることもできます。RPMの場所は、RPMを使用したOracle LinuxへのOracle R Distributionのインストールにリストされています。 
- 
                              新しいRPMをインストールし、全ノードの既存のRPMを更新するには、次のRPMコマンドを実行します。 $ dcli -t -g nodes -l root rpm -i --force /home/oracle/ORD/ord-linux-x86_64-Rversion-Exadataversion/*.rpm--forceフラグによって、循環依存のエラーが発生しません。
- 
                              Rがインストールされている場所に戻ってからRを開始することによって、各ノードでRインストールを確認します。 $ dcli -g nodes -l oracle R RHOME exadb01: /usr/lib64/R exadb02: /usr/lib64/R ノードごとに、次のコマンドは示されている出力を返します。 $ dcli -g nodes -l oracle R --vanilla ... exadb01: R is free software and comes with ABSOLUTELY NO WARRANTY. exadb01: You are welcome to redistribute it under certain conditions. exadb01: Type 'license()' or 'licence()' for distribution details. exadb01: exadb01: Natural language support but running in an English locale exadb01: exadb01: R is a collaborative project with many contributors. exadb01: Type 'contributors()' for more information and exadb01: 'citation()' on how to cite R or R packages in publications. exadb01: exadb01: Type 'demo()' for some demos, 'help()' for on-line help, or exadb01: 'help.start()' for an HTML browser interface to help. exadb01: Type 'q()' to quit R. exadb01: exadb01: You are using Oracle's distribution of R. Please contact exadb01: Oracle Support for any problems you encounter with this exadb01: distribution. 
- ExadataへのOracle R Distributionインストール用のDCLIコマンドのサマリー
 次の例に、Linux ExadataシステムへのOracle R Distributionのインストールで使用するDCLIコマンドをリストします。
5.2.1.1 ExadataへのOracle R Distributionインストール用のDCLIコマンドのサマリー
次の例に、Linux ExadataシステムへのOracle R Distributionのインストールで使用するDCLIコマンドをリストします。
versionを、ご使用のOracle R Distributionのバージョン番号に置き換えます。
                           
例5-2 Oracle R Distribution用のDCLIコマンドのサマリー
ssh-keygen -N " -f ~/.ssh/id_dsa -t dsa
vi nodes # enter node names
dcli -t -g nodes -l root -k -s "\-o StrictHostkeyChecking=no" 
dcli -t -g nodes -l root mkdir -p /home/oracle/ORD
dcli -t -g nodes -l root -f ord-linux-x86_64-version.tar.gz -d
           /home/oracle/ORD/ord-linux-x86_64-version.tar.gz 
dcli -t -g nodes -l root tar xvfz /home/oracle/ORD
           /ord-linux-x86_64-version.tar.gz -C /home/oracle/ORD
dcli -t -g nodes -l root rpm -i --force
           /home/oracle/ORD/ord-linux-x86_64-version/*.rpm
dcli -g nodes -l root R RHOME
dcli -g nodes -l root R --vanilla5.2.2 12c以前のDCLIを使用したExadataコンピュート・ノードへのOML4Rサーバーのインストール
DCLIを使用してOracle Database 12c以前の複数のExadata Linuxコンピュート・ノードにOML4Rサーバーをインストールする方法。
DCLIコマンドは、Oracle Machine Learning for Rサーバー用のDCLIコマンドのサマリーにまとめられています。
ノート:
インストールを開始する前に、Oracle Machine Learning for RサーバーのインストールでOML4Rサーバーのインストール手順を確認してください。
Oracle Database 12c以前でDCLIを使用してExadataにOML4Rサーバーをインストールするには、次のステップに従います。
- 
                              ORACLE_HOME、ORACLE_SID、R_HOME、PATHおよびLD_LIBRARY_PATHを、各ノードに適切に設定し、DCLIスクリプトを実行するシェルと同じシェルに定義します。たとえば、bashrcファイルで次のように値を指定できます。export ORACLE_HOME=/hostname/app/oracle/product/release_number/dbhome_1 export ORACLE_SID=ORCL export R_HOME=/usr/lib64/R export PATH=$PATH:$R_HOME/bin:$ORACLE_HOME/bin export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib:$RHOME_lib:$R_HOME/port/Linux-X64/lib 
- 
                              Oracle Machine Learning for R DownloadsのWebサイトに移動します。 Downloadsページの「Linux 64-bit」の行で、「Server」を選択し、ライセンス契約に同意して、ファイルをダウンロードします。Supporting Packagesをダウンロードするには、「Supporting」を選択し、ライセンス契約に同意して、ファイルをダウンロードします。次のファイルがOML4Rに対してダウンロードされます。versionは、OML4Rのリリース番号です。 ore-server-linux-x86-64-version.zip ore-supporting-linux-x86-64-version.zip 
- 
                              rootとしてログインし、OML4RサーバーおよびSupporting Packagesのインストーラを全ノードにコピーします。次に例を示します。 $ dcli -g nodes -l oracle mkdir -p /home/oracle/OML4R $ dcli -g nodes -l oracle -f ore-server-linux-x86-64-version.zip -d /home/oracle/OML4R/ore-server-linux-x86-64-version.zip $ dcli -g nodes -l oracle -f ore-supporting-linux-x86-64-version.zip -d /home/oracle/OML4R/ore-supporting-linux-x86-64-version.zip 
- 
                              OML4Rサーバー・バンドルを各ノードで解凍します。 $ dcli -t -g nodes -l oracle unzip /home/oracle/OML4R/ore-server-linux-x86-64-version.zip -d /my_destination_directory/
- 
                              各ノードでSupporting Packagesを解凍します。 $ dcli -t -g nodes -l oracle unzip /home/oracle/OML4R/ore-supporting-linux-x86-64-version.zip -d /my_destination_directory/
- 
                              OML4R Serverコンポーネントをインストールします。 $ dcli -t -g nodes -l oracle "cd /my_destination_directory; ./server.sh -y --perm permtablespace --temp temptablespace --user-perm usertablespace --user-temp usertemptablespace --user OML_USER" ノート: serverスクリプトによって、OML4Rのユーザーが作成されます。デフォルトでは、ユーザーにRQADMINロールは付与されません。すべてのOML4Rユーザーは埋込みRを実行できますが、データベースのRスクリプトを作成および削除できるのはRQADMINロールを持つユーザーのみです。RQADMINロールを付与する場合は注意が必要です。 このロールの詳細は、RQADMINロールについてを参照してください。 
- 
                              OML4Rのロードを確認します。 > library(ORE) Loading required package: OREbase Attaching package: OREbase The following objects are masked from âpackage:baseâ: cbind, data.frame, eval, interaction, order, paste, pmax, pmin, rbind, table Loading required package: OREembed Loading required package: OREstats Loading required package: MASS Loading required package: OREgraphics Loading required package: OREeda Loading required package: OREmodels Loading required package: OREdm Loading required package: lattice Loading required package: OREpredict Loading required package: ORExml
5.2.3 18c以降のDCLIを使用したExadataコンピュート・ノードへのOML4Rサーバーのインストール
DCLIを使用してOracle Database 18c以降の複数のExadata Linuxコンピュート・ノードにOML4Rサーバーをインストールする方法。
5.2.4 Oracle Machine Learning for Rサーバー用のDCLIコマンドのサマリー
次の例に、Linux ExadataシステムへのOML4RおよびSupporting Packagesのインストールで使用するDCLIコマンドをリストします。
例5-3 OML4Rサーバー用のDCLIコマンドのサマリー
dcli -g nodes -l oracle mkdir -p /home/oracle/ORE dcli -g nodes -l oracle -f ore-server-linux-x86-64-version.zip -d /home/oracle/ORE/ore-server-linux-x86-64-version.zip dcli -g nodes -l oracle -f ore-supporting-linux-x86-64-version.zip -d /home/oracle/ORE/ore-supporting-linux-x86-64-version.zip dcli -t -g nodes -l oracle unzip /home/oracle/ORE/ore-server-linux-x86-64-version.zip -d /home/oracle/ORE/ dcli -t -g nodes -l oracle /home/oracle/ORE/server.sh sqlplus / as sysdba grant RQADMIN to OML_USER; exit; dcli -t -g nodes -l oracle ORE -e "library(ORE)"
5.3 DCLIを使用しないOracle Machine Learning for RのOracle RACへのインストール
DCLIを使用できない場合に、Oracle Real Application Clusters (Oracle RAC)データベースにOML4Rをインストールする方法。
分散コマンドライン・インタフェース(DCLI)を使用できない場合は、Oracle RACクラスタの各データベース・インスタンスに次のコンポーネントを個別にインストールする必要があります。
- RまたはOracle R Distribution
- OML4Rサーバー
- OML4R Supporting Packages
最初の項では、Oracle Database 18c以降のインストール手順について説明します。2番目の項では、Oracle Database 12c以前の手順について説明します。
Oracle 18c以降のRAC環境でのOML4Rのインストール
次のステップに従って、Oracle R Distribution、OML4RおよびOML4R Supporting Packagesをインストールします。
- Oracle R DistributionのインストールOracle Machine Learning for R向けのRのインストールを参照してください。
- SQL*Plusを起動し、PDBに直接ログインしてrqcfg.sqlスクリプトを実行します。次の例では、PDBPDB1を使用し、スクリプト引数のサンプル値を指定します。SQL> sqlplus / as sysdba SQL> alter session set container=PDB1; SQL> ALTER PROFILE DEFAULT LIMIT PASSWORD_VERIFY_FUNCTION NULL; SQL> @$ORACLE_HOME/R/server/rqcfg.sql define permtbl = SYSAUX define temptbl = TEMP define orahome = /u01/app/oracle/product/21.3.0.0/dbhome_1 define rhome = /usr/lib64/R
- オペレーティング・システム・プロンプトで、ORACLE_HOME/binディレクトリに移動し、すべてのユーザーにOREディレクトリに対する読取りおよび実行権限を付与します。cd $ORACLE_HOME/bin chmod 755 ORE
- システムに適したOML4R 1.5.1 Supporting Packagesを格納するディレクトリを作成し、そのディレクトリに移動します。OML4R Supporting Packagesのインストールの説明に従って、そのディレクトリにSupporting Packagesのzipファイルをダウンロードします。
- Supporting Packagesを抽出します。
- パッケージごとに、オペレーティング・システム・コマンド・プロンプトで次のコマンドを実行します。ORE CMD INSTALL package
Oracle 12c以前のRAC環境でのOML4Rのインストール
次のステップに従って、Oracle R Distribution、OML4RおよびOML4R Supporting Packagesをインストールします。
ノート:
server.shスクリプトを実行するディレクトリと同じディレクトリで最初にOML4R Supporting Packagesのバンドルを抽出することで、ステップ2と3を同時に実行できます。(Microsoft Windowsの場合、スクリプトはserver.batです。)
                     - Oracle R DistributionのインストールOracle Machine Learning for R向けのRのインストールを参照してください。
- OML4Rサーバーのインストーラ・バンドルからserver.shスクリプトを実行します。Oracle Machine Learning for Rサーバーのインストールを参照してください
- OML4R Supporting Packagesをインストールします。Oracle Database 12c以前のOracle Machine Learning for Rサーバーのインストールを参照してください
server.shスクリプトをノード1で実行すると、OML4Rパッケージがオペレーティング・システムの$ORACLE_HOME/R/libraryディレクトリにインストールされます。また、OML4Rのデータベース・コンポーネントもインストールおよび構成されます。スクリプトの実行時に、プロンプトが表示された場合は新しいデータベース・ユーザーを作成できます。スクリプトの実行時にユーザーを作成できるのは、最初のノードでserver.shスクリプトを実行している間のみです。
                     
後続の各ノードでserver.shスクリプトを実行すると、OML4Rパッケージのみがオペレーティング・システムにインストールされます。