Skip to content

Latest commit

 

History

History
136 lines (104 loc) · 4.55 KB

tutorial.md

File metadata and controls

136 lines (104 loc) · 4.55 KB

Tutorial

Prerequisites

  • Kubernetes 1.9+, since StatefulSets are stable (GA) in 1.9.

Installation

Create a namespace

kubectl create ns rocketmq-operator

Deploy the cluster

0) Create a name server cluster

Create a deployment for namesrv, and expose namesrv service with NodePort.

kubectl create -f deploy/00-namesrv.yaml

1) Create the CRD with kind BrokerCluster.

kubectl create -f deploy/01-resources.yaml

2) Create RBAC resources for Rocketmq Operator

kubectl create -f deploy/02-rbac.yaml

3) Deploy Rocketmq Operator

kubectl create -f deploy/03-deploymentWithConfig.yaml

4) Create a broker cluster

Create a cluster with 2 masters:

kubectl create -f deploy/04-cluster-2m.yaml

OR:

Create a cluster with 2 masters and 2 slaves:

kubectl create -f deploy/04-cluster-2m-2s.yaml

Verify the cluster

Below is the command line output for a cluster with 2 masters and 2 slaves.

[root@k8s-master deploy]# kubectl get pods -n rocketmq-operator -owide
NAME                                READY     STATUS    RESTARTS   AGE       IP                NODE
mybrokercluster-0-0                 1/1       Running   0          38s       192.168.122.145   k8s-node4
mybrokercluster-0-1                 1/1       Running   0          33s       192.168.196.17    k8s-node5
mybrokercluster-1-0                 1/1       Running   0          38s       192.168.196.16    k8s-node5
mybrokercluster-1-1                 1/1       Running   0          34s       192.168.122.146   k8s-node4
rocketmq-namesrv-7d7df8c7d7-4t2g2   1/1       Running   2          10d       10.10.103.181     k8s-node4
rocketmq-namesrv-7d7df8c7d7-6x47m   1/1       Running   2          7d        10.10.101.98      k8s-node5
rocketmq-operator-d9dc87954-nw262   1/1       Running   0          6m        192.168.196.14    k8s-node5
[root@k8s-master deploy]# 
[root@k8s-master deploy]# kubectl exec -it mybrokercluster-0-0 -n rocketmq-operator bash
[root@mybrokercluster-0-0 bin]# cat ../conf/broker.conf
#This file was auto generated by rocketmq-operator. DO NOT EDIT.
brokerClusterName=DefaultCluster
brokerName=broker-0
brokerId=0
deleteWhen=04
fileReservedTime=48
brokerRole=SYNC_MASTER
flushDiskType=ASYNC_FLUSH
[root@mybrokercluster-0-0 bin]# exit
exit
[root@k8s-master deploy]# kubectl exec -it mybrokercluster-0-1 -n rocketmq-operator bash
[root@mybrokercluster-0-1 bin]# cat ../conf/broker.conf
#This file was auto generated by rocketmq-operator. DO NOT EDIT.
brokerClusterName=DefaultCluster
brokerName=broker-0
brokerId=1
deleteWhen=04
fileReservedTime=48
brokerRole=SLAVE
flushDiskType=ASYNC_FLUSH
[root@mybrokercluster-0-1 bin]# exit
exit
[root@k8s-master deploy]# kubectl exec -it mybrokercluster-1-0 -n rocketmq-operator bash
[root@mybrokercluster-1-0 bin]# cat ../conf/broker.conf
#This file was auto generated by rocketmq-operator. DO NOT EDIT.
brokerClusterName=DefaultCluster
brokerName=broker-1
brokerId=0
deleteWhen=04
fileReservedTime=48
brokerRole=SYNC_MASTER
flushDiskType=ASYNC_FLUSH
[root@mybrokercluster-1-0 bin]# exit
exit
[root@k8s-master deploy]# kubectl exec -it mybrokercluster-1-1 -n rocketmq-operator bash
[root@mybrokercluster-1-1 bin]# cat ../conf/broker.conf                                                                                                               
#This file was auto generated by rocketmq-operator. DO NOT EDIT.
brokerClusterName=DefaultCluster
brokerName=broker-1
brokerId=1
deleteWhen=04
fileReservedTime=48
brokerRole=SLAVE
flushDiskType=ASYNC_FLUSH
[root@mybrokercluster-1-1 bin]# ./mqadmin clusterList -n 10.10.103.181:9876 10.10.101.98:9876
OpenJDK 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
#Cluster Name     #Broker Name            #BID  #Addr                  #Version                #InTPS(LOAD)       #OutTPS(LOAD) #PCWait(ms) #Hour #SPACE
DefaultCluster    mybrokercluster-0-0     0     192.168.122.145:10911  V4_3_0                   0.00(0,0ms)         0.00(0,0ms)          0 426824.01 -1.0000
DefaultCluster    mybrokercluster-0-1     0     192.168.196.17:10911   V4_3_0                   0.00(0,0ms)         0.00(0,0ms)          0 426824.01 -1.0000
DefaultCluster    mybrokercluster-1-0     0     192.168.196.16:10911   V4_3_0                   0.00(0,0ms)         0.00(0,0ms)          0 426824.01 -1.0000
DefaultCluster    mybrokercluster-1-1     0     192.168.122.146:10911  V4_3_0                   0.00(0,0ms)         0.00(0,0ms)          0 426824.01 -1.0000