CREATE REPOSITORY

description

  1. 该语句用于创建仓库。仓库用于属于备份或恢复。仅 root superuser 用户可以创建仓库。
  2. 语法:
  3. CREATE [READ ONLY] REPOSITORY `repo_name`
  4. WITH BROKER `broker_name`
  5. ON LOCATION `repo_location`
  6. PROPERTIES ("key"="value", ...);
  7. 说明:
  8. 1. 仓库的创建,依赖于已存在的 broker
  9. 2. 如果是只读仓库,则只能在仓库上进行恢复。如果不是,则可以进行备份和恢复操作。
  10. 3. 根据 broker 的不同类型,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" = "069fc2786e664e63a5f111111114ddbs22",
  9. "bos_secret_accesskey"="70999999999999de274d59eaa980a"
  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" = "069fc2786e664e63a5f111111114ddbs22",
  19. "bos_secret_accesskey"="70999999999999de274d59eaa980a"
  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. );

keyword

  1. CREATE REPOSITORY