用rocketmq-operator部署rocketmq集群2-nameserver部署

  sre


用rocketmq-operator部署rocketmq集群1-operator部署
用rocketmq-operator部署rocketmq集群2-nameserver部署
用rocketmq-operator部署rocketmq集群3-broker部署
用rocketmq-operator部署rocketmq集群4-console部署

官方的nameserver直接用svc来提供服务的话,多个nameserver分配到的brocker列表有可能不同,这里直接用多svc来写死:

pvc data-namesrv1 data-namesrv2

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: data-namesrv1
  namespace: rocketmq
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: "10Gi"
  volumeName: 
  storageClassName: nas
--- 
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: data-namesrv2
  namespace: rocketmq
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: "10Gi"
  volumeName: 
  storageClassName: nas

Deployment Service namesrv1

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    rocketmq: namesrv1
    app: rocketmq
  name: namesrv1
  namespace: rocketmq
spec:
  replicas: 1
  selector:
    matchLabels:
      rocketmq: namesrv1
      app: rocketmq
  template:
    metadata:
      labels:
        rocketmq: namesrv1
        app: rocketmq
    spec:
      containers:
      - name: namesrv1
        image: apacherocketmq/rocketmq-nameserver:4.5.0-alpine-operator-0.3.0
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 9876
          name: namesrv
          protocol: TCP

        volumeMounts:  
          - mountPath: /data/rocketmq/nameserver
            name: data-nameserver
      volumes:
       - name: data-nameserver
         persistentVolumeClaim:
           claimName: data-namesrv1
---
kind: Service
apiVersion: v1
metadata:
  labels:
    rocketmq: namesrv1
    app: rocketmq
  name: namesrv1
  namespace: rocketmq
spec:
  ports:
  - name: namesrv
    port: 9876
    targetPort: 9876
    protocol: TCP
  selector:
    rocketmq: namesrv1
    app: rocketmq

Deployment Service namesrv2

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    rocketmq: namesrv2
    app: rocketmq
  name: namesrv2
  namespace: rocketmq
spec:
  replicas: 1
  selector:
    matchLabels:
      rocketmq: namesrv2
      app: rocketmq
  template:
    metadata:
      labels:
        rocketmq: namesrv2
        app: rocketmq
    spec:
      containers:
      - name: namesrv2
        image: apacherocketmq/rocketmq-nameserver:4.5.0-alpine-operator-0.3.0
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 9876
          name: namesrv
          protocol: TCP

        volumeMounts:  
          - mountPath: /data/rocketmq/nameserver
            name: data-nameserver
      volumes:
       - name: data-nameserver
         persistentVolumeClaim:
           claimName: data-namesrv2
---
kind: Service
apiVersion: v1
metadata:
  labels:
    rocketmq: namesrv2
    app: rocketmq
  name: namesrv2
  namespace: rocketmq
spec:
  ports:
  - name: namesrv
    port: 9876
    targetPort: 9876
    protocol: TCP
  selector:
    rocketmq: namesrv2
    app: rocketmq

One Reply to “用rocketmq-operator部署rocketmq集群2-nameserver部署”

LEAVE A COMMENT

Captcha Code