欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 健康 > 养生 > emqx5.6.1 数据、配置备份与迁移

emqx5.6.1 数据、配置备份与迁移

2025/2/5 11:38:49 来源:https://blog.csdn.net/qq_41369135/article/details/139884312  浏览:    关键词:emqx5.6.1 数据、配置备份与迁移

EMQX 支持导入和导出的数据包括:

  • EMQX 配置重写的内容:
    • 认证与授权配置
    • 规则、连接器与 Sink/Source
    • 监听器、网关配置
    • 其他 EMQX 配置
  • 内置数据库 (Mnesia) 的数据
    • Dashboard 用户和 REST API 密钥
    • 客户端认证凭证(内置数据库密码认证、增强认证)
    • PSK 认证数据
    • 授权规则
    • 黑名单数据
  • 存储在 EMQX 数据目录(node.data_dir)中的 SSL/TLS 证书
  • 存储在 EMQX 数据目录中的授权 acl.conf 文件

一、进入容器

docker exec -it stand-alone-emqx bash

二、进入bin目录、执行导出命令(找到可执行文件)

emqx@wiat-22:/opt/emqx$  cd bin/
emqx@wiat-22:/opt/emqx/bin$ ls
emqx  emqx-5.6.1  emqx.cmd  emqx_cluster_rescue  emqx_ctl  emqx_ctl-5.6.1  emqx_ctl.cmd  install_upgrade.escript  install_upgrade.escript-5.6.1  no_dot_erlang.boot  node_dump  nodetool  nodetool-5.6.1
#导出命令
emqx@wiat-22:/opt/emqx/bin$ ./emqx ctl data export
Exporting data to "data/backup/emqx-export-2024-06-22-16-09-06.703.tar.gz"...
Exporting cluster configuration...
Exporting additional files from EMQX data_dir: "data"...
Exporting built-in database...
Exporting emqx_authn_mnesia database table...
Exporting emqx_authn_scram_mnesia database table...
Exporting emqx_acl database table...
Exporting emqx_retainer_message database table...
Exporting emqx_admin database table...
Exporting emqx_psk database table...
Exporting emqx_app database table...
Exporting emqx_banned_rules database table...
Exporting emqx_banned database table...
Data has been successfully exported to data/backup/emqx-export-2024-06-22-16-09-06.703.tar.gz.

三、进入backup目录把导出的数据迁移到另一台emqx(在另一台emqx  data目录下新建tmp文件夹,把数据放进去)

四、进入21的emqx容器里

# 进入容器
root@wiat-21:/docker/software/stand-alone-emqx# docker exec -it stand-alone-emqx bash
# 进入bin目录
emqx@wiat-21:/opt/emqx$ cd bin/
# 导入命令
emqx@wiat-21:/opt/emqx/bin$ ./emqx ctl data import /opt/emqx/data/tmp/emqx-export-2024-06-22-16-09-06.703.tar.gz
Importing data from "/opt/emqx/data/tmp/emqx-export-2024-06-22-16-09-06.703.tar.gz"...
Importing cluster configuration...
Config key path "authorization.sources.file" was present before import and has been overwritten.
Importing built-in database...
Importing emqx_banned database table...
Importing emqx_banned_rules database table...
Importing emqx_app database table...
Importing emqx_psk database table...
Importing emqx_admin database table...
Importing emqx_retainer_message database table...
Importing emqx_acl database table...
Importing emqx_authn_scram_mnesia database table...
Importing emqx_authn_mnesia database table...
Data has been imported successfully.

五:结果

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com