子ページ
  • クラスタリング設定

比較バージョン

キー

  • この行は追加されました。
  • この行は削除されました。
  • 書式設定が変更されました。
コメント: Migrated to Confluence 5.3

...

...

  • 技術ガイドに従って構築する2台以上のIdPを対象とします。

  • RDBサーバはIdPサーバとは独立したサーバとします。
  • RDBサーバでは、CentOS 6付属のMySQL 5.1が起動しているものとします。MySQLがインストールされていない場合は、yumでインストールしてください。
  • マシンのホスト名は下記とします。

    サービス提供用ホスト名idp.example.ac.jp
    1台目の実ホスト名idp1.example.ac.jp
    2台目の実ホスト名idp2.example.ac.jp
    RDBサーバのホスト名db.example.ac.jp

3.2. 設定手順

ヒント
IdPv3はストレージを統一的に扱いますので、3.2.1、3.2.4および3.2.6で行った設定をuApproveJP等で同意情報のストレージとして用いることが可能です。

3.2.1. MySQLの設定

db.example.ac.jpのMySQLの設定を行います。

...

...

  1. IdPにMySQLへのアクセスに必要なMySQL Connector/J (mysql-connector-java.jar)をインストールします。

    パネル
    titleMySQL Connector/Jのインストール

    # yum install mysql-connector-java

  2. /usr/share/java 配下にインストールされているので、Tomcat 配下のlib ディレクトリにシンボリックリンクを作成します。配下にインストールされているので、edit-webapp/ 配下のlib ディレクトリにシンボリックリンクを作成し、build.shコマンドを実行してidp.warに含めます。

    パネル
    titleMySQL Connector/Jの配置

    # rpm -ql mysql-connector-java
    (省略)
    /usr/share/java/mysql-connector-java.jar
    (省略)
    # ln -s /usr/share/java/mysql-connector-java.jar ${CATALINA_BASE}/lib/ /opt/shibboleth-idp/edit-webapp/WEB-INF/lib/

    # /opt/shibboleth-idp/bin/build.sh
    Installation Directory: [/opt/shibboleth-idp]
    [Enter]
     ←入力なし

    Rebuilding /opt/shibboleth-idp/war/idp.war ...
    ...done

    BUILD SUCCESSFUL
    Total time: 3 seconds

3.2.5. idp.session.StorageServiceの設定変更

...

パネル
titleconf/global.xml の修正

<!-- Use this file to define any custom beans needed globally. -->
<bean id="shibboleth.JPAStorageService"
      class="org.opensaml.storage.impl.JPAStorageService"
      p:cleanupInterval="%{idp.storage.cleanupInterval:PT10M}"
      c:factory-ref="shibboleth.JPAStorageService.entityManagerFactory" />

<bean id="shibboleth.JPAStorageService.entityManagerFactory"
      class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
     <property name="packagesToScan" value="org.opensaml.storage.impl" />
     <property name="dataSource" ref="shibboleth.MySQLDataSource" />
     <property name="jpaVendorAdapter" ref="shibboleth.JPAStorageService.JPAVendorAdapter" />
     <property name="jpaDialect">
          <bean class="org.springframework.orm.jpa.vendor.HibernateJpaDialect" />
     </property>
</bean>

<bean id="shibboleth.JPAStorageService.JPAVendorAdapter"
      class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"
      p:database="MYSQL" />

<bean id="shibboleth.MySQLDataSource"
      class="org.apache.tomcat.dbcp.dbcp.BasicDataSource"
      p:driverClassName="com.mysql.jdbc.Driver"
      p:url="jdbc:mysql://db.example.ac.jp:3306/shibboleth"
      p:username="shibboleth"
      p:password="shibpassword"
      p:maxActive="10"
      p:maxIdle="5"
      p:maxWait="15000"
      p:testOnBorrow="true"
      p:validationQuery="select 1"
      p:validationQueryTimeout="5" />

...

  1. LVSサーバにkeepalivedとipvsadmをインストールします。

    パネル
    titlekeepalivedのインストール

    # yum install keepalived ipvsadm

  2. keepalivedの設定を行います。

    パネル
    titlekeepalived.confの設定

    global_defs {
       notification_email {
           root@localhost
       }
       notification_email_from lvs@lvs.example.ac.jp
       smtp_server 127.0.0.1
       smtp_connect_timeout 30
       router_id lvs.example.ac.jp
    }


    vrrp_instance VI_1 {

       state BACKUP
       interface eth0
       virtual_router_id 51    # 他のVRRPの値と重複しないようにすること
       priority 200
       advert_int 1
       authentication {
           auth_type PASS
           auth_pass 1111      # 任意のパスワード(最大8文字)
       }
       virtual_ipaddress {
           203.0.113.10/24 dev eth0
       }
       nopreempt
    }


    virtual_server 203.0.113.10 443 {

       delay_loop 5
       lvs_sched sh
       lvs_method DR
       protocol TCP


       real_server 203.0.113.11 443 {

           weight 1
           SSL_GET {
               url {
                   path /idp/css/main.css
                   status_code 200
               }
               connect_port 443
               connect_timeout 3
               nb_get_retry 3
               delay_before_retry 3
           }
       }
       real_server 203.0.113.12 443 {
           weight 1
           SSL_GET {
               url {
                   path /idp/css/main.css
                   status_code 200
               }
               connect_port 443
               connect_timeout 3
               nb_get_retry 3
               delay_before_retry 3
           }
       }
    }


    virtual_server 203.0.113.10 8443 {

       delay_loop 5
       lvs_sched sh
       lvs_method DR
       protocol TCP


       real_server 203.0.113.11 8443 {

           weight 1
           SSL_GET {
               url {
                   path /idp/css/main.css
                   status_code 200
               }
               connect_port 443
               connect_timeout 3
               nb_get_retry 3
               delay_before_retry 3
           }
       }
       real_server 203.0.113.12 8443 {
           weight 1
           SSL_GET {
               url {
                   path /idp/css/main.css
                   status_code 200
               }
               connect_port 443
               connect_timeout 3
               nb_get_retry 3
               delay_before_retry 3
           }
       }
    }

  3. keepalivedを起動します。

    パネル
    titlekeepalivedの起動

    # chkconfig keepalived on
    # chkconfig --list keepalived
    keepalived     0:off 1:off 2:on 3:on 4:on 5:on 6:off
    # service keepalived start

  4. keepalivedが正しく動作しているか確認します。

    パネル
    titlekeepalivedの動作確認

    # ipvsadm -L -n
    IP Virtual Server version 1.2.1 (size=4096)
    Prot LocalAddress:Port Scheduler Flags
      -> RemoteAddress:Port           Forward Weight ActiveConn InActConn
    TCP 203.0.113.10:443 sh
      -> 203.0.113.11:443             Local   1      0          0
      -> 203.0.113.12:443             Local   1      0          0
    TCP 203.0.113.10:8443 sh
      -> 203.0.113.11:8443            Local   1      0          0
      -> 203.0.113.12:8443            Local   1      0          0

     

    # ip addr show dev eth0 scope global
    2: eth0: <BROADCAST,MULTICAST,ALLMULTI,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
        link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff
        inet 203.0.113.1/24 brd 203.0.113.255 scope global eth0
        inet 203.0.113.10/24 scope global secondary eth0

...

  1. keepalivedの設定を行います。

    パネル
    titlekeepalived.confの設定

    global_defs {
       notification_email {
           root@localhost
       }
       notification_email_from vrrp@idp1.example.ac.jp
       smtp_server 127.0.0.1
       smtp_connect_timeout 30
       router_id idp1.example.ac.jp
    }

    vrrp_instance VI_1 {
       state BACKUP
       interface eth0
       virtual_router_id 51    # 他のVRRPの値と重複しないようにすること
       priority 200
       advert_int 1
       authentication {
           auth_type PASS
           auth_pass 1111      # 任意のパスワード(最大8文字)
       }
       virtual_ipaddress {
           203.0.113.10/24 dev eth0
       }
       nopreempt
       smtp_alert
    }


    virtual_server 203.0.113.10 443 {
       delay_loop 5
       lvs_sched sh
       lvs_method NAT
       protocol TCP


       real_server 127.0.0.1 443 {
           weight 1
           notify_down "/sbin/service keepalived stop"
           SSL_GET {
               url {
                   path /idp/css/main.css
                   status_code 200
               }
               connect_port 443
               connect_timeout 3
               nb_get_retry 3
               delay_before_retry 3
           }
       }
    }

  2. keepalivedを起動します。

    パネル
    titlekeepalivedの起動

    # chkconfig keepalived on
    # chkconfig --list keepalived
    keepalived     0:off 1:off 2:on 3:on 4:on 5:on 6:off
    # service keepalived start

  3. keepalivedが正しく動作しているか確認します。

    パネル
    titlekeepalivedの動作確認

    # ipvsadm -L -n
    IP Virtual Server version 1.2.1 (size=4096)
    Prot LocalAddress:Port Scheduler Flags
      -> RemoteAddress:Port           Forward Weight ActiveConn InActConn
    TCP 203.0.113.10:443 sh
      -> 127.0.0.1:443                Local   1      0          0

    # ip addr show dev eth0 scope global
    2: eth0: <BROADCAST,MULTICAST,ALLMULTI,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
        link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff
        inet 203.0.113.11/24 brd 203.0.113.255 scope global eth0
        inet 203.0.113.10/24 scope global secondary eth0

...

  1. keepalivedの設定を行います。

    パネル
    titlekeepalived.confの設定

    global_defs {
       notification_email {
           root@localhost
       }
       notification_email_from vrrp@idp2.example.ac.jp
       smtp_server 127.0.0.1
       smtp_connect_timeout 30
       router_id idp2.example.ac.jp
    }

    vrrp_instance VI_1 {
       state BACKUP
       interface eth0
       virtual_router_id 51    # idp1と同じ値とすること
       priority 100
       advert_int 1
       authentication {
           auth_type PASS
           auth_pass 1111      # idp1と同じ値とすること
       }
       virtual_ipaddress {
           203.0.113.10/24 dev eth0
       }
       nopreempt
       smtp_alert
    }


    virtual_server 203.0.113.10 443 {
       delay_loop 5
       lvs_sched sh
       lvs_method NAT
       protocol TCP


       real_server 127.0.0.1 443 {
           weight 1
           notify_down "/sbin/service keepalived stop"
           SSL_GET {
               url {
                   path /idp/css/main.css
                   status_code 200
               }
               connect_port 443
               connect_timeout 3
               nb_get_retry 3
               delay_before_retry 3
           }
       }
    }


  2. keepalivedを起動します。

    パネル
    titlekeepalivedの起動

    # chkconfig keepalived on
    # chkconfig --list keepalived
    keepalived     0:off 1:off 2:on 3:on 4:on 5:on 6:off
    # service keepalived start


  3. keepalivedが正しく動作しているか確認します。

    パネル
    titlekeepalivedの動作確認

    # ipvsadm -L -n
    IP Virtual Server version 1.2.1 (size=4096)
    Prot LocalAddress:Port Scheduler Flags
      -> RemoteAddress:Port           Forward Weight ActiveConn InActConn
    TCP 203.0.113.10:443 sh
      -> 127.0.0.1:443                Local   1      0          0

    # ip addr show dev eth0 scope global
    2: eth0: <BROADCAST,MULTICAST,ALLMULTI,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
        link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff
        inet 203.0.113.12/24 brd 203.0.113.255 scope global eth0