上一篇
求一份在kubernetes环境里面部署rockermq的文档?
- 行业动态
- 2024-04-29
- 1
部署RocketMQ在Kubernetes环境中需要以下步骤:
1、创建命名空间
2、创建持久化存储
3、部署NameServer
4、部署Broker
以下是详细的操作步骤:
1. 创建命名空间
apiVersion: v1 kind: Namespace metadata: name: rocketmq
将以上内容保存为namespace.yaml
,然后运行kubectl apply f namespace.yaml
。
2. 创建持久化存储
apiVersion: v1 kind: PersistentVolumeClaim metadata: name: rocketmqpvc namespace: rocketmq spec: accessModes: ReadWriteOnce resources: requests: storage: 1Gi storageClassName: manual apiVersion: v1 kind: PersistentVolumeClaim metadata: name: rocketmqnamesrvpvc namespace: rocketmq spec: accessModes: ReadWriteOnce resources: requests: storage: 1Gi storageClassName: manual
将以上内容保存为pvc.yaml
,然后运行kubectl apply f pvc.yaml
。
3. 部署NameServer
apiVersion: apps/v1 kind: Deployment metadata: name: rocketmqnamesrv namespace: rocketmq spec: replicas: 1 selector: matchLabels: app: rocketmqnamesrv template: metadata: labels: app: rocketmqnamesrv spec: containers: name: rocketmqnamesrv image: apacherocketmq/rocketmq:4.7.1 command: ["sh", "mqnamesrv"] env: name: ROCKETMQ_NAMESRV_ADDR value: "localhost:9876" ports: containerPort: 9876 volumeMounts: name: rocketmqnamesrvdata mountPath: /opt/rocketmq4.7.1/store/commitlog subPath: commitlog name: rocketmqnamesrvdata mountPath: /opt/rocketmq4.7.1/store/consumequeue subPath: consumequeue volumes: name: rocketmqnamesrvdata persistentVolumeClaim: claimName: rocketmqnamesrvpvc
将以上内容保存为namesrv.yaml
,然后运行kubectl apply f namesrv.yaml
。
4. 部署Broker
apiVersion: apps/v1 kind: Deployment metadata: name: rocketmqbroker namespace: rocketmq spec: replicas: 1 selector: matchLabels: app: rocketmqbroker template: metadata: labels: app: rocketmqbroker spec: containers: name: rocketmqbroker image: apacherocketmq/rocketmq:4.7.1 command: ["sh", "mqbroker", "n", "localhost:9876", "c", "/opt/rocketmq4.7.1/conf/2mnoslave/brokera.properties"] env: name: ROCKETMQ_BROKER_NAMESRV_ADDR value: "localhost:9876" ports: containerPort: 10911 containerPort: 10909 volumeMounts: name: rocketmqbrokerdata mountPath: /opt/rocketmq4.7.1/store/commitlog subPath: commitlog name: rocketmqbrokerdata mountPath: /opt/rocketmq4.7.1/store/consumequeue subPath: consumequeue volumes: name: rocketmqbrokerdata persistentVolumeClaim: claimName: rocketmqpvc
将以上内容保存为broker.yaml
,然后运行kubectl apply f broker.yaml
。
至此,RocketMQ已经在Kubernetes环境中部署完成。
本站发布或转载的文章及图片均来自网络,其原创性以及文中表达的观点和判断不代表本站,有问题联系侵删!
本文链接:http://www.xixizhuji.com/fuzhu/204093.html