文档首页
MySQL 8.4 参考手册
8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

MySQL 8.4 参考手册 / 25 MySQL NDB 集群 8.4 / 25.5 NDB 集群程序 / 25.5.32 ndbxfrm — 压缩、解压缩、加密和解密由 NDB Cluster 创建的文件
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 71%

25.5.32 ndbxfrm — 压缩、解压、加密和解密 NDB Cluster 创建的文件25.5.32 ndbxfrm — Compress, Decompress, Encrypt, and Decrypt Files Created by NDB Cluster

ndbxfrm 工具可用于解压、解密以及输出由 NDB Cluster 创建的、已压缩、已加密或同时具备两者特性的文件的信息。它也可以用于压缩或加密文件。The ndbxfrm utility can be used to decompress, decrypt, and output information about files created by NDB Cluster that are compressed, encrypted, or both. It can also be used to compress or encrypt files.

用法Usage

ndbxfrm --info file[ file ...]

ndbxfrm --compress input_file output_file

ndbxfrm --decrypt-password=password input_file output_file

ndbxfrm [--encrypt-ldf-iter-count=#] --encrypt-password=password input_file output_file

input_file 和 output_file 不能是同一个文件。input_file and output_file cannot be the same file.

选项Options

  • --compress, -c

    命令行格式Command-Line Format --compress

    使用与压缩 NDB 集群备份相同的方法压缩输入文件,并将输出写入输出文件。要解压未加密的压缩 NDB 备份文件,只需调用 ndbxfrm 并使用压缩文件名和输出文件名(无需任何选项)。Compresses the input file, using the same compression method as is used for compressing NDB Cluster backups, and writes the output to an output file. To decompress a compressed NDB backup file that is not encrypted, it is necessary only to invoke ndbxfrm using the names of the compressed file and an output file (with no options required).

  • --decrypt-key=key, -K key

    命令行格式Command-Line Format --decrypt-key=key

    使用提供的密钥解密由 NDB 加密的文件。Decrypts a file encrypted by NDB using the supplied key.

    Note

    此选项不能与 --decrypt-password 一起使用。This option cannot be used together with --decrypt-password.

  • --decrypt-key-from-stdin

    命令行格式Command-Line Format --decrypt-key-from-stdin

    使用从 stdin 提供的密钥解密由 NDB 加密的文件。Decrypts a file encrypted by NDB using the key supplied from stdin.

  • --decrypt-password=password

    命令行格式Command-Line Format --decrypt-password=password
    类型Type 字符串String
    默认值Default Value [none][none]

    使用提供的密码解密由 NDB 加密的文件。Decrypts a file encrypted by NDB using the password supplied.

    Note

    此选项不能与 --decrypt-key 一起使用。This option cannot be used together with --decrypt-key.

  • --decrypt-password-from-stdin[=TRUE|FALSE]

    命令行格式Command-Line Format --decrypt-password-from-stdin

    使用从标准输入提供的密码解密由 NDB 加密的文件。这类似于在调用 mysql 后输入密码,使用 --password 但选项后未跟密码。Decrypts a file encrypted by NDB, using a password supplied from standard input. This is similar to entering a password after invoking mysql --password with no password following the option.

  • --defaults-extra-file

    命令行格式Command-Line Format --defaults-extra-file=path--defaults-extra-file=path
    类型Type 字符串String
    默认值Default Value [none][none]

    在读取全局文件之后读取给定文件。Read given file after global files are read.

  • --defaults-file

    命令行格式Command-Line Format --defaults-file=path
    类型Type 字符串String
    默认值Default Value [none][none]

    仅从指定文件读取默认选项。Read default options from given file only.

  • --defaults-group-suffix

    命令行格式Command-Line Format --defaults-group-suffix=string
    类型Type 字符串String
    默认值Default Value [none][none]

    还可以读取 CONCAT(group, suffix) 组合的组。Also read groups with CONCAT(group, suffix).

  • --detailed-info

    命令行格式Command-Line Format --encrypt-block-size=#
    类型Type 布尔Boolean
    默认值Default Value FALSE

    打印文件信息,如 --info,但包括文件的头部和尾部。Print out file information like --info, but include the file's header and trailer.

    示例:Example:

    $> ndbxfrm --detailed-info S0.sysfile
    File=/var/lib/cluster-data/ndb_7_fs/D1/NDBCNTR/S0.sysfile, compression=no, encryption=yes
    header: {
      fixed_header: {
        magic: {
          magic: { 78, 68, 66, 88, 70, 82, 77, 49 },
          endian: 18364758544493064720,
          header_size: 32768,
          fixed_header_size: 160,
          zeros: { 0, 0 }
        },
        flags: 73728,
        flag_extended: 0,
        flag_zeros: 0,
        flag_file_checksum: 0,
        flag_data_checksum: 0,
        flag_compress: 0,
        flag_compress_method: 0,
        flag_compress_padding: 0,
        flag_encrypt: 18,
        flag_encrypt_cipher: 2,
        flag_encrypt_krm: 1,
        flag_encrypt_padding: 0,
        flag_encrypt_key_selection_mode: 0,
        dbg_writer_ndb_version: 524320,
        octets_size: 32,
        file_block_size: 32768,
        trailer_max_size: 80,
        file_checksum: { 0, 0, 0, 0 },
        data_checksum: { 0, 0, 0, 0 },
        zeros01: { 0 },
        compress_dbg_writer_header_version: { ... },
        compress_dbg_writer_library_version: { ... },
        encrypt_dbg_writer_header_version: { ... },
        encrypt_dbg_writer_library_version: { ... },
        encrypt_key_definition_iterator_count: 100000,
        encrypt_krm_keying_material_size: 32,
        encrypt_krm_keying_material_count: 1,
        encrypt_key_data_unit_size: 32768,
        encrypt_krm_keying_material_position_in_octets: 0,
      },
      octets: {
         102, 68, 56, 125, 78, 217, 110, 94, 145, 121, 203, 234, 26, 164, 137, 180,
         100, 224, 7, 88, 173, 123, 209, 110, 185, 227, 85, 174, 109, 123, 96, 156,
      }
    }
    trailer: {
      fixed_trailer: {
        flags: 48,
        flag_extended: 0,
        flag_zeros: 0,
        flag_file_checksum: 0,
        flag_data_checksum: 3,
        data_size: 512,
        file_checksum: { 0, 0, 0, 0 },
        data_checksum: { 226, 223, 102, 207 },
        magic: {
          zeros: { 0, 0 }
          fixed_trailer_size: 56,
          trailer_size: 32256,
          endian: 18364758544493064720,
          magic: { 78, 68, 66, 88, 70, 82, 77, 49 },
        },
      }
    }
    
  • --encrypt-block-size=#

    命令行格式Command-Line Format --encrypt-block-size=#
    类型Type 整数Integer
    默认值Default Value 0
    最小值Minimum Value 0
    最大值Maximum Value 2147483647

    作为一个单元加密的输入数据块大小。用于 XTS;在 CBC 模式下设为 0(默认值)。Size of input data chunks that are encrypted as a unit. Used with XTS; set to 0 (the default) for CBC mode.

  • --encrypt-cipher=#

    命令行格式Command-Line Format --encrypt-cipher=#
    类型Type 整数Integer
    默认值Default Value 1
    最小值Minimum Value 0
    最大值Maximum Value 2147483647

    用于加密的密码算法。CBC 模式(默认值)设置为 1,XTS 设置为 2。Cipher used for encryption. Set to 1 for CBC mode (the default), or 2 for XTS.

  • --encrypt-kdf-iter-count=#, -k #

    命令行格式Command-Line Format --encrypt-kdf-iter-count=#
    类型Type 整数Integer
    默认值Default Value 0
    最小值Minimum Value 0
    最大值Maximum Value 2147483647

    加密文件时,指定用于加密密钥的迭代次数。需要 --encrypt-password 选项。When encrypting a file, specifies the number of iterations to use for the encryption key. Requires the --encrypt-password option.

  • --encrypt-key=key

    命令行格式Command-Line Format --encrypt-key=key

    使用提供的密钥加密文件。Encrypts a file using the supplied key.

    Note

    此选项不能与 --encrypt-password 一起使用。This option cannot be used together with --encrypt-password.

  • --encrypt-key-from-stdin

    命令行格式Command-Line Format --encrypt-key-from-stdin

    使用从 stdin 提供的密钥加密文件。Encrypt a file using the key supplied from stdin.

  • --encrypt-password=password

    命令行格式Command-Line Format --encrypt-password=password
    类型Type 字符串String
    默认值Default Value [none][none]

    使用选项提供的密码加密备份文件。密码必须符合此处列出的要求:Encrypts the backup file using the password supplied by the option. The password must meet the requirements listed here:

    • 使用除 !、'、"、$、%、\、` 和 ^ 之外的任何可打印 ASCII 字符Uses any of the printable ASCII characters except !, ', ", $, %, \, `, and ^

    • 长度不超过 256 个字符Is no more than 256 characters in length

    • 用单引号或双引号括起来Is enclosed by single or double quotation marks

    Note

    此选项不能与 --encrypt-key 一起使用。This option cannot be used together with --encrypt-key.

  • --encrypt-password-from-stdin[=TRUE|FALSE]

    命令行格式Command-Line Format --encrypt-password-from-stdin

    使用从标准输入提供的密码加密文件。这类似于在调用 mysql --password 时不跟随密码输入密码。Encrypts a file using a password supplied from standard input. This is similar to entering a password is entered after invoking mysql --password with no password following the option.

  • --help, -?

    命令行格式Command-Line Format --help--help

    打印程序的使用信息。Prints usage information for the program.

  • --info, -i

    命令行格式Command-Line Format --info

    打印一个或多个输入文件的以下信息:Prints the following information about one or more input files:

    • 文件名The name of the file

    • 文件是否压缩(compression=yes 或 compression=no)Whether the file is compressed (compression=yes or compression=no)

    • 文件是否加密(encryption=yes 或 encryption=no)Whether the file is encrypted (encryption=yes or encryption=no)

    示例:Example:

    $> ndbxfrm -i BACKUP-10-0.5.Data BACKUP-10.5.ctl BACKUP-10.5.log
    File=BACKUP-10-0.5.Data, compression=no, encryption=yes
    File=BACKUP-10.5.ctl, compression=no, encryption=yes
    File=BACKUP-10.5.log, compression=no, encryption=yes
    

    您还可以使用--detailed-info选项查看文件的头部和尾部信息。You can also see the file's header and trailer using the --detailed-info option.

  • --login-path

    命令行格式Command-Line Format --login-path=path
    类型Type 字符串String
    默认值Default Value [none][none]

    从登录文件读取给定路径。Read given path from login file.

  • --no-login-paths

    命令行格式Command-Line Format --no-login-paths

    跳过从登录路径文件读取选项。Skips reading options from the login path file.

  • --no-defaults

    命令行格式Command-Line Format --no-defaults--no-defaults

    除了登录文件之外,不从任何配置文件读取默认选项。Do not read default options from any option file other than login file.

  • --print-defaults

    命令行格式Command-Line Format --print-defaults

    打印程序参数列表然后退出。Print program argument list and exit.

  • --usage, -?

    命令行格式Command-Line Format --usage

    “--help”的同义词。Synonym for --help.

  • --version, -V

    命令行格式Command-Line Format --version

    打印版本信息。Prints out version information.

ndbxfrm 可以加密由任何版本的 NDB Cluster 创建的备份。备份包含的 .Data、.ctl 和 .log 文件必须分别加密,并且每个数据节点的这些文件也必须分别加密。加密后,此类备份只能由 ndbxfrm、ndb_restore 或 ndb_print_backup 解密。ndbxfrm can encrypt backups created by any version of NDB Cluster. The .Data, .ctl, and .log files comprising the backup must be encrypted separately, and these files must be encrypted separately for each data node. Once encrypted, such backups can be decrypted only by ndbxfrm, ndb_restore, or ndb_print_backup.

可以使用 --encrypt-password 和 --decrypt-password 选项一起,使用新密码对加密文件重新加密,如下所示:An encrypted file can be re-encrypted with a new password using the --encrypt-password and --decrypt-password options together, like this:

ndbxfrm --decrypt-password=old --encrypt-password=new input_file output_file

在刚才显示的示例中,old 和 new 分别是旧密码和新密码;这两个都必须加引号。输入文件会被解密,然后作为输出文件进行加密。输入文件本身不会改变;如果你不希望它能够使用旧密码访问,必须手动删除输入文件。In the example just shown, old and new are the old and new passwords, respectively; both of these must be quoted. The input file is decrypted and then encrypted as the output file. The input file itself is not changed; if you do not want it to be accessible using the old password, you must remove the input file manually.