Skip to content

Commit

Permalink
future: 新增 podLabels 变量.
Browse files Browse the repository at this point in the history
future: 新增 Istio VirtualService 模板.
dellnoantechnp committed Mar 8, 2023
1 parent 0a2fa84 commit 225fb0a
Showing 15 changed files with 974 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/rocketmq/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
39 changes: 39 additions & 0 deletions charts/rocketmq/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
apiVersion: v2
name: rocketmq
description: A RocketMQ Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.0.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "4.9.4"
home: https://github.com/apache/rocketmq
maintainers:
- email: dellnoantechnp@gmail.com
name: dellnoantechnp
url: https://github.com/dellnoantechnp
sources:
- https://github.com/apache/rocketmq
annotations:
artifacthub.io/images: |
- name: apache/rocketmq:4.9.4
image: apache/rocketmq:4.9.4
artifacthub.io/license: Apache-2.0
artifacthub.io/links: |
- name: Chart Source
url: https://github.com/dellnoantechnp.github.io/tree/main/charts/rocketmq
155 changes: 155 additions & 0 deletions charts/rocketmq/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
# RocketMQ Helm Chart

## v2 版本发布公告

- 兼容官方容器镜像 [apache/rocketmq](https://hub.docker.com/r/apache/rocketmq)
- 支持 rocketmq `4.5``4.9` 版本

``` yaml
image:
repository: "apache/rocketmq"
tag: "4.9.4"
```
## 部署
``` shell
REPO_NAME=rocketmq
helm repo add ${REPO_NAME} https://dellnoantechnp.github.io/charts
helm repo list

kubectl create namespace rocketmq
# 部署测试集群, 单 Master
helm -n rocketmq install rocketmq ${REPO_NAME}/rocketmq

# 部署生产集群, 多 Master 多 Slave
helm -n rocketmq install rocketmq ${REPO_NAME}/rocketmq \
--set clusterName=rocketmq-cluster \
--set broker.size.master=3 \
--set broker.size.replica=1 \
--set nameserver.replicaCount=3
```

## Broker 集群架构

### 单 Master 模式

``` yaml
broker:
size:
master: 1
replica: 0
```
### 多 Master 模式
一个集群无Slave,全是Master,例如2个Master或者3个Master,这种模式的优缺点如下:
- 优点:配置简单,单个Master宕机或重启维护对应用无影响,性能最高;
- 缺点:单台机器宕机期间,这台机器上未被消费的消息在机器恢复之前不可订阅,消息实时性会受到影响。
``` yaml
broker:
size:
master: 3
replica: 1
```
### 多 Master 多 Slave 模式
每个Master配置一个Slave,有多对Master-Slave,HA采用异步复制方式,主备有短暂消息延迟(毫秒级),这种模式的优缺点如下:
- 优点:Master宕机后,消费者仍然可以从Slave消费,而且此过程对应用透明,不需要人工干预,性能同多Master模式几乎一样;
- 缺点:Master宕机,磁盘损坏情况下会丢失少量消息 (已经同步到 Slave 的数据不受影响)
``` yaml
broker:
size:
master: 3
replica: 1
# 3个 master 节点,每个 master 具有1个副节点,共6个 broker 节点
```

## 配置

``` yaml
# 集群名
clusterName: "cluster-production"

broker:
# 3个 master 节点,每个 master 具有1个副节点,共6个 broker 节点
size:
master: 3
replica: 1

# 修改 broker 容器镜像地址和版本
#image:
# repository: "apacherocketmq/rocketmq-broker"
# tag: "4.5.0-alpine-operator-0.3.0"

persistence:
enabled: true
size: 8Gi
#storageClass: gp2

# 主节点资源分配
master:
brokerRole: ASYNC_MASTER
jvmMemory: " -Xms4g -Xmx4g -Xmn1g "
resources:
limits:
cpu: 4
memory: 12Gi
requests:
cpu: 200m
memory: 6Gi

# 副节点资源分配
replica:
jvmMemory: " -Xms1g -Xmx1g -Xmn256m "
resources:
limits:
cpu: 4
memory: 8Gi
requests:
cpu: 50m
memory: 2Gi

nameserver:
replicaCount: 3

# 修改 nameserver 容器镜像地址和版本
#image:
# repository: "apacherocketmq/rocketmq-nameserver"
# tag: "4.5.0-alpine-operator-0.3.0"

resources:
limits:
cpu: 4
memory: 8Gi
requests:
cpu: 50m
memory: 1Gi

persistence:
enabled: true
size: 8Gi
#storageClass: gp2

dashboard:
enabled: true
replicaCount: 1

ingress:
enabled: true
className: "nginx"
hosts:
- host: rocketmq.example.com
paths:
- path: /
pathType: ImplementationSpecific
#tls:
# - secretName: example-com-tls
# hosts:
# - rocketmq.example.com
```
78 changes: 78 additions & 0 deletions charts/rocketmq/examples/production.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# 集群名
clusterName: "cluster-production"

image:
repository: "apache/rocketmq"
tag: "4.9.4"

broker:
# 3个 master 节点,每个 master 具有1个副节点,共6个 broker 节点
size:
master: 3
replica: 1

persistence:
enabled: true
size: 8Gi
#storageClass: gp2

# 主节点资源分配
master:
brokerRole: ASYNC_MASTER
jvmMemory: " -Xms4g -Xmx4g -Xmn1g "
resources:
limits:
cpu: 4
memory: 12Gi
requests:
cpu: 200m
memory: 6Gi

# 副节点资源分配
replica:
jvmMemory: " -Xms1g -Xmx1g -Xmn256m "
resources:
limits:
cpu: 4
memory: 8Gi
requests:
cpu: 50m
memory: 2Gi

nameserver:
replicaCount: 3

# 修改 nameserver 容器镜像地址和版本
#image:
# repository: "apacherocketmq/rocketmq-nameserver"
# tag: "4.5.0-alpine-operator-0.3.0"

resources:
limits:
cpu: 4
memory: 8Gi
requests:
cpu: 50m
memory: 1Gi

persistence:
enabled: true
size: 8Gi
#storageClass: gp2

dashboard:
enabled: true
replicaCount: 1

ingress:
enabled: true
className: "nginx"
hosts:
- host: rocketmq.example.com
paths:
- path: /
pathType: ImplementationSpecific
#tls:
# - secretName: example-com-tls
# hosts:
# - rocketmq.example.com
34 changes: 34 additions & 0 deletions charts/rocketmq/examples/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
clusterName: "cluster-test"

image:
repository: "apache/rocketmq"
tag: "4.9.4"

broker:
size:
master: 1
replica: 0

persistence:
enabled: true
size: 8Gi

nameserver:
replicaCount: 1

dashboard:
enabled: true
replicaCount: 1

ingress:
enabled: false
className: "nginx"
hosts:
- host: rocketmq.example.com
paths:
- path: /
pathType: ImplementationSpecific
#tls:
# - secretName: example-com-tls
# hosts:
# - rocketmq.example.com
8 changes: 8 additions & 0 deletions charts/rocketmq/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
1. Get the application URL by running these commands:
{{- if .Values.dashboard.ingress.enabled }}
{{- range $host := .Values.dashboard.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.dashboard.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- end }}
{{- end }}
{{- end }}
Loading

0 comments on commit 225fb0a

Please sign in to comment.