• CentOS7下cratedb备份及恢复(快照)


    一:创建存储库

      1.1 概要

        CREATE REPOSITORY repository_name TYPE type

        [ WITH (repository_parameter [= value], [, ...]) ]

        CRATE REPOSITORY  创建存储库

        repository_name     库名

        WITH          存储库参数

          max_snapshot_bytes_per_sec:  在此存储库单个节点上创建快照的最大速率。

                           默认:40mb每秒

          max_restore_bytes_per_sec:   此存储库在单个节点上还原快照的最大速率。

                           默认:40mb每秒

          

      1.2存储库类型

        1.2.1 fs

          服务端配置:

          centos7配置nfs

            yum -y install nfs-utils rpcbind

          设置服务开机启动:

            systemctl enable rpcbind

            systemctl enable nfs-server

            systemctl enable nfs-lock

            systemctl enable nfs-idmap

          启动nfs服务:

            systemctl start rpcbind

              systemctl start nfs-server

            systemctl start nfs-lock

            systemctl start nfs-idmap

          建立共享目录:

            mkdir -p /nfs

            chmod -R 777 /nfs

          配置需要共享的目录到 /etc/exports

            vim /etc/exports

            /nfs 192.168.10.*(rw,sync,no_root_squash)

          重新加载:

            exportfs -rv

          查看是否挂载:

            showmount -e

             客户端配置:注:客户端不需要启动nfs!

          安装nfs:

            yum -y install nfs-utils

           查看nfs共享目录:

            showmount -e 192.168.x.x

          建立目录:

            mkdir /nfs

          挂载nfs:

             mount -t nfs 192.168.10.205:/nfs /nfs

           如需要卸载:

            unmount /nfs

          查看挂载情况:

            df

           配置客户端开机自动挂载nfs共享目录

          vim /etc/fstab

            添加   192.168.x.x:/nfs /nfs nfs defaults 0 0

          

          配置crate.yml文件nfs选项:

            vim /etc/crate/crate.yml

          添加repo路径:

            path.repo: /nfs/crate

          进入crash:

            ./usr/local/crash

            cr> c 192.168.x.x:4200

          设置存储库:

            cr> CREATE  REPOSITORY  test205  TYPE  fs WITH  (location = '/nfs/crate');

          

        1.2.2 hdfs

        1.2.3 s3

        1.2.4 url

    二:创建快照

        cr> create snapshot test205.snapshot2 all;

      查询快照:

        cr> SELECT repository, name, state, concrete_indices FROM sys.snapshots ORDER BY repository, name;

    三:恢复快照

      3.1查询表

        show tables;

      3.1如要从快照还原表,要先删除表:

        DROP TABLE tablename;

      3.2恢复快照

        cr> RESTORE SNAPSHOT test205.snapshot2 TABLE test WITH (wait_for_completion=true);

    四:删除快照

      4.1查询快照:

        SELECT repository, name, state, concrete_indices FROM sys.snapshots ORDER BY repository, name;

      4.2删除快照:

        cr> DROP SNAPSHOT test205.snapshot1;

    五:删除存储库

      cr> DROP REPOSITORY "OldRepository";

    参考:

    https://crate.io/docs/crate/reference/en/latest/admin/snapshots.html#creating-a-repository

    感谢:

    https://blog.csdn.net/wudinaniya/article/details/81068518

  • 相关阅读:
    Debian apt-get 无法补全
    Python 字典排序
    Python 替换字符串
    Debian 7 64位安装 wine
    Python Virtualenv 虚拟环境
    ASP.NET MVC ModelState
    Oracle存储过程写法
    利用ODBC从SQLServer向Oracle中导数据
    web自定义控件UserControl
    工作笔记
  • 原文地址:https://www.cnblogs.com/jackyzm/p/10281796.html
Copyright © 2020-2023  润新知