• k8s 安装 rocketmq 集群


    代码地址:https://github.com/apache/rocketmq-operator.git

    1.克隆代码

    git clone https://github.com/apache/rocketmq-operator.git
    cd rocketmq-operator
    
    • 1
    • 2

    2.部署rocketmq-operator

    make deploy
    
    • 1

    注:执行此命令前要安装go

    yum -y install go
    
    • 1

    2.1安装错误1

    [root@k8smaster rocketmq-operator]# ./install-operator.sh
    go: creating new go.mod: module tmp
    Downloading sigs.k8s.io/controller-tools/cmd/controller-gen@v0.7.0
    go get: sigs.k8s.io/controller-tools/cmd/controller-gen@v0.7.0: Get "https://proxy.golang.org/sigs.k8s.io/controller-tools/cmd/controller-gen/@v/v0.7.0.info": dial tcp 172.217.160.113:443: i/o timeout
    make: *** [controller-gen] 错误 1
    [root@k8smaster rocketmq-operator]# 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    解决方法:

     export GOPROXY=https://goproxy.cn
    
    • 1

    2.2 安装错误2

    /root/rocketmq-operator/bin/controller-gen rbac:roleName=rocketmq-operator crd:generateEmbeddedObjectMeta=true webhook paths="./..." output:dir=deploy output:crd:artifacts:config=deploy/crds
    Error: err: exit status 1: stderr: go: github.com/google/uuid@v1.1.2: missing go.sum entry; to add it:
            go mod download github.com/google/uuid
    go: github.com/google/uuid@v1.1.2: missing go.sum entry; to add it:
            go mod download github.com/google/uuid
    
    • 1
    • 2
    • 3
    • 4
    • 5

    解决方法

    go mod tidy
    
    • 1

    3.验证

    kubectl get pods
    
    NAME                                      READY   STATUS    RESTARTS   AGE
    rocketmq-operator-564b5d75d-jllzk         1/1     Running   0          108s
    
    • 1
    • 2
    • 3
    • 4

    说明成功!

    4.修改持久化方式

    注:我的环境是已经安装了StorageClass
    修改example文件夹下的以下文件:
    1.rocketmq_v1alpha1_broker_cr.yaml
    2.rocketmq_v1alpha1_nameservice_cr.yaml
    修改以下两点
    在这里插入图片描述

    5.安装集群

    kubectl apply -f example/rocketmq_v1alpha1_rocketmq_cluster.yaml
    broker.rocketmq.apache.org/broker created
    nameservice.rocketmq.apache.org/name-service created
    console.rocketmq.apache.org/console created
    
    • 1
    • 2
    • 3
    • 4

    6.验证

    $ kubectl get pods -owide
    NAME                                 READY   STATUS    RESTARTS   AGE    IP             NODE             NOMINATED NODE   READINESS GATES
    broker-0-master-0                    1/1     Running   0          71s    10.1.5.91      docker-desktop   <none>           <none>
    broker-0-replica-1-0                 1/1     Running   0          71s    10.1.5.92      docker-desktop   <none>           <none>
    console-5c4c9d5757-jnsbq             1/1     Running   0          71s    10.1.5.93      docker-desktop   <none>           <none>
    name-service-0                       1/1     Running   0          78s    192.168.65.3   docker-desktop   <none>           <none>
    rocketmq-operator-758bb9c774-jrfw4   1/1     Running   0          106s   10.1.5.90      docker-desktop   <none>           <none>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    7.创建对外暴露的service

    kubectl apply -f example/rocketmq_v1alpha1_cluster_service.yaml
    
    • 1

    8.验证pv pvc

    $ kubectl get pvc
    NAME                                    STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS       AGE
    broker-storage-broker-0-master-0        Bound    pvc-7a74871b-c005-441a-bb15-8106566c9d19   8Gi        RWO            rocketmq-storage   78s
    broker-storage-broker-0-replica-1-0     Bound    pvc-521e7e9a-3795-487a-9f76-22da74db74dd   8Gi        RWO            rocketmq-storage   78s
    namesrv-storage-name-service-0          Bound    pvc-c708cb49-aa52-4992-8cac-f46a48e2cc2e   1Gi        RWO            rocketmq-storage   79s
    
    $ kubectl get pv
    NAME                                       CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM                                       STORAGECLASS       REASON   AGE
    pvc-521e7e9a-3795-487a-9f76-22da74db74dd   8Gi        RWO            Delete           Bound    default/broker-storage-broker-0-replica-1-0 rocketmq-storage            79s
    pvc-7a74871b-c005-441a-bb15-8106566c9d19   8Gi        RWO            Delete           Bound    default/broker-storage-broker-0-master-0    rocketmq-storage            79s
    pvc-d7b76efe-384c-4f8d-9e8a-ebe209ba826c   8Gi        RWO            Delete           Bound    default/broker-storage-broker-1-master-0    rocketmq-storage            78s
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
  • 相关阅读:
    JLink更新固件成砖头的Q&A
    querystring模块、formidable模块的介绍
    Unity之Hololens如何升级MRTK内置shader支持URP
    信号量优先级反转问题记录(总是遗忘)
    基于Matlab模拟用于天气观测的极化雷达回波(附源码)
    2023年【起重信号司索工(建筑特殊工种)】试题及解析及起重信号司索工(建筑特殊工种)操作证考试
    速卖通店铺流量下滑什么原因,如何做提升?(测评补单)
    Vue3生命周期函数
    PGRouting导航规划-AStar算法
    阿里最新总结的 spring 学习笔记PDF版分享,这是我见过这牛逼的spring全家桶
  • 原文地址:https://blog.csdn.net/shandian534/article/details/127770648