使用 Helm 安装 MQTT 服务器-EMQX

打印 上一主题 下一主题

主题 642|帖子 642|积分 1926

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 服务器端。
  1. > helm repo add emqx https://repos.emqx.io/charts
  2. "emqx" has been added to your repositories
  3. > helm repo update
  4. Hang tight while we grab the latest from your chart repositories...
  5. ...Successfully got an update from the "emqx" chart repository
  6. Update Complete. ⎈Happy Helming!⎈
  7. > helm search repo emqx
  8. NAME                    CHART VERSION   APP VERSION     DESCRIPTION                              
  9. emqx/emqx               4.4.0           4.4.0           A Helm chart for EMQ X                  
  10. emqx/emqx-ee            4.4.1           4.4.1           A Helm chart for EMQ X                  
  11. emqx/emqx-operator      1.0.1           1.1.2           A Helm chart for EMQX Operator Controller
  12. emqx/kuiper             0.9.0           0.9.0           A lightweight IoT edge analytic software
复制代码
安装:
vi values.yaml:
  1. replicaCount: 1
  2. image:
  3.   repository: emqx/emqx
  4.   pullPolicy: IfNotPresent
  5. recreatePods: false
  6. podManagementPolicy: Parallel
  7. extraEnv: []
  8. extraEnvFrom: []
  9. extraArgs: []
  10. extraVolumes: []
  11. extraVolumeMounts: []
  12. persistence:
  13.   enabled: true
  14.   size: 8Gi
  15.   storageClass: "local-path"
  16.   accessMode: ReadWriteOnce
  17. resources: {}
  18.   # limits:
  19.   #   cpu: 500m
  20.   #   memory: 512Mi
  21.   # requests:
  22.   #   cpu: 500m
  23.   #   memory: 512Mi
  24. # Containers that run before the creation of EMQ X containers. They can contain utilities or setup scripts.
  25. initContainers: {}
  26.   # - name: mysql-probe
  27.   #   image: alpine
  28.   #   command: ["sh", "-c", "for i in $(seq 1 300); do nc -zvw1 mysql 3306 && exit 0 || sleep 3; done; exit 1"]
  29. ## EMQ X configuration item, see the documentation (https://hub.docker.com/r/emqx/emqx)
  30. emqxConfig:
  31.   EMQX_NAME:  "{{ .Release.Name }}"
  32.   ## Cluster discovery by k8s
  33.   EMQX_CLUSTER__DISCOVERY: "k8s"
  34.   EMQX_CLUSTER__K8S__APP_NAME: "{{ .Release.Name }}"
  35.   EMQX_CLUSTER__K8S__APISERVER: "https://kubernetes.default.svc:443"
  36.   EMQX_CLUSTER__K8S__SERVICE_NAME: "{{ .Release.Name }}-headless"
  37.   EMQX_CLUSTER__K8S__NAMESPACE: "{{ .Release.Namespace }}"
  38.   EMQX_CLUSTER__K8S__ADDRESS_TYPE: "hostname"
  39.   EMQX_CLUSTER__K8S__SUFFIX: "svc.cluster.local"
  40. emqxAclConfig: >
  41.   {allow, {user, "dashboard"}, subscribe, ["$SYS/#"]}.
  42.   {allow, {ipaddr, "127.0.0.1"}, pubsub, ["$SYS/#", "#"]}.
  43.   {deny, all, subscribe, ["$SYS/#", {eq, "#"}]}.
  44.   {allow, all}.
  45. emqxLoadedPlugins: >
  46.   {emqx_management, true}.
  47.   {emqx_recon, true}.
  48.   {emqx_retainer, true}.
  49.   {emqx_dashboard, true}.
  50.   {emqx_telemetry, true}.
  51.   {emqx_rule_engine, true}.
  52.   {emqx_bridge_mqtt, false}.
  53. emqxLoadedModules: >
  54.   {emqx_mod_acl_internal, true}.
  55.   {emqx_mod_presence, true}.
  56.   {emqx_mod_trace, false}.
  57.   {emqx_mod_st_statistics, false}.
  58.   {emqx_mod_delayed, false}.
  59.   {emqx_mod_rewrite, false}.
  60.   {emqx_mod_subscription, false}.
  61.   {emqx_mod_topic_metrics, false}.
  62. service:
  63.   type: LoadBalancer
  64.   mqtt: 1883
  65.   mqttssl: 8883
  66.   mgmt: 8081
  67.   ws: 8083
  68.   wss: 8084
  69.   dashboard: 18083
  70. podSecurityContext:
  71.   enabled: true
  72.   fsGroup: 1000
  73.   fsGroupChangePolicy: Always
  74.   runAsUser: 1000
  75.   supplementalGroups:
  76.     - 1000
  77. containerSecurityContext:
  78.   enabled: true
  79.   runAsNonRoot: true
  80.   runAsUser: 1000
复制代码
  1. helm install emqx emqx/emqx --namespace emqx --create-namespace -f ./values.yaml --wait
复制代码
安装输出:
  1. NAME: emqx
  2. LAST DEPLOYED: Sat Feb 19 20:48:49 2022
  3. NAMESPACE: emqx
  4. STATUS: deployed
  5. REVISION: 1
  6. TEST SUITE: None
复制代码
EMQX 验证

安装后查看 EMQX 集群情况:
  1. # kubectl -n emqx get pods
  2. NAME               READY   STATUS    RESTARTS   AGE
  3. svclb-emqx-kbl22   6/6     Running   0          41s
  4. emqx-0             1/1     Running   0          41s
  5. # kubectl -n emqx  exec -it emqx-0 -- emqx_ctl cluster status
  6. Cluster status: #{running_nodes =>
  7.                       ['emqx@emqx-0.emqx-headless.emqx.svc.cluster.local'],
  8.                   stopped_nodes => []}
  9. # kubectl -n emqx get svc
  10. NAME            TYPE           CLUSTER-IP      EXTERNAL-IP      PORT(S)                                                                                      AGE
  11. emqx-headless   ClusterIP      None            <none>           1883/TCP,8883/TCP,8081/TCP,8083/TCP,8084/TCP,18083/TCP,4370/TCP                              86s
  12. 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。

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


免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

南飓风

金牌会员
这个人很懒什么都没写!

标签云

快速回复 返回顶部 返回列表