• Docker部署ActiveMq


    一、ActiveMq配置文件

    1.网页用户访问密码

    修改conf/activemq.xml,在 broker 标签下,找到 shutdownHooks标签。在这个标签后面添加以下内容。

    <!-- destroy the spring context on shutdown to stop jetty -->
        <shutdownHooks>
          <bean xmlns="http://www.springframework.org/schema/beans" class="org.apache.activemq.hooks.SpringContextHook" />
        </shutdownHooks>
        <!-- add plugins -->
        <plugins>
          <simpleAuthenticationPlugin>
            <users>
              <authenticationUser username="${activemq.username}" password="${activemq.password}" groups="users,admins"/>
            </users>
          </simpleAuthenticationPlugin>
        </plugins>
      </broker>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13

    修改conf/jetty.xml 修改 authenticate 修改成true(一般是默认true的)
    在这里插入图片描述

    然后打开conf/jetty-realm.properties。 此处是管理界面登录时的用户名和密码
    在这里插入图片描述
    用户名:密码,角色; 根据这个修改即可。修改完成后,重新启动,使用新的账号和密码即可登录成功。

    2.设置订阅发布角色密码

    文件在/conf/credentials.properties
    在这里插入图片描述

    二、Dockerfile配置

    Dockefile

    # 获取镜像文件
    FROM docker.io/webcenter/activemq 
    #配置文件 注意以下文件需在同级目录下
    ADD activemq.xml /opt/activemq/conf/activemq.xml
    ADD credentials.properties /opt/activemq/conf/credentials.properties
    ADD jetty-realm.properties /opt/activemq/conf/jetty-realm.properties
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    进入docker 容器:docker exec -it activemq sh
    查看刚刚进入的目录: pwd

    三、执行脚本

    start.sh

    #!/bin/bash
    #查询镜像
    #docker search activemq
    #取start最多的镜像
    #docker pull docker.io/webcenter/activemq 
    docker build -t docker.io/webcenter/activemq:latest .
    docker stop activemq | true
    docker rm activemq | true
    #启动镜像容器
    docker run   --network parking-net --network-alias activemq --restart always -p 61616:61616 -p 8161:8161 -d --name activemq docker.io/webcenter/activemq 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10

    在这里插入图片描述

  • 相关阅读:
    Sentinel集成Nacos对流控与降级规则的持久化
    剑指 Offer 62 圆圈中最后剩下的数字 Java
    维度建模中的事实表设计原则
    神经网络基础
    PCB如何入门---一些经验与教训
    ios照片误删怎么恢复,iphone已经删除的照片怎么恢复
    支付系统 — 支付路由
    package.json,package-lock.json,yarn.lock
    5年时间,从外包测试到自研,最后到阿里,这5年的经历只有自己能知道....
    if else 替换方案
  • 原文地址:https://blog.csdn.net/qq_40286424/article/details/125544484