Axon 参考指南
  • 介绍
  • 架构概览
    • DDD & CQRS 概念
    • 事件溯源
    • 事件驱动的微服务
  • Axon Server
  • 发行说明
    • Axon Framework
      • Major Releases
      • Minor Releases
    • Axon Server
      • Major Releases
      • Minor Releases Standard Edition
      • Minor Releases Enterprise Edition
    • Axon Framework Extensions
      • AMQP
        • Major Releases
      • CDI
        • Major Releases
      • JGroups
        • Major Releases
      • Kafka
        • Major Releases
        • Minor Releases
      • Kotlin
        • Experimental Releases
      • Mongo
        • Major Releases
        • Minor Releases
      • Reactor
        • Major Releases
        • Minor Releases
      • Spring Cloud
        • Major Releases
        • Minor Releases
      • Tracing
        • Major Releases
        • Minor Releases
  • Getting Started
    • 快速开始
  • Axon Framework
    • 介绍
    • 消息传递概念
      • 消息剖析
      • 消息关联
      • 消息拦截
      • 支持带注解的处理程序
      • 异常处理
      • 工作单元
    • 命令
      • 建模
        • 聚合
        • 多实体聚合
        • 聚合状态存储
        • 从另一个聚合创建聚合
        • 聚合多态性
        • 解决冲突
      • 命令调度器
      • 命令处理程序
      • 基础设施
      • 配置
    • 事件
      • 事件调度器
      • 事件处理程序
      • 事件处理器
        • 订阅事件处理器
        • 流式事件处理器
      • 事件总线和事件存储
      • 事件版本控制
    • 查询
      • 查询处理
      • 查询调度器
      • 查询处理程序
      • 实现
      • 配置
    • 长时处理过程(Sagas)
      • 实现
      • 关联
      • 基础设施
    • Deadlines
      • Deadline Managers
      • Event Schedulers
    • 测试
      • 命令 / 事件
      • 长时处理过程(Sagas)
    • 序列化
    • 调整
      • 事件快照
      • 事件处理
      • 命令处理
    • 监控和指标
    • Spring Boot 集成
    • 模块
  • Axon Server
    • 介绍
    • 安装
      • 本地安装
        • Axon Server SE
        • Axon Server EE
      • Docker / K8s
        • Axon Server SE
        • Axon Server EE
    • 管理
      • 配置
        • System Properties
        • Command Line Interface
        • REST API
        • GRPC API
      • Monitoring
        • Actuator Endpoints
        • gRPC Metrics
        • Heartbeat Monitoring
      • Clusters
      • Replication Groups
      • Multi-Context
      • Tagging
      • Backup and Messaging-only Nodes
      • Backups
      • Recovery
      • Plugins
      • Error Codes
    • 安全
      • SSL
      • 访问控制
      • 访问控制 - 标准版
      • 访问控制 - 企业版
      • 访问控制 - 客户端应用程序
      • 访问控制 - 命令行
      • 访问控制 - REST API
      • 访问控制 - LDAP
      • 访问控制 - OAuth 2.0
    • 性能
      • 事件段
      • 流量控制
    • 迁移
      • Standard to Enterprise Edition
      • Non-Axon Server to Axon Server
  • Extensions
    • Spring AMQP
    • JGroups
    • Kafka
    • Kotlin
    • Mongo
    • Reactor
      • Reactor Gateways
    • Spring Cloud
    • Tracing
  • Appendices
    • A. RDBMS Tuning
    • B. Message Handler Tuning
      • 参数解析器
      • 处理程序增强
    • C. 元数据注解
    • D. 标识符生成
    • E. Axon Server Query Language
由 GitBook 提供支持
在本页
  • Control Database
  • Event Stream Segments
  • Log Entry Segments (only for Axon Server EE)
  1. Axon Server
  2. 管理

Backups

上一页Backup and Messaging-only Nodes下一页Recovery

最后更新于2年前

The core strategy employed by AxonServer to keep data available, is to replicate it over various cluster nodes. These nodes should be in availability zones that are isolated from each other in relevant disaster scenarios. With Axon Server Enterprise 4.3, the introduction of specific makes it easier to set-up and operate AxonServer without ever making explicit backups to off-line media. Nevertheless, there are also environments where such backups are a strict requirement and for that reason, AxonServer does support it.‌

There are three types of items that need to be backed up

  • - Axon SE/EE

  • - Axon SE/EE

  • - Axon EE only

To support the creation of consistent backups, Axon Server provides a REST API. This API provides three controllers to perform backup operations

  • Backup Info Rest Controller - End point for Axon SE/EE for event stream segment backup

  • Backup Control DB Rest Controller - End point for Axon SE for control database backup

  • Cluster Backup Info Rest Controller - End points for Axon EE for control database and log entry segment backup

The API documentation is accessible at http:[server]:[port]/swagger-ui.html.

Control Database

The control database is a relational H2 database and contains important configuration information for your Axon Server SE/EE deployment. Although it's stored in a single file, this file cannot be simply copied for backup as it may not be in a safe state.

For Axon Server SE, a call to the POST endpoint http://[server]/createControlDbBackup forces the creation of a proper backup file.

For Axon Server EE, a call to the POST endpoint http://[server]/v1/backup/createControlDbBackupforces the creation of a proper backup file. The [server] could be any node within the cluster which serves the _admin context.

In both cases, it returns the full path to that file (.zip), which can then be used to move that file to another storage medium.‌

Event Stream Segments

The event stream segments are either closed and immutable, or still open for new events. For the closed segments, it is feasible to only back up the ones that haven't been backed-up yet, since the ones that have been are guaranteed not to change.

For both Axon Server SE/EE, a call to the GET endpoint http://[server]/v1/backup/filenames with event type (either EVENT or SNAPSHOT), the context name and optionally the last segment that has already been backed up will return a list of file names belonging to segments that haven't been backed up yet, but which are now safe to backup by simply copying them.‌

For Axon SE, the [server] is the single Axon Server SE node while in the case of Axon EE, the [server] could be any node that is a PRIMARY member node for the context that needs to be backed up.

In addition, you may choose to back up the current segment file that is being written to. These are files with names larger than the last entry returned to the filenames from the backup endpoint. It is important to overwrite this file with subsequent backups, because no guarantees can be given about the completeness of this file. This means the filename of this file should not be used to construct the "lastSegmentBackedUp" in subsequent requests to the backup endpoint.‌

Note

From Axon Server SE version 4.5.12 / Axon Server EE version 4.5.17 onwards there is a new endpoint available: /v1/backup/eventstore. This endpoint returns a JSON object with the files to back up, including the currently active event store segment. It also returns the number of last closed event store segment. This number can be used in subsequent backups to retrieve files updated since the last backup.

Log Entry Segments (only for Axon Server EE)

Unlike the event stream segments, the log entry segments backup should not be done incrementally. All the files are replaced by the next backup. The log entry segments backup is supported by the GET endpoint http:[server]/v1/backup/log/filenames. It takes the context name and returns a list of file names that completely replace the previous backup for that context.‌ The [server] could be any node that is a PRIMARY member node for the context that needs to be backed up.

Even if the recent file has incomplete data, a node will be able to recover a consistent state from such a file and will initialize itself at the position immediately after the last complete write. The replication process (if present) will ensure subsequent entries are automatically synchronized.‌

Because the control database contains a pointer to the last log entry that is known to be stored safely on the cluster (the commit index), the proper order of doing this is to first create the control database backup and then backing up the log entry segments and the event stream segments.

This will ensure that the log entry segments may have entries beyond the commit index (which is ok) but there are not missing entries before the commit index (which would be bad). The log entries segments must be backed up within 30 minutes after the backup of the controlDB, to prevent the log compaction procedure causes data inconsistencies.

Backup roles
Control Database
Event Stream Segments
Log Entry Segments