备份 cassandra 或 scyladb 以便我们可以轻松在开发环境中恢复它的正确(建议)方法是什么?
我正在尝试设置到酒保服务器的流复制。
酒保配置非常基本,我正在使用backup_method = postgres.
[barman]
barman_home = /var/lib/barman
barman_user = barman
log_file = /var/log/barman/barman.log
log_level = DEBUG
archiver = true
backup_method = postgres
backup_options = concurrent_backup
compression = gzip
minimum_redundancy = 1
retention_policy = RECOVERY WINDOW OF 7 DAYS
retention_policy_mode = auto
streaming_archiver = true
wal_retention_policy = main
configuration_files_directory = /etc/barman.conf.d
Run Code Online (Sandbox Code Playgroud)
我会调用数据库服务器pg
[pg]
description = "pg"
ssh_command = ssh postgres@pg.example.com
conninfo = user=barman dbname=postgres host=pg.example.com port=5432
Run Code Online (Sandbox Code Playgroud)
我已经配置了 hba 规则并在's home中设置了一个.pgpass文件。barman/var/lib/barman/.pgpass
与服务器的测试连接pg工作正常: …
我希望将 PostgreSQL 10 集群从server1克隆到server2,它在相同的硬件上运行相同的 Postgres 版本。目的是负载平衡和 HA。要记住的事情:
我考虑过的选项:
pg_dump | psql 当然,但这需要重新创建索引,并且对于相同系统之间的完整副本来说似乎非常缓慢且效率低下。rsync所有 Postgres 文件夹和文件。有这么多数据存在数据损坏的风险,我需要确保我得到了所有东西(大概只有数据目录是不够的)。pg_basebackup直接通过管道以pg_receivewal某种方式完成这项工作吗?找不到我的用例的说明。做到这一点的最佳方法是什么?好像是很常见的情况。
假设我要在 SQL Server 中恢复备份(2 GB),我的磁盘中有足够的空间(20 GB),但是 SQL Server 是否遵循任何算法来计算所需的最小磁盘空间或只是随机检查磁盘空间和备份才能成功恢复。
因为我想了解SQL Server的内部工作原理。
提前致谢。
我使用以下命令在 PostgreSQL 11.6(带有 TimescaleDB 1.60 扩展)中创建了数据库的备份pg_dump:
PGPASSWORD=mypassword pg_dump -h 127.22.0.4 -p 5432 -U postgres -Z0 -Fc database_development
Run Code Online (Sandbox Code Playgroud)
并将其恢复到运行相同版本的 PostgreSQL 11.6(带有 TimescaleDB 1.60 扩展)的新服务器pg_restore。对于恢复,以psql用户身份执行以下命令postgres:
CREATE DATABASE database_development;
\c database_development
CREATE EXTENSION timescaledb;
SELECT timescaledb_pre_restore();
\! time pg_restore -Fc -d database_development /var/lib/postgresql/backups/database_development_2020-02-29
SELECT timescaledb_post_restore();
Run Code Online (Sandbox Code Playgroud)
原始数据库的数据库大小为 389 GB,但恢复的数据库为 229 GB。这些尺寸是通过运行获得的
select pg_size_pretty(pg_database_size('database_development'))
Run Code Online (Sandbox Code Playgroud)
一些差异:
旧数据库存储在 ext4 分区上,而新数据库存储在禁用压缩的 ZFS 文件系统上。两个数据库实例都在具有 Ubuntu 18.04 主机的 Docker 容器内运行。
问题:我们如何解释数据库大小的差异?pg_dump和期间都没有遇到错误pg_restore。
我正在 SQL Server 2017 上运行加密备份。
进行测试恢复,失败:
RESTORE DATABASE [test]
FROM DISK = N'\\DPH-DD-SLI-001\SLI_SQL_Backups\Encrypted\DPH-SQL-SLI-12P\BTBLEAD\FULL\DPH-SQL-SLI-12P_BTBLEAD_FULL_20201021_185145.bak'
WITH NORECOVERY, REPLACE;
RESTORE DATABASE [test]
FROM DISK = N'\\DPH-DD-SLI-001\SLI_SQL_Backups\Encrypted\DPH-SQL-SLI-12P\BTBLEAD\DIFF\DPH-SQL-SLI-12P_BTBLEAD_DIFF_20201022_071002.bak'
WITH NORECOVERY;
Run Code Online (Sandbox Code Playgroud)
Processed 199264 pages for database 'test', file 'BTBLEAD_Data' on file 1.
Processed 2 pages for database 'test', file 'BTBLEAD_Log' on file 1.
RESTORE DATABASE successfully processed 199266 pages in 446.348 seconds (3.487 MB/sec).
Msg 3136, Level 16, State 1, Line 6 This differential backup cannot be restored
because the database has not been restored to …Run Code Online (Sandbox Code Playgroud) 我发现在生产服务器上有一个名为 MYOBInterim 的数据库。在其他环境(开发、测试)上,有一个名为 MYOBTraining 的数据库。(别问我为什么——我还在努力得到那个答案……)
我从开发实例创建了其中一个 MYOBTraining 数据库的备份,然后尝试将其恢复到另一个没有此类数据库的开发实例。
我的 SQL 大致如下。
use master;
go
If(db_id(N'MYOBTraining') IS NULL)
create database MYOBTraining
on
(name = MYOBTraining,
filename = 'D:\Database\Dev4\MYOBTraining.mdf' )
log on
(name = MYOBTraining_log,
filename = 'E:\Logs\Dev4\MYOBTraining_1.ldf' )
;
go
-- BIG NOTE:
-- Note we are moving 'MYOBInterim' (and not 'MYOBTraining')!
-- Prod calls this DB MYOBInterim. Even though we obtain the backup for use with this restore from DEV - where the DB is called MYOBTraining,
-- It seems …Run Code Online (Sandbox Code Playgroud) 需要你的帮助。尽管运行 sql 代理服务帐户的域帐户对该共享文件夹具有完全权限,但我的 sql 作业无法备份到共享文件夹。
除此之外,我的 sql 服务帐户使用默认虚拟登录。因此,当我将该帐户更改为我也用于 sql 代理服务帐户的域帐户时,问题就解决了。
为什么我不能使用 sql 代理服务帐户备份到共享文件夹?
我们的 PostgreSQL 数据库之一中有一些大型临时表/临时表。其中的数据可以在数据库恢复后从其他数据库自动重新生成,并且不是业务关键型数据。使用 Barman 备份时有没有办法忽略这些表?它们都在一个模式中。
这是为了减少恢复时间并节省空间。
也许我们可以使用某种持久临时表?表空间?
我们有这些表是因为我们做 ETL 时很方便。但不被任何应用程序或客户端使用。
还有其他替代方法可以做类似的事情吗?
我读过的一些文档:
我已经阅读了很长时间,当数据库启用了 TDE 时,压缩备份似乎并不安全。
是否有人在使用 tde 数据库的压缩备份还原期间遇到错误?
我从未经历过此类错误,但我真的很担心。
似乎问题出在 SQL SERVER 2016 上,因为我使用的是 2012,所以我看不到任何问题。
此外,即使使用MAXTRANSFERSIZE = 131072备份也不压缩。会是什么呢?我正在使用NO CHECKSUM和WITH CHECKSUM两者的尺寸相同。
backup compression sql-server-2012 transparent-data-encryption
backup ×10
postgresql ×4
sql-server ×4
barman ×2
restore ×2
cassandra ×1
compression ×1
disk-space ×1
jobs ×1
pg-dump ×1
pg-restore ×1
replication ×1
scylladb ×1