本站总访问量 activemq搭建 - Jerry的小站

Jerry Gao

上帝就是真理,真理就是上帝

Apache ActiveMQ® 是最流行的开源、多协议、基于 Java 的消息代理。它支持行业标准协议,因此用户可以从多种语言和平台的客户端选择中获益。可从 JavaScript、C、C++、Python、.Net 等语言编写的客户端进行连接。使用无处不在的 AMQP 协议集成多平台应用程序。通过 webockets 使用 STOMP 在网络应用程序之间交换信息。使用 MQTT 管理物联网设备。支持现有的JMS基础架构及更多。ActiveMQ具有强大的功能和灵活性,可以支持任何消息传递使用情况。

选择镜像

1
docker pull webcenter/activemq

Dockerhub 镜像地址

Kubernetes 部署

service和pvc都以部署在Google Cloud的Kubernetes平台为例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: activemq-data
namespace: stable-db
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Gi
storageClassName: standard-rwo
volumeMode: Filesystem
---
kind: StatefulSet
apiVersion: apps/v1
metadata:
name: activemq
namespace: stable-db
labels:
app: activemq
spec:
replicas: 1
selector:
matchLabels:
app: activemq
template:
metadata:
labels:
app: activemq
spec:
volumes:
- name: activemq-data
persistentVolumeClaim:
claimName: activemq-data
containers:
- name: activemq
image: webcenter/activemq
env:
- name: ACTIVEMQ_CONFIG_MINMEMORY
value: "512"
- name: ACTIVEMQ_CONFIG_MAXMEMORY
value: "2048"
ports:
- containerPort: 8161
protocol: TCP
- containerPort: 61616
protocol: TCP
resources:
limits:
cpu: "1"
memory: 2Gi
ephemeral-storage: 10Gi
requests:
cpu: "1"
memory: 2Gi
ephemeral-storage: 10Gi
volumeMounts:
- name: activemq-data
mountPath: /data
---
apiVersion: v1
kind: Service
metadata:
name: activemq
namespace: stable-db
annotations:
cloud.google.com/l4-rbs: "enabled"
labels:
app: activemq
spec:
loadBalancerIP: <公网IP>
type: LoadBalancer
externalTrafficPolicy: Cluster
ports:
- port: <8161对应的公网端口>
nodePort: <8161对应的公网端口>
targetPort: 8161
protocol: TCP
name: tcp-8161
- port: <61616对应的公网端口>
nodePort: <61616对应的公网端口>
targetPort: 61616
protocol: TCP
name: tcp-61616
selector:
app: activemq
  • 通过 kubectl apply -f activemq.yaml 部署
  • ACTIVEMQ_CONFIG_MINMEMORY: 启动时占用的初始内存,单位为MB
  • ACTIVEMQ_CONFIG_MAXMEMORY: 最大内存,单位为MB,默认为 1024MB
  • 8161: activemq 控制台端口
  • 61616: activemq 连接端口

Docker Compose 部署

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
version: '3'
services:
activemq:
image: webcenter/activemq
deploy:
resources:
limits:
cpus: '1'
memory: 2G
reservations:
cpus: '1'
memory: 2G
container_name: activemq
restart: always
environment:
ACTIVEMQ_CONFIG_MINMEMORY: "512"
ACTIVEMQ_CONFIG_MAXMEMORY: "2048"
ports:
- "8161:8161"
- "61616:61616"
volumes:
- /data/activemq:/data

评论