Current location - Quotes Website - Personality signature - K8s configuration of Rocketmq (1nameservice+1rocker)
K8s configuration of Rocketmq (1nameservice+1rocker)
There are two ways to deploy RockerMQ in k8s. One way is to deploy RockerMQ in k8s cluster by using operator, which can refer to the operation project. One is to write a simple k8s configuration file, and the template is provided in the docker project of rocketmq.

Here, we hope to deploy a low-profile rockerMQ using the k8s stand-alone version, and only start a nameservice and 1 broker. We will use the template provided by the rocketmq-docker project to complete it.

apiVersion: apps/v 1

Type: deployment

Metadata:

Name: rocketmq

Specifications:

Copy: 1

Selector:

Matching label:

app: rocketmq

Template:

Metadata:

Label:

app: rocketmq

Specifications:

Container:

-Name: Agent

image:apacherocketmq/rocket MQ:4 . 6 . 0

Command: [&; quot.sh "," mqbroker ","-n "," localhost:9876"]

imagePullPolicy: IfNotPresent

Port:

-Container port: 10909

-container port: 109 1 1

Environment:

-name: JAVA_OPT

Value:-server-xx: parallelism =1

Volume mounting:

- mountPath: /home/rocketmq/logs

Name: brokeroptlogs

-mount path:/home/rocket MQ/store

Name: brokeroptstore

Name: namesrv

image:apacherocketmq/rocket MQ:4 . 6 . 0

Commands: ["sh ","mqnamesrv"]

imagePullPolicy: IfNotPresent

Port:

-Container port: 9876

Volume mounting:

- mountPath: /home/rocketmq/logs

Name: namesrvoptlogs

Volume:

-Name: brokeroptlogs

emptyDir: {}

-Name: brokeroptstore

emptyDir: {}

-Name: namesrvoptlogs

emptyDir: {}

-Name: namesrvoptstore

emptyDir: {}

apiVersion: v 1

Type: service

Metadata:

Name: rocketmqservice

Specifications:

Type: node port

Port:

Name: namesrv

Port: 9876

Target port: 9876

Node port: 32000

Selector:

app: rocketmq

Note: Abnormal signature problem.

Reason: org.apache.rocketmq.acl.common.aclexception: [10015: signature-failed] Unable to calculate the request signature. Error = algorithm HmacSHA 1 unavailable.

Manual scheme 1: add the absolute path (jdk path) of the ext folder after $ {Java _ home}/JRE/lib/ext in tool.sh

The final solution: manual mode, which is inconvenient. After checking, the actual problem is that the etx path cannot be found because the ${JAVA_HOME} variable on the path is empty. So we just need to import the JAVA_HOME environment through k8s. As shown in the figure below:

3.2 Add a Subscription Group

Subscription groups can be used to achieve load balancing of consumption, and consumers in the same subscription group share all read queues.

Use the updateSubGroup command to create a subscription group. The required parameters are as follows:

Execute the command to create a new authorized service consumer group.

. /MQ admin update subgroup-b localhost: 109 1 1-n localhost:9876-g GID _ authorize

Implementation results: