1.修改参数文件
-bash-4.2$ cd /cratedb/crate-3.2.0/config
vi crate.yml 修改如下项
path.repo: /cratedb/snapdata
2.创建目录
mkdir -p /cratedb/snapdata
3.创建仓库mysnapdata
create repository mysnapdata type fs with (location='/cratedb/snapdata', compress=true);
4.创建快照
create snapshot mysnapdata.snapshot_all0815 all with (wait_for_completion=true, ignore_unavailable=true);
单独为某个表创建快照
create snapshot mysnapdata.snapshot_metric_0815 table sentinel_test.metric with (wait_for_completion=false);
5.查询快照
SELECT repository, name, state, concrete_indices FROM sys.snapshots ORDER BY repository, name;
6.从整体快照中恢复一个表
restore snapshot mysnapdata.snapshot_all0815 table sentinel_test.metric with (wait_for_completion=true);
7.删除快照
drop snapshot mysnapdata.snapshot_all0815;
8.删除仓库
drop repository "mysnapdata";
9.备份脚本
#!/bin/sh
. /etc/profile
. ~/.bash_profile
start_time=`date +%Y%m%d%H%M%S`
delete_date=`date +%Y%m%d -d "1 days ago"`
backup_date=`date +%Y%m%d`
echo -e "create snapshot cratedb_snapshot.snapshot_all_${backup_date} all with (wait_for_completion=true, ignore_unavailable=true);"|/home/middle/crash --host 172.17.0.72
echo -e "drop snapshot cratedb_snapshot.snapshot_all_${delete_date};"|/home/middle/crash --host 192.168.1.72
阅读(4210) | 评论(0) | 转发(0) |