0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Solace PubSub+ Event BrokerをDocker Composeで動かしてみる

Posted at

ブローカの種類

PubSub+ソフトウェア・イベント・ブローカの種類

Solace PubSub±のソフトウェア・ブローカは、大きくStandardとEnterpriseに分けられます。
Solace PubSub+ Standard版は、Docker Hubで公開されており、いくつかの機能制限はあるものの無償で使用することができます。

この記事では、Standard版をMacOS上のDockerで起動する手順を紹介します。
なお、今回はdocker composeを使用しています。

solace/solace-pubsub-standardレポジトリ

docker searchコマンドでPubSub+のコンテナイメージを確認してみます。
レポジトリ名は、solace/solace-pubsub-standardです。

docker search solace/solace-pubsub-standard
bash-3.2$ docker search solace/solace-pubsub-standard
NAME                            DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
solace/solace-pubsub-standard   Solace PubSub+ is a unified message broker t…   16                   
bash-3.2$ 

ブローカの起動

docker-compose.ymlの作成

docker-compose.ymlのテンプレートは、以下のSolace LabsのGitHub上でサンプルが提供されています。

今回は、WebUI、SSHとRESTを有効にします。
SolaceのイベントブローカではSolace Messaging Format(SMF)プロトコルを用いる場合に、ポート番号55555を使用します。MacOSではポート番号55555が使用済みのため、MacOSでSMFを使用する場合は、SNF 55555の公開ポート番号を55555以外に変更してください。

version: '3.3'
services:
  primary:
    container_name: solace
    image: solace/solace-pubsub-standard:latest
    shm_size: 2g
    ulimits:
      core: 1
      nofile:
        soft: 2448
        hard: 6592
    deploy:
      restart_policy:
        condition: on-failure
        max_attempts: 1
    ports:
      #Web transport
      - '8008:8008'
      #SEMP / PubSub+ Manager
      - '8080:8080'
      #REST Default VPN
      - '9000:9000'
      #REST Default VPN over TLS
      - '9443:9443'
      #SSH connection to CLI
      - '2222:2222'
    environment:
      - username_admin_globalaccesslevel=admin
      - username_admin_password=r00tme
      - system_scaling_maxconnectioncount=100

コンテナの初期化時に、ユーザ名などを環境変数を用いてブローカを設定することが可能です。
使用可能なキーは以下に記載されています。
スラッシュはアンダーバー(_)に置換して、environmentに指定します。

コンテナの起動 (docker compose up)

作成したdocker-compose.ymlを用いて、コンテナを起動します。

docker compose -f docker-compose.yml up -d
bash-3.2$ docker compose -f docker-compose.yml up -d
[+] Running 5/5
 ⠿ primary Pulled                                                                                                                                                                      27.2s
   ⠿ 1d6f30850896 Pull complete                                                                                                                                                         4.1s
   ⠿ 39751529f01e Pull complete                                                                                                                                                        15.8s
   ⠿ 4f4fb700ef54 Pull complete                                                                                                                                                        15.8s
   ⠿ 113360f5164b Pull complete                                                                                                                                                        24.1s
[+] Running 1/1
 ⠿ Container solace  Started                                                                                                                                                            0.9s
bash-3.2$ 

ブローカ(SolOS)へのアクセス

起動したブローカへアクセスするには3つの方法があります。

  • PubSub+ Broker Manager(WebUI)
  • SSHでブローカのSolOSに直接アクセス
  • docker execでシェルを起動して、SolOSにアクセス

ログインする際のユーザ名・パスワードは、docker-compose.ymlに指定したadmin/r00tmeを使用します。
なお、WebUI及びCLIアクセス以外にAPIによるアクセスも可能です。

PubSub+ Broker Manager (WebUI)

PubSub+ Managerのデフォルトのポート番号は8080で、
今回、docker-compose.ymlでそのままポート番号8080で外部にサービスを公開していますので、
http://localhost:8080/ にWebブラウザでアクセスします。

SSHでブローカのSolOSに直接アクセス

ソフトウェアブローカのSSHのデフォルトのポート番号は2222で、
今回、docker-compose.ymlでそのままポート番号2222で外部にサービスを公開していますので、
ターミナル上であれば ssh -p 2222 admin@localhost でアクセスします。

bash-3.2$ ssh -p 2222 admin@localhost
The authenticity of host '[localhost]:2222 ([::1]:2222)' can't be established.
ECDSA key fingerprint is SHA256:cMGs3PPL567U5N43m6OPaErenCnaCwcJ3CKUtGHh8dM.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[localhost]:2222' (ECDSA) to the list of known hosts.
Solace PubSub+ Standard
(admin@localhost) Password: 

Solace PubSub+ Standard Version 10.2.1.32

This Solace product is proprietary software of
Solace Corporation. By accessing this Solace product
you are agreeing to the license terms and conditions
located at http://www.solace.com/license-software

Copyright 2004-2022 Solace Corporation. All rights reserved.

To purchase product support, please contact Solace at: 
https://solace.com/contact-us/

Operating Mode: Message Routing Node

cf98fa4e922a> 
cf98fa4e922a> 

docker execでシェルを起動して、SolOSにアクセス

docker execコマンドでコンテナ内にcliコマンドを起動し、SolOSにアクセスします。
/bin/bashを起動し、cli -Aコマンドを実行しても構いません。

docker exec -it <container name> cli -A

bash-3.2$ docker exec -it solace cli -A

Solace PubSub+ Standard Version 10.2.1.32

This Solace product is proprietary software of
Solace Corporation. By accessing this Solace product
you are agreeing to the license terms and conditions
located at http://www.solace.com/license-software

Copyright 2004-2022 Solace Corporation. All rights reserved.

To purchase product support, please contact Solace at: 
https://solace.com/contact-us/

Operating Mode: Message Routing Node

cf98fa4e922a> 
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?