首页 > 其他分享 >使用 Helm 安装 MQTT 服务器-EMQX

使用 Helm 安装 MQTT 服务器-EMQX

时间:2023-01-02 10:34:09浏览次数:63  
标签:__ -- TCP MQTT emqx Helm EMQX true

EMQX

ℹ️ Info:

使用 EMQX

通过 Helm3 在 Kubernetes 上部署 EMQX 4.0 集群 | EMQ

emqx/deploy/charts/emqx at main-v4.4 · emqx/emqx (github.com)

emqx/values.yaml at main-v4.4 · emqx/emqx (github.com)

emqx/emqx-operator: A Kubernetes Operator for EMQ X Broker (github.com)

配置项 | EMQX 文档

EMQX 安装

ℹ️ Info:

即 EMQX 服务器端。

> helm repo add emqx https://repos.emqx.io/charts
"emqx" has been added to your repositories
> helm repo update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "emqx" chart repository
Update Complete. ⎈Happy Helming!⎈
> helm search repo emqx
NAME                    CHART VERSION   APP VERSION     DESCRIPTION                              
emqx/emqx               4.4.0           4.4.0           A Helm chart for EMQ X                   
emqx/emqx-ee            4.4.1           4.4.1           A Helm chart for EMQ X                   
emqx/emqx-operator      1.0.1           1.1.2           A Helm chart for EMQX Operator Controller
emqx/kuiper             0.9.0           0.9.0           A lightweight IoT edge analytic software

安装:

vi values.yaml:

replicaCount: 1
image:
  repository: emqx/emqx
  pullPolicy: IfNotPresent

recreatePods: false

podManagementPolicy: Parallel

extraEnv: []

extraEnvFrom: []

extraArgs: []

extraVolumes: []

extraVolumeMounts: []

persistence:
  enabled: true
  size: 8Gi
  storageClass: "local-path"
  accessMode: ReadWriteOnce

resources: {}
  # limits:
  #   cpu: 500m
  #   memory: 512Mi
  # requests:
  #   cpu: 500m
  #   memory: 512Mi

# Containers that run before the creation of EMQ X containers. They can contain utilities or setup scripts.
initContainers: {}
  # - name: mysql-probe
  #   image: alpine
  #   command: ["sh", "-c", "for i in $(seq 1 300); do nc -zvw1 mysql 3306 && exit 0 || sleep 3; done; exit 1"]

## EMQ X configuration item, see the documentation (https://hub.docker.com/r/emqx/emqx)
emqxConfig:
  EMQX_NAME:  "{{ .Release.Name }}"
  ## Cluster discovery by k8s
  EMQX_CLUSTER__DISCOVERY: "k8s"
  EMQX_CLUSTER__K8S__APP_NAME: "{{ .Release.Name }}"
  EMQX_CLUSTER__K8S__APISERVER: "https://kubernetes.default.svc:443"
  EMQX_CLUSTER__K8S__SERVICE_NAME: "{{ .Release.Name }}-headless"
  EMQX_CLUSTER__K8S__NAMESPACE: "{{ .Release.Namespace }}"
  EMQX_CLUSTER__K8S__ADDRESS_TYPE: "hostname"
  EMQX_CLUSTER__K8S__SUFFIX: "svc.cluster.local"

emqxAclConfig: >
  {allow, {user, "dashboard"}, subscribe, ["$SYS/#"]}.
  {allow, {ipaddr, "127.0.0.1"}, pubsub, ["$SYS/#", "#"]}.
  {deny, all, subscribe, ["$SYS/#", {eq, "#"}]}.
  {allow, all}.

emqxLoadedPlugins: >
  {emqx_management, true}.
  {emqx_recon, true}.
  {emqx_retainer, true}.
  {emqx_dashboard, true}.
  {emqx_telemetry, true}.
  {emqx_rule_engine, true}.
  {emqx_bridge_mqtt, false}.

emqxLoadedModules: >
  {emqx_mod_acl_internal, true}.
  {emqx_mod_presence, true}.
  {emqx_mod_trace, false}.
  {emqx_mod_st_statistics, false}.
  {emqx_mod_delayed, false}.
  {emqx_mod_rewrite, false}.
  {emqx_mod_subscription, false}.
  {emqx_mod_topic_metrics, false}.

service:
  type: LoadBalancer
  mqtt: 1883
  mqttssl: 8883
  mgmt: 8081
  ws: 8083
  wss: 8084
  dashboard: 18083

podSecurityContext:
  enabled: true
  fsGroup: 1000
  fsGroupChangePolicy: Always
  runAsUser: 1000
  supplementalGroups:
    - 1000

containerSecurityContext:
  enabled: true
  runAsNonRoot: true
  runAsUser: 1000
helm install emqx emqx/emqx --namespace emqx --create-namespace -f ./values.yaml --wait

安装输出:

NAME: emqx
LAST DEPLOYED: Sat Feb 19 20:48:49 2022
NAMESPACE: emqx
STATUS: deployed
REVISION: 1
TEST SUITE: None

EMQX 验证

安装后查看 EMQX 集群情况:

# kubectl -n emqx get pods
NAME               READY   STATUS    RESTARTS   AGE
svclb-emqx-kbl22   6/6     Running   0          41s
emqx-0             1/1     Running   0          41s

# kubectl -n emqx  exec -it emqx-0 -- emqx_ctl cluster status
Cluster status: #{running_nodes =>
                      ['[email protected]'],
                  stopped_nodes => []}

# kubectl -n emqx get svc
NAME            TYPE           CLUSTER-IP      EXTERNAL-IP      PORT(S)                                                                                      AGE
emqx-headless   ClusterIP      None            <none>           1883/TCP,8883/TCP,8081/TCP,8083/TCP,8084/TCP,18083/TCP,4370/TCP                              86s
emqx            LoadBalancer   10.43.193.192   10.<none> .245   1883:31558/TCP,8883:31122/TCP,8081:31592/TCP,8083:30322/TCP,8084:31095/TCP,18083:32427/TCP   86s

访问控制台:

访问 URL:18083,输入默认用户名:admin,默认密码:public,登陆 EMQX dashboard。

image-20220219205441661

MQTT 消息验证:

可以通过 MQTT X: Cross-platform MQTT 5.0 Desktop Client 连接并进行收发验证。

标签:__,--,TCP,MQTT,emqx,Helm,EMQX,true
From: https://blog.51cto.com/ewhisper/5983433

相关文章

  • 使用 Helm 安装 MQTT 服务器-EMQX
    EMQXℹ️Info:使用EMQX通过Helm3在Kubernetes上部署EMQX4.0集群|EMQemqx/deploy/charts/emqxatmain-v4.4·emqx/emqx(github.com)emqx/values.yamlat......
  • 使用 Bitnami Helm 安装 Kafka
    服务器端K3S上部署KafkaServerKafka安装......
  • 使用 Bitnami Helm 安装 Kafka
    服务器端K3S上部署KafkaServerKafka安装......
  • 使用 Docker Hub 完美地存储 Helm 图表实战
    使用DockerHub完美地存储Helm图表实战​​Helm​​是Kubernetes的包管理器。它是一个开源容器编排系统。它通过提供一种简单的方法来定义、安装和升级复杂的Kubern......
  • python——发送mqtt消息
    (1)创建mqtt连接参考https://www.jianshu.com/p/06d23de47aed文中写的发布消息代码如下:文件名:mypub.py#!/usr/bin/envpython#coding:utf-8importtimeimportjso......
  • helm 部署kube-prometheus-stack
    下载helm文件promingresskind:IngressapiVersion:networking.k8s.io/v1metadata:name:prom-ingressnamespace:kube-prometheus-stacklabels:......
  • 记一次kubernetes测试环境搭建(heapster,helm,nginx-ingress-controller,glusterfs heketi
    课程内容:各种k8s部署方式。包括minikube部署,kubeadm部署,kubeasz部署,rancher部署,k3s部署。包括开发测试环境部署k8s,和生产环境部署k8s。详细介绍helm命令,学习helmchart语法,......
  • PLC采集网关MQTT上云平台操作技巧
    金鸽MQTT的配置操作步骤:(1)双击“金鸽IoT”弹出金鸽MQTT配置框。(2)点击启用按钮,启用金鸽MQTT。默认:关闭。灰色表示:不启用,绿色表示:启用。(3)IP/域名:1883.dtuip.com,默认填写......
  • Windows Server 上安装EMQX
    EMQX是中国杭州一家科技公司(公司名叫EMQ)发布的面向5G和物联网市场的消息与流处理开源软件。2013年,EMQ作为一个开源项目在Github:​​https://github.com/emqx/emqx​​......
  • MQTT.fx客户端的安装及开始
    MQTT.fx客户端的安装及开始下载:官网:http://mqttfx.org最新版本,但是需要安装许可证,只能免费试用三个月百度网盘:只有1.7的版本,无需许可证(推荐)Windows版(64位)ht......