CREATE REPOSITORY

description

  1. 该语句用于创建仓库。仓库用于属于备份或恢复。仅 root superuser 用户可以创建仓库。
  2. 语法:
  3. CREATE [READ ONLY] REPOSITORY `repo_name`
  4. WITH [BROKER `broker_name`|S3]
  5. ON LOCATION `repo_location`
  6. PROPERTIES ("key"="value", ...);
  7. 说明:
  8. 1. 仓库的创建,依赖于已存在的 broker 或者直接通过AWS s3 协议访问云存储
  9. 2. 如果是只读仓库,则只能在仓库上进行恢复。如果不是,则可以进行备份和恢复操作。
  10. 3. 根据 broker 或者S3的不同类型,PROPERTIES 有所不同,具体见示例。

example

  1. 1. 创建名为 bos_repo 的仓库,依赖 BOS broker "bos_broker",数据根目录为:bos://palo_backup
  2. CREATE REPOSITORY `bos_repo`
  3. WITH BROKER `bos_broker`
  4. ON LOCATION "bos://palo_backup"
  5. PROPERTIES
  6. (
  7. "bos_endpoint" = "http://gz.bcebos.com",
  8. "bos_accesskey" = "bos_accesskey",
  9. "bos_secret_accesskey"="bos_secret_accesskey"
  10. );
  11. 2. 创建和示例 1 相同的仓库,但属性为只读:
  12. CREATE READ ONLY REPOSITORY `bos_repo`
  13. WITH BROKER `bos_broker`
  14. ON LOCATION "bos://palo_backup"
  15. PROPERTIES
  16. (
  17. "bos_endpoint" = "http://gz.bcebos.com",
  18. "bos_accesskey" = "bos_accesskey",
  19. "bos_secret_accesskey"="bos_accesskey"
  20. );
  21. 3. 创建名为 hdfs_repo 的仓库,依赖 Baidu hdfs broker "hdfs_broker",数据根目录为:hdfs://hadoop-name-node:54310/path/to/repo/
  22. CREATE REPOSITORY `hdfs_repo`
  23. WITH BROKER `hdfs_broker`
  24. ON LOCATION "hdfs://hadoop-name-node:54310/path/to/repo/"
  25. PROPERTIES
  26. (
  27. "username" = "user",
  28. "password" = "password"
  29. );
  30. 4. 创建名为 s3_repo 的仓库,直接链接云存储,而不通过broker.
  31. CREATE REPOSITORY `s3_repo`
  32. WITH S3
  33. ON LOCATION "s3://s3-repo"
  34. PROPERTIES
  35. (
  36. "AWS_ENDPOINT" = "http://s3-REGION.amazonaws.com",
  37. "AWS_ACCESS_KEY" = "AWS_ACCESS_KEY",
  38. "AWS_SECRET_KEY"="AWS_SECRET_KEY",
  39. "AWS_REGION" = "REGION"
  40. );

keyword

  1. CREATE, REPOSITORY