CAP のセットアップ

管理サーバーで、下記手順にしたがってセットアップを行います。

インストール

  1. cap配下のconnexive_ap_ee_playbook.tar.gz を 展開します。

    # cd cap
    # tar -xzvf connexive_ap_ee_playbook.tar.gz
    
  2. 展開された release ディレクトリに移動します。

    # cd release/
    
  3. 「inventory_all-in-one ファイル」を編集します。

    # vi inventory_all-in-one
    

    [allin1]項目に以下の指定を行います(IP アドレスで指定します。「localhost」やホスト名での指定はできません)

    [allin1]
    127.0.0.1 ansible_connection=local
    
    ...
    
  4. 以下のコマンドを実行し、SELinuxの設定状態を確認します。表示結果が Enforcing の場合、Permissive または、Disabled に変更の上、再度以下のコマンドで設定状態を確認します。SELinux の設定は OS 再起動後も永続的に Permissive、または Disabled となるようにします。以下は Permissive に設定されている例です。

    # getenforce
    Permissive
    
  5. 以下のコマンドで Playbook を実行します。

    # ansible-playbook -i inventory_all-in-one CAP_EDM_allin1.yml
    
  6. Playbook の実行終了後に表示される PLAY RECAP を確認します。

    すべての環境構築先サーバーの実行結果が「failed=0」となっていれば、CAP のインストールは完了です。

    • (注意) failed=0 となっていない場合は Playbook の実行に失敗しているため、Playbook の実行ログ(install.log)を確認して失敗の原因を確認します。原因を解決し、後述の「アンインストール手順」を参照して CAP を一度アンインストールし、Playbook を再実行します。
  7. 以下のコマンドを実行します。

    # systemctl enable tomcat_8080.service
    # firewall-cmd --add-port=8080/tcp --zone=public --permanent
    # firewall-cmd --add-port=8060/tcp --zone=public --permanent
    # firewall-cmd --reload
    
  8. 以下のコマンド実行し、設定を編集します。

    # vi /opt/nec/pf/ice/config/backendapi1.config.json
    
         "baseUrl":"http://<構築対象サーバーIP>:80/fileserver/",
         "baseUrl":"http://<構築対象サーバーIP>:80/api/v1/backend/file/collection/",
    

MQTT接続認証(ID/パスワード認証)

MQTT接続時にID/パスワード認証を行う場合は、以下を設定します。

  1. 以下のコマンド実行し、設定ファイルを新規作成します。

    # vi /opt/nec/pf/ice/msgrouter_core/conf/login.config
    password {
        com.nec.connexive.ice.router.security.jaas.MessageRouterPasswordLoginModule sufficient debug=true;
    };
    
    certificate {
        com.nec.connexive.ice.router.security.jaas.MessageRouterCertificateLoginModule required debug=true;
    };
    
  2. 以下のコマンド実行し、設定ファイルを編集します。

    # vi /usr/lib/systemd/system/ice-message-router.service
    

    ExecStart= 行に以下の設定を追記します。行内の位置は com.nec.connexive.ice.router.Launcher の前に追加します。

    -Djava.security.auth.login.config=/opt/nec/pf/ice/msgrouter_core/conf/login.config
    

    以下は編集後のファイルイメージです。

    [Unit]
    Description=ICE message router
    After=network.target eep-iot-event-hub.service
    
    [Service]
    Type=simple
    ExecStart=/usr/bin/java -classpath '/opt/nec/pf/ice/msgrouter_core/lib/*' -Dlog4j.configurationFile=/opt/nec/pf/ice/msgrouter_core/conf/log4j2.xml -Djava.security.auth.login.config=/opt/nec/pf/ice/msgrouter_core/conf/login.config com.nec.connexive.ice.router.Launcher
    ~
    
  3. 以下のコマンド実行し、設定情報を確認します。

    # cat /opt/nec/pf/eep/application.json
    {
        "tenant1": {
            "application_id": "<アプリケーション ID>",
            "application_key": "<アプリケーションキー>",
            "master_key": "XXXXXX"
        }
    }
    
  4. 以下のコマンド実行し、上記の手順で確認した アプリケーション IDアプリケーションキー を含んだ設定情報を設定ファイルに追記します。

    # vi /opt/nec/pf/ice/msgrouter_core/conf/core_config.json
    {
        "mqtt": {
            "url": "mqtt+nio://0.0.0.0:1883",
            "authentication": {
                "type": "password",
                "server": {
                    "uri": "http://mbs-api-1:8060/api/1/tenant1/login",
                    "tenant": "tenant1",
                    "appId": "<アプリケーション ID>",
                    "appKey": "<アプリケーションキー>"
                }
            }
        },
        "mongodb": {
            "url": "mongodb://tenant1_db:MongoDB@mongodb-1:27017/rawdata?authSource=admin"
        }
    }
    
  5. 以下のコマンド実行し、サービスを再起動します。

    # systemctl daemon-reload
    # systemctl restart ice-message-router
    # systemctl restart tomcat_8430
    

エッジサーバ認証用ユーザーの追加

本手順によりエッジサーバがマネージャーへ接続する際のユーザー名、パスワードを設定します。

  1. http://<管理サーバーのIPアドレスまたはホスト名>:8080/console/developers/sign_in にブラウザからアクセスします。

  2. 管理画面にログインできることを確認します。認証情報は、/root/EDM2/cap/release/authentication_vars.ymlファイルを参照してください。

    • メールアドレス:baas_email_admin の値
    • パスワード:baas_password_admin の値
  3. ブラウザ画面上部から テナント プルダウンを選択し、tenant1 を選択します。

  4. 画面左のナビゲーションから ユーザ を選択します。

  5. 画面右上の 追加 ボタンを押下し、ユーザー情報を入力後、保存 ボタンを押下します。

    ユーザ名:{任意のユーザ名を指定}
    E-mail:{ユーザ名}@nec.com
    属性情報:{空白}
    パスワード:{任意のパスワードを指定}
    パスワード(確認):{任意のパスワードを指定}
    パスワードの自動生成:チェックしない
    ユーザの追加を E-mail 宛に通知:チェックしない
    グループ:チェックしない
    

ファイル収集の認証設定

本設定は、以下の機能にパスワード認証設定を行うかを指定します。

  • エッジサーバからファイル収集を行う際、マネージャ接続時にパスワード認証を行う
  • EDM 操作画面から収集したファイルをダウンロードする際、利用者がパスワード認証を行う

パスワード認証が必要な場合、不要な場合で設定内容が異なりますのでご注意ください。

パスワード認証が必要な場合

  1. EDM Manager サーバー上で以下のコマンドを実行し、ファイルダウンロード用ユーザのアカウントを登録します

    # cd /etc/nginx/
    # htpasswd ./.htpasswd {エッジサーバ認証用ユーザーの E-mail}
    > {エッジサーバ認証用ユーザーのパスワード}
    

パスワード認証が不要な場合

  1. Nginx の設定ファイルを編集し、auth_basic, auth_basic_user_file のコメントアウトします。

    # cd /etc/nginx/conf.d/locations
    # vi backendapi.conf
    location /api/v1/backend/file/collection/ {
        #auth_basic "Restricted";
        #auth_basic_user_file /etc/nginx/.htpasswd;
        proxy_request_buffering off;
        proxy_intercept_errors on;
        proxy_connect_timeout 10;
        proxy_send_timeout 600;
        proxy_read_timeout 600;
        proxy_pass http://backendapi_v1/api/v1/backend/file/collection/;
        error_page 413 500 502 503 504 =500 /50x.json;
    }
    
  2. Nginx を再起動します。

    # systemctl restart nginx
    # systemctl status nginx
    -> Active: active (running) であること
    

15000 台以上の同時接続を行う場合の設定

本設定は、エッジサーバの同時接続数が 15000 台以上となる場合に必要となります。それ以外の場合は設定不要です。

  1. 設定ファイルを編集し、LimitNOFILEの値を 65535 へ変更します。

    # vi /etc/systemd/system/eep-iot-event-hub.service.d/limits.conf
    LimitNOFILE=65535
    
  2. 設定ファイルを以下の内容で新規作成します。

    # vi /etc/systemd/system/ice-message-router.service.d/limits.conf
    [Service]
    LimitNOFILE=65535
    
  3. サービスの再起動を行います。

    # systemctl daemon-reload
    # systemctl restart eep-iot-event-hub
    # systemctl restart ice-message-router
    

動作確認

  1. 以下のコマンドを実行し、サービスの状態を確認します。

  2. 各サービスが enabled になっている

  3. 各サービスが Active: active (running) になっている

    # systemctl status tomcat_8060.service
    # systemctl status tomcat_8080.service
    # systemctl status tomcat_8430.service
    # systemctl status ice-message-router
    # systemctl status eep-iot-event-hub
    ...
    
  4. ファイアウォールで、下記のとおりポートが開放されていることを確認します。

    # firewall-cmd --list-all
    public (active)
      ...
      ports: 1883/tcp 8883/tcp 80/tcp 443/tcp 22402/tcp 22401/tcp 8080/tcp 8060/tcp
      ...
    
  5. ブラウザからhttp://<管理サーバーのIPアドレスまたはホスト名>:8080/console/developers/sign_inへアクセスします。

  6. 管理画面にログインできることを確認します。認証情報は、/root/EDM2/cap/release/authentication_vars.ymlファイルを参照してください。

    • メールアドレス:baas_email_admin の値
    • パスワード:baas_password_admin の値
  7. 以下のコマンドを実行します。

    # curl --proxy '' -X GET http://localhost/api/v1/edge
    

    出力結果が以下であれば、CAP の REST API を使えることが確認できます。

    {"count":0,"results":[]}