A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/orgrim/pg_back/commit/67722a11ad91df3a1b8bce207b2d441456143583 below:

Improve README.md (#44) · orgrim/pg_back@67722a1 · GitHub

@@ -6,8 +6,8 @@ pg_back is a dump tool for PostgreSQL. The goal is to dump all or some

6 6

databases with globals at once in the format you want, because a simple call to

7 7

pg_dumpall only dumps databases in the plain SQL format.

8 8 9 -

Behind the scene, pg_back uses pg_dumpall to dump roles and tablespaces

10 -

definitions, pg_dump to dump all or each selected database to a separate file

9 +

Behind the scene, pg_back uses `pg_dumpall` to dump roles and tablespaces

10 +

definitions, `pg_dump` to dump all or each selected database to a separate file

11 11

in the custom format. It also extract database level ACL and configuration that

12 12

is not dumped by pg_dump older than 11. Finally, it dumps all configuration

13 13

options of the PostgreSQL instance.

@@ -27,29 +27,37 @@ options of the PostgreSQL instance.

27 27 28 28

## Install

29 29 30 +

A compiled binary is available from the [Github repository](https://github.com/orgrim/pg_back/releases).

31 + 32 +

The binary only needs `pg_dumpall` and `pg_dump`.

33 + 34 +

## Install from source

35 + 30 36

```

31 37

go get -u github.com/orgrim/pg_back

32 38

```

33 39 34 -

Use `make` to build and install from source.

40 +

Use `make` to build and install from source (you need go 1.16 or above).

35 41 36 -

As an alternative, the following *docker* command downloads, compiles and put `pg_back`

42 +

As an alternative, the following *docker* command downloads, compiles and puts `pg_back`

37 43

in the current directory:

38 44 39 45

```

40 46

docker run --rm -v "$PWD":/go/bin golang:1.16 go get github.com/orgrim/pg_back

41 47

```

42 48 43 -

The binary only needs `pg_dumpall` and `pg_dump`.

44 - 45 49

## Usage

46 50 47 51

Use the `--help` or `-?` to print the list of available options. To dump all

48 -

database, you only need to give the proper connection options to the PostgreSQL

52 +

databases, you only need to give the proper connection options to the PostgreSQL

49 53

instance and the path to a writable directory to store the dump files.

50 54 51 -

The defaut output directory `/var/backups/postgresql` may not exists or have

52 -

the proper ownership for you user, use `-b` to give the path where to store the

55 +

If default and command line options are not enough, a configuration file

56 +

may be provided with `-c <configfilename>`.

57 +

(Note: see below to convert configuration files from version 1.)

58 + 59 +

If the default output directory `/var/backups/postgresql` does not exist or has

60 +

improper ownership for your user, use `-b` to give the path where to store the

53 61

files. The path may contain the `{dbname}` keyword, that would be replaced by

54 62

the name of the database being dumped, this permits to dump.

55 63

@@ -58,13 +66,13 @@ need less known connection options such as `sslcert` and `sslkey`, you can give

58 66

a `keyword=value` libpq connection string like `pg_dump` and `pg_dumpall`

59 67

accept with their `-d` option.

60 68 61 -

The others command line options let you tweak what is dumped, purged, and how

62 -

it is done. These options can be put in a configuration file. The command lien

69 +

The other command line options let you tweak what is dumped, purged, and how

70 +

it is done. These options can be put in a configuration file. The command line

63 71

options override configuration options.

64 72 65 73

Per-database configuration can only be done with a configuration file. The

66 -

configuration file uses the ini format, global options are in a unspecified

67 -

section at the top of the file and database specific options are in a section

74 +

configuration file uses the `ini` format, global options are in a unspecified

75 +

section at the top of the file, and database specific options are in a section

68 76

named after the database. Per database options override global options of the

69 77

configuration file.

70 78

@@ -78,7 +86,7 @@ templates are dumped. To include templates, use `--with-templates` (`-T`), if

78 86

templates are includes from the configuration file, `--without-templates` force

79 87

exclude them.

80 88 81 -

Databases can be excluded with --exclude-dbs (-D), it is a comma separated list

89 +

Databases can be excluded with `--exclude-dbs` (`-D`), which is a comma separated list

82 90

of database names. If a database is listed on the command line and part of

83 91

exclusion list, exclusion wins.

84 92

@@ -102,23 +110,32 @@ A number of dump files to keep when purging can also be specified with

102 110

`--purge-min-keep` (`-K`) with the special value `all` to keep everything, thus

103 111

avoiding file removal completly. When both `--purge-older-than` and

104 112

`--purge-min-keep` are used, the minimum number of dumps to keep is enforced

105 -

before old dumps are removed. This avoid remove all dumps when the time

113 +

before old dumps are removed. This avoids removing all dumps when the time

106 114

interval is too small.

107 115 108 116

A command can be run before taking dumps with `--pre-backup-hook`, and after

109 -

with `--post-backup-hook`. The command are executed directly, not by a shell,

117 +

with `--post-backup-hook`. The commands are executed directly, not by a shell,

110 118

respecting single and double quoted values. Even if some operation fails, the

111 119

post backup hook is executed when present.

112 120 113 121

## Managing the configuration file

114 122 123 +

The previous v1 configuration files are not compatible with pg_back v2.

124 + 115 125

Give the path of the v1 configuration file to the `--convert-legacy-config`

116 126

command line option, and pg_back will try its best to convert it to the v2

117 -

format.

127 +

format. Redirect the output to the new configuration file:

128 + 129 +

```

130 +

pg_back --convert-legacy-config pg_back1.conf > pg_back2.conf

131 +

```

118 132 119 133

The default configuration file can be printed with the `--print-default-config`

120 134

command line option.

121 135 136 +

On some environments (especially Debian), you may have to add `host = /var/run/postgresql`

137 +

to override the default `/tmp` host.

138 + 122 139

## Testing

123 140 124 141

Use the Makefile or regular `go test`.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4