- StarRocks
- 产品简介
- 快速开始
- 表设计
- 导入数据
- 导出数据
- 查询数据源
- 查询加速
- 管理手册
- 部署集群
- 运维集群
- 数据恢复
- 管理用户权限及认证
- 性能调优
- 参考手册
- SQL参考
- 用户账户管理
- 集群管理
- ADD SQLBLACKLIST
- ADMIN CANCEL REPAIR TABLE
- ADMIN CHECK TABLET
- ADMIN REPAIR TABLE
- ADMIN SET CONFIG
- ADMIN SET REPLICA STATUS
- ADMIN SHOW CONFIG
- ADMIN SHOW REPLICA DISTRIBUTION
- ADMIN SHOW REPLICA STATUS
- ALTER RESOURCE GROUP
- ALTER SYSTEM
- CANCEL DECOMMISSION
- CREATE RESOURCE GROUP
- CREATE FILE
- DELETE SQLBLACKLIST
- DROP FILE
- DROP RESOURCE GROUP
- EXPLAIN
- INSTALL PLUGIN
- KILL
- SET
- SHOW BACKENDS
- SHOW BROKER
- SHOW COMPUTE NODES
- SHOW FILE
- SHOW FRONTENDS
- SHOW FULL COLUMNS
- SHOW INDEX
- SHOW PLUGINS
- SHOW PROC
- SHOW PROCESSLIST
- SHOW RESOURCE GROUP
- SHOW SQLBLACKLIST
- SHOW TABLE STATUS
- SHOW VARIABLES
- UNINSTALL PLUGIN
- DDL
- ALTER DATABASE
- ALTER MATERIALIZED VIEW
- ALTER TABLE
- ALTER VIEW
- ALTER RESOURCE
- ANALYZE TABLE
- BACKUP
- CANCEL ALTER TABLE
- CANCEL BACKUP
- CANCEL RESTORE
- CREATE ANALYZE
- CREATE DATABASE
- CREATE EXTERNAL CATALOG
- CREATE INDEX
- CREATE MATERIALIZED VIEW
- CREATE REPOSITORY
- CREATE RESOURCE
- CREATE TABLE AS SELECT
- CREATE TABLE LIKE
- CREATE TABLE
- CREATE VIEW
- CREATE FUNCTION
- DROP ANALYZE
- DROP STATS
- DROP CATALOG
- DROP DATABASE
- DROP INDEX
- DROP MATERIALIZED VIEW
- DROP REPOSITORY
- DROP RESOURCE
- DROP TABLE
- DROP VIEW
- DROP FUNCTION
- HLL
- KILL ANALYZE
- RECOVER
- REFRESH EXTERNAL TABLE
- RESTORE
- SHOW ANALYZE JOB
- SHOW ANALYZE STATUS
- SHOW META
- SHOW RESOURCES
- SHOW FUNCTION
- TRUNCATE TABLE
- USE
- DML
- ALTER LOAD
- ALTER ROUTINE LOAD
- BROKER LOAD
- CANCEL LOAD
- CANCEL REFRESH MATERIALIZED VIEW
- CANCEL EXPORT
- CREATE ROUTINE LOAD
- DELETE
- EXPORT
- GROUP BY
- INSERT
- PAUSE ROUTINE LOAD
- REFRESH MATERIALIZED VIEW
- RESUME ROUTINE LOAD
- SELECT
- SHOW ALTER TABLE
- SHOW ALTER MATERIALIZED VIEW
- SHOW BACKUP
- SHOW CATALOGS
- SHOW CREATE MATERIALIZED VIEW
- SHOW CREATE TABLE
- SHOW CREATE VIEW
- SHOW DATA
- SHOW DATABASES
- SHOW DELETE
- SHOW DYNAMIC PARTITION TABLES
- SHOW EXPORT
- SHOW LOAD
- SHOW MATERIALIZED VIEW
- SHOW PARTITIONS
- SHOW PROPERTY
- SHOW REPOSITORIES
- SHOW RESTORE
- SHOW ROUTINE LOAD
- SHOW ROUTINE LOAD TASK
- SHOW SNAPSHOT
- SHOW TABLES
- SHOW TABLET
- SHOW TRANSACTION
- SPARK LOAD
- STOP ROUTINE LOAD
- STREAM LOAD
- 辅助命令
- 数据类型
- 关键字
- 函数参考
- Java UDF
- 窗口函数
- Lambda 表达式
- 日期函数
- add_months
- adddate
- convert_tz
- current_date
- current_time
- current_timestamp
- date
- date_add
- date_format
- date_slice
- date_sub, subdate
- date_trunc
- datediff
- day
- dayname
- dayofmonth
- dayofweek
- dayofyear
- days_add
- days_diff
- days_sub
- from_days
- from_unixtime
- hour
- hours_add
- hours_diff
- hours_sub
- microseconds_add
- microseconds_sub
- minute
- minutes_add
- minutes_diff
- minutes_sub
- month
- monthname
- months_add
- months_diff
- months_sub
- now
- quarter
- second
- seconds_add
- seconds_diff
- seconds_sub
- str_to_date
- str2date
- time_slice
- time_to_sec
- timediff
- timestamp
- timestampadd
- timestampdiff
- to_days
- to_date
- unix_timestamp
- utc_timestamp
- week
- weekofyear
- weeks_add
- weeks_diff
- weeks_sub
- year
- years_add
- years_diff
- years_sub
- 加密函数
- 地理位置函数
- 字符串函数
- JSON 函数
- Map 函数
- 模糊/正则匹配函数
- 工具函数
- 聚合函数
- Bitmap 函数
- bitmap_and
- bitmap_andnot
- bitmap_contains
- bitmap_count
- bitmap_empty
- bitmap_from_string
- bitmap_hash
- bitmap_has_any
- bitmap_intersect
- bitmap_max
- bitmap_min
- bitmap_or
- bitmap_remove
- bitmap_to_array
- bitmap_to_base64
- base64_to_bitmap
- bitmap_to_string
- bitmap_union
- bitmap_union_count
- bitmap_union_int
- bitmap_xor
- intersect_count
- sub_bitmap
- to_bitmap
- Array 函数
- array_agg
- array_append
- array_avg
- array_concat
- array_contains
- array_contains_all
- array_cum_sum
- array_difference
- array_distinct
- array_filter
- array_intersect
- array_join
- array_length
- array_map
- array_max
- array_min
- arrays_overlap
- array_position
- array_remove
- array_slice
- array_sort
- array_sortby
- array_sum
- array_to_bitmap
- reverse
- unnest
- Bit 函数
- cast函数
- hash函数
- 条件函数
- 百分位函数
- 标量函数
- 数学函数
- 系统变量
- 用户自定义变量
- 错误码
- 系统限制
- SQL参考
- 常见问题解答
- 性能测试
- 开发指南
- 外部系统集成
编辑
Export常见问题
阿里云OSS备份与还原
StarRocks支持备份数据到阿里云OSS/AWS S3(或者兼容S3协议的对象存储)等。假设有两个StarRocks集群,分别DB1集群和DB2集群,我们需要将DB1中的数据备份到阿里云OSS,然后在需要的时候恢复到DB2,备份及恢复大致流程如下:
创建云端仓库
在DB1和DB2中分别执行SQL:
CREATE REPOSITORY `仓库名称`
WITH BROKER `broker_name`
ON LOCATION "oss://存储桶名称/路径"
PROPERTIES
(
"fs.oss.accessKeyId" = "xxx",
"fs.oss.accessKeySecret" = "yyy",
"fs.oss.endpoint" = "oss-cn-beijing.aliyuncs.com"
);
a. DB1和DB2都需要创建,且创建的REPOSITORY仓库名称要相同,仓库查看:
SHOW REPOSITORIES;
b. broker_name需要填写一个集群中的broker名称,BrokerName查看:
SHOW BROKER;
c. fs.oss.endpoint后的路径不需要带存储桶名。
备份数据表
在DB1中将需要进行备份的表,BACKUP到云端仓库。在DB1中执行SQL:
BACKUP SNAPSHOT [db_name].{snapshot_name}
TO `repository_name`
ON (
`table_name` [PARTITION (`p1`, ...)],
...
)
PROPERTIES ("key"="value", ...);
PROPERTIES 目前支持以下属性:
"type" = "full":表示这是一次全量更新(默认)。
"timeout" = "3600":任务超时时间,默认为一天,单位秒。
StarRocks目前不支持全数据库的备份,我们需要在ON (……)指定需要备份的表或分区,这些表或分区将并行的进行备份。 查看正在进行中的备份任务(注意同时进行的备份任务只能有一个):
SHOW BACKUP FROM db_name;
备份完成后,可以查看OSS中备份数据是否已经存在(不需要的备份需在OSS中删除):
SHOW SNAPSHOT ON OSS仓库名;
数据还原
在DB2中进行数据还原,DB2中不需要创建需恢复的表结构,在进行Restore操作过程中会自动创建。执行还原SQL:
RESTORE SNAPSHOT [db_name].{snapshot_name}
FROMrepository_name``
ON (
'table_name' [PARTITION ('p1', ...)] [AS 'tbl_alias'],
...
)
PROPERTIES ("key"="value", ...);
查看还原进度:
SHOW RESTORE;