rocketmq 3.0.2 · sir5kong/rocketmq
helm repo add rocketmq https://helm-charts.itboon.top/rocketmq
helm pull rocketmq/rocketmq
tar -xvf rocketmq-3.0.2.tgz
修改这个无效
/root/rocketmq/rocketmq/templates/borker/configmap.yaml
文件头有注释 {{/* 3.0 废弃 */}}
vi /root/rocketmq/rocketmq/templates/configmap.yaml
data:
broker-base.conf: |
brokerClusterName = {{ .Values.clusterName }}
{{- range $key, $value := .Values.broker.config }}
{{ $key }} = {{ $value }}
{{- end }}
namesrvAddr=你的外网地址加端口:3xxxx
brokerIP1=你的外网地址
listenPort=30911
将10911改成30911,k8s对外端口30000以上
此时如此优秀的RocketMQ也会把你的10909和10912也会改成3打头的 30909(VIP) 30912(HA)
参考:RcoketMQ连接时报错sendDefaultImpl call timeout解决_rcoketmq send call timeout-CSDN博客
配置文件中的配置项:RocketMQ配置解析:手把手教老婆看懂broker.properties-CSDN博客
vi /root/rocketmq/rocketmq/templates/broker/statefulset.yaml
全换成3打头的
ports:
- containerPort: 30909
name: vip
protocol: TCP
- containerPort: 30911
name: main
protocol: TCP
- containerPort: 30912
name: ha
protocol: TCP
vi broker-svc.yaml
apiVersion: v1
kind: Service
metadata:
name: rocketmq-standalone-broker-master-svc-0
labels:
spec:
type: NodePort
ports:
- name: vip
nodePort: 30909
port: 30909
targetPort: 30909
protocol: TCP
- name: main
nodePort: 30911
port: 30911
targetPort: 30911
protocol: TCP
- name: ha
nodePort: 30912
port: 30912
targetPort: 30912
protocol: TCP
selector:
app.kubernetes.io/name: rocketmq
broker: rocketmq-standalone-broker-master
component: broker
statefulset.kubernetes.io/pod-name: rocketmq-standalone-broker-master-0
kubectl apply -f broker-svc.yaml -n develop
spec:
type: NodePort
ports:
nodePort: 3xxxx
helm install rocketmq-standalone /root/rocketmq/rocketmq \
--namespace develop \
--set image.tag="5.1.4" \ #使用新版本
--set image.repository="apache/rocketmq" \ #或者你的私有仓库
--set broker.persistence.storageClass="你的storageClass" --debug
kubectl logs -f rocketmq-standalone-broker-master-0 -n develop
kubectl describe pod rocketmq-standalone-broker-master-0 -n develop
kubectl get pods -n develop -owide |grep rocket
kubectl get svc -n develop |grep rocket
rocketmq-standalone-broker-master-svc-0 NodePort 30909:30909/TCP,30911:30911/TCP,30912:30912/TCP
helm uninstall rocketmq-standalone -n develop
参考:SpringBoot集成RocketMQ(完整demo)_用springboot写一个简单使用rocketmq的demo-CSDN博客
http://localhost:8080/test?msg=hello
for i in {1..100}; do curl http://localhost:8080/test?msg=hello && echo ""; done