Sun N1 Grid Engine 6.1 インストールガイド

データベースソフトウェアの設定

アカウンティングおよびレポートコンソールをインストールし、使用するためには、事前にデータベースソフトウェアをインストールし、適切に構成する必要があります。この節では、PostgreSQL データベース、MySQL データベース、または Oracle データベースを使ってデータベースソフトを設定する方法について説明します。

N1 Grid Engine での PostgreSQL データベースソフトウェアの使用

PostgreSQL データベースソフトウェアの詳細は、Postgres のマニュアルを参照してください。

Procedureデータベースサーバーを起動する方法

PostgreSQL ソフトウェアのインストール後、データベースサーバーを起動できます。

始める前に

PostgreSQL データベースソフトウェアをダウンロードし、コンパイルし、インストールします。データベースプロセスの所有者になるユーザーを作成します。通常、このユーザーは postgres です。環境に、PostgreSQL bin ディレクトリと必要な LD_LIBRARY_PATH 設定を追加します。

  1. postgres ユーザーのホームディレクトリを作成します。

    この例では、ホームディレクトリは /space/postgres/data になります。


    % mkdir -p /space/postgres/data
    % useradd -d /space/postgres  postgres 
    % chown postgres /space/postgres/data
    % su - postgres
    
  2. PostgreSQL のマニュアルの説明に従って、データベースの設定を続行します。


    > initdb -D /space/postgres/data
    
    creating directory /space/postgres/data... ok
    creating directory /space/postgres/data/base... ok
    creating directory /space/postgres/data/global... ok
    creating directory /space/postgres/data/pg_xlog... ok
    creating directory /space/postgres/data/pg_clog... ok
    creating template1 database in /space/postgres/data/base/1... ok
    creating configuration files... ok
    initializing pg_shadow... ok
    enabling unlimited row size for system tables... ok
    initializing pg_depend... ok
    creating system views... ok
    loading pg_description... ok
    creating conversions... ok
    setting privileges on built-in objects... ok
    vacuuming database template1... ok
    copying template1 to template0... ok
    
    Success. You can now start the database server using:
       postmaster -D /space/postgres/data
       or
       pg_ctl -D /space/postgres/data -l logfile start
  3. pg_hba.conf ファイルに、次のような変更を加えます。

    その結果、データベースのスーパーユーザー postgres に、パスワード不要の無制限のアクセス権が付与されます。そして、その他のデータベースユーザーには、md5 暗号パスワードの使用が義務付けられます。末尾の 0 を除く nnn.nnn.nnn の部分は、実際のサブネットアドレスで置き換えます。また、ホスト IP アドレスに同様の行を追加して、ホスト単位でアクセス規則を追加することもできます。

    # TYPE  DATABASE  USER  IP-ADDRESS     IP-MASK         METHOD
    local   all       postgres                             trust
    local   all       all                                  md5
    # IPv4-style local connections:
    #host    all       all   nnn.nnn.nnn.0  255.255.255.0  md5
    
  4. postgresql.conf ファイルに次の変更を加えることにより、ほかのホストからの TCP/IP アクセスを有効にします。


    注 –

    shared_buffers の値が max_connections の値の 2 倍以上であることを確認します。


    tcpip_socket = true
    max_connections = 40   (increase if necessary)
  5. データベースを起動します。

    この例の -i は TCP/IP 通信、-S はサイレントモードを有効にします。


    > postmaster -S -i
    
  6. インストールを検証します。

    postgres ユーザーになり、次のコマンドを実行します。


    % su - postgres
    
    > createuser -P test_user
    Enter password for new user: 
    Enter it again: 
    Shall the new user be allowed to create databases? (y/n) y
    Shall the new user be allowed to create more new users? (y/n) n
    CREATE USER
    
    > createdb -O test_user -E UNICODE test
    CREATE DATABASE
  7. データベースのスーパーユーザーになり、コマンドを実行します。


     > psql test
    Welcome to psql 7.3, the PostgreSQL interactive terminal.
    Type:  \copyright for distribution terms
           \h for help with SQL commands
           \? for help on internal slash commands
           \g or terminate with semicolon to execute query
           \q to quit
           

    test=# create table test (x int, y text);
    CREATE TABLE
    test=# insert into test values (1, 'one');
    INSERT 16982 1
    test=# insert into test values (2, 'two');
    INSERT 16983 1
    test=# select * from test;
    x |  y
    ---+------
    1 | one
    2 | two
    (2 rows)
    
    test=# \q
    
     > psql -U test_user test
    Password: 
    Welcome to psql 7.4.1, the PostgreSQL interactive terminal.
    
    Type:  \copyright for distribution terms
           \h for help with SQL commands
           \? for help on internal slash commands
           \g or terminate with semicolon to execute query
           \q to quit
    test=> 
  8. データベースのテストが正常に完了したら、次のタスク、「PostgreSQL データベースを設定する方法」に進みます。

ProcedurePostgreSQL データベースを設定する方法

  1. データベースのスーパーユーザー、たとえば postgres としてログインします。


    # su - postgres
    
  2. データベースの所有者を作成します。


    > createuser -P arco_write
    Enter password for new user: 
    Enter it again: 
    Shall the new user be allowed to create databases? (y/n) y
    Shall the new user be allowed to create more new users? (y/n) n
    CREATE USER
  3. アカウンティングおよびレポート用のデータベースを作成します。


    > createdb -O arco_write arco
    CREATE DATABASE
  4. データベースを読み取るためのデータベースユーザーを作成します。

    arco_read ユーザーを使用しない場合、次の手順で使用する特権スクリプトの内容を修正する必要があります。


    > createuser -P arco_read
    Enter password for new user: 
    Enter it again: 
    Shall the new user be allowed to create databases? (y/n) n
    Shall the new user be allowed to create more new users? (y/n) n
    CREATE USER

N1 Grid Engine での Oracle データベースソフトウェアの使用

ProcedureOracle データベースを設定する方法

  1. データベース管理者に、Oracle データベースのインスタンスについて問い合わせます。

    このインスタンスは、データベースユーザー arco_writearco_read を必要とします。arco_write ユーザーには、テーブル、ビュー、インデックスを作成または変更する特権が付与されます。arco_read ユーザーの特権は、あとで SQL スクリプトによって設定されます。

  2. データベース管理者に、データベースの接続文字列を問い合わせます。

N1 Grid Engine での MySQL データベースソフトウェアの使用

アカウンティングおよびレポートコンソールではビューが使用されるため、コンソールでは MySQL データベースのバージョン 5.0.x 以上がサポートされています。MySQL データベースソフトウェアの詳細については、MySQL のマニュアル を参照してください。

MySQL データベースでの大文字と小文字の区別

MySQL では、データベースはデータディレクトリ内のディレクトリに対応しています。データベース内の各テーブルは、データベースディレクトリ内の 1 つ以上のファイルに対応しています。その結果、基礎となっているオペレーティングシステムで大文字と小文字が区別されるかどうかによって、データベース名とテーブル名で大文字と小文字が区別されるかどうかが決まります。したがって、ほとんどの種類の UNIX ではデータベース名とテーブル名で大文字と小文字が区別され、Windows では区別されません。

ProcedureUNIX システムに MySQL データベースをインストールする方法

  1. システムに応じた MySQL ソフトウェアを、http://www.mysql.com からダウンロードします。

    UNIX システムでの標準インストールディレクトリは /usr/local/mysql です。これとは異なるディレクトリにソフトウェアをインストールするには、パッケージに付属するスクリプトを変更する必要があります。


    注 –

    ARCo は Java Web ベースのアプリケーションであり、JDBC コールを MySQL データベースで使用されるネットワークプロトコルに変換するために、 JavaTM データベース接続 (JDBCTM) ドライバが必要です。JDBC ドライバは http://www.mysql.com/products/connector からダウンロードできます。


  2. インストールディレクトリから mysql へのシンボリックリンクを作成します。


    # ln -s $installation_directory/mysql-standard-5.0.26-solaris10-i386 mysql

    mysql ディレクトリには、いくつかのファイルとサブディレクトリがあります。

    • bin サブディレクトリには、クライアントプログラムとサーバーがあります。

      • MySQL サーバーおよびサーバー起動スクリプト。

        • mysqld は MySQL サーバーです。

        • mysqld_safemysql.server、および mysqld_multi はサーバー起動スクリプトです。

        • mysql_install_db では、データディレクトリと初期データベースが初期化されます。

        • mysqlmanager は MySQL インスタンスマネージャーです。

      • サーバーにアクセスするクライアントプログラム。

        • mysql は、SQL 文を対話的またはバッチモードで実行するためのコマンド行クライアントです。

        • mysqladmin は管理用クライアントです。

        • mysqlcheck では、テーブルの保守動作が実行されます。

        • mysqldump および mysqlhotcopy では、データベースのバックアップが作成されます。

        • mysqlimport では、データベースファイルがインポートされます。

        • mysqlshow では、データベースとテーブルに関する情報が表示されます。

      • サーバーから独立して動作するユーティリティープログラム。

        • myisamchk では、テーブルの保守動作が実行されます。

        • myisampack では、圧縮された読み取り専用のテーブルが作成されます。

        • mysqlbinlog は、バイナリのログファイルを処理するためのツールです。

        • perror では、エラーコードの意味が表示されます。

    • scripts サブディレクトリには、サーバーのアクセス権が格納された付与テーブルを含んだ mysql データベースの初期化に使用される mysql_install_db スクリプトがあります。

  3. mysqld のログインユーザーとグループを追加します。


    # groupadd mysql
    # useradd -g mysql mysql
  4. プログラムのバイナリの所有者を root に変更し、データディレクトリの所有者は mysqld の実行に使用するユーザーにします。


    # chown -R root .
    # chown -R mysql data
    # chgrp -R mysql .
  5. MySQL の付与テーブルを作成します。


    # scripts/mysql_install_db --user=mysql
  6. MySQL サーバーを起動します。


    # bin/mysqld_safe --user=mysql &
  7. root のパスワードを指定します。


    # ./bin/mysqladmin -u root password 'new-password'
    # ./bin/mysqladmin -u root -h ${hostname} password 'new-password'
MySQL インストールのヒント

ProcedureMySQL でアカウンティングおよびレポートデータベースを設定する方法

  1. データベースにスーパーユーザーでログインします。

    # mysql -u root -p<password>
  2. ユーザーを作成し、arco_read および arco_write の権限を与えます。

    mysql> GRANT ALL on *.* to 'arco_write'@'<hostname>' identified by '<password>' with GRANT OPTION;
    mysql> GRANT ALL on *.* to 'arco_write'@'localhost' identified by '<password>' with GRANT OPTION;
    mysql> GRANT ALL on *.* to 'arco_write'@'%' identified by '<password>' with GRANT OPTION;
    
    mysql> GRANT SELECT,SHOW VIEW on <db_name>.* to 'arco_read'@'<hostname>' identified by '<password>';
    mysql> GRANT SELECT,SHOW VIEW on <db_name>.* to 'arco_read'@'localhost' identified by '<password>';
    mysql> GRANT SELECT,SHOW VIEW on <db_name>.* to 'arco_read'@'%' identified by '<password>';
  3. データベースに arco_write ユーザーでログインします。

    # mysql -u arco_write -p<password>
  4. アカウンティングおよびレポートデータベースを作成します。

    mysql> CREATE DATABASE ARCO;
  5. アカウンティングおよびレポートソフトウェアをインストールします。