1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
|
# check_pgbackrest
## Introduction
This `Vagrantfile` is bootstrapping 3 possible test cases:
### 1. pgBackRest configured to backup and archive on a CIFS mount
* `icinga-srv` executes check_pgbackrest by ssh with Icinga 2;
* `pgsql-srv` hosting a pgsql cluster with pgBackRest installed;
* `backup-srv` hosting the CIFS share.
Backups and archiving are done locally on `pgsql-srv` on the CIFS mount point.
### 2. pgBackRest configured to backup and archive remotely
* `icinga-srv` executes check_pgbackrest by ssh with Icinga 2;
* `pgsql-srv` hosting a pgsql cluster with pgBackRest installed;
* `backup-srv` hosting the pgBackRest backups and archives.
Backups of `pgsql-srv` are taken from `backup-srv`.
Archives are pushed from `pgsql-srv` to `backup-srv`.
Checks (retention and archives) are done both locally (on `backup-srv`) and
remotely (on `pgsql-srv`). Checks are performed from `icinga-srv` by ssh.
pgBackRest backups are use to build a Streaming Replication with `backup-srv`
as standby server.
### 3. pgBackRest configured to backup and archive to a MinIO S3 bucket
* `icinga-srv` executes check_pgbackrest by ssh with Icinga 2;
* `pgsql-srv` hosting a pgsql cluster with pgBackRest installed;
* `backup-srv` hosting the MinIO server.
## Testing
The easiest way to start testing is with the included `Makefile`.
### Test case 1
_Build_:
```bash
cd test
make s1
```
Expected make time: 7 min.
_Check the results of a manual execution of check_pgbackrest_:
```bash
vagrant ssh pgsql-srv -c "sudo /check_pgbackrest/test/regress/test-s1.bash"
```
Expected run time: 30 sec.
_To simulate some activity with pgBackRest_:
```bash
vagrant ssh pgsql-srv -c "sudo /check_pgbackrest/test/regress/simulate-activity-local.bash"
```
Modify `SCALE` factor or `ACTIVITY_TIME` in this script to simulate more activity.
### Test case 2
_Build_:
```bash
cd test
make s2
```
Expected make time: 6 min.
_Check the results of a manual execution of check_pgbackrest_:
```bash
vagrant ssh pgsql-srv -c "sudo /check_pgbackrest/test/regress/test-s2-from-primary.bash"
```
Expected run time: 50 sec.
### Test case 3
_Build_:
```bash
cd test
make s3
```
Expected make time: 8 min. (depends on MinIO download time)
_Check the results of a manual execution of check_pgbackrest_:
```bash
vagrant ssh pgsql-srv -c "sudo /check_pgbackrest/test/regress/test-s3.bash"
```
Expected run time: 40 sec.
_To simulate some activity with pgBackRest_:
```bash
vagrant ssh pgsql-srv -c "sudo /check_pgbackrest/test/regress/simulate-activity-local.bash"
```
Modify `SCALE` factor or `ACTIVITY_TIME` in this script to simulate more activity.
### Icinga 2 connectivity
_Check the results of _check_pgbackrest_ launched by Icinga 2:
```bash
vagrant ssh icinga-srv -c "sudo icingacli monitoring list services --service=pgbackrest* --verbose"
```
_Navigate to Icinga Web 2_:
Get the IP address of `icinga-srv` with:
```bash
vagrant ssh icinga-srv -c "ip addr show eth0"
```
And then go to `http://IP/icingaweb2`. Credentials are `icingaweb / icingaweb`.
### Clean up
Don't forget to clean the VM's after the tests:
```bash
make clean
```
### Generate expected regress test results
Edit the `test-*.bash` scripts and set `GENERATE_EXPECTED` to true. Run it.
Currently, expected tests results are the same for test cases 1 and 2.
## Build pgBackRest GitHub master version
To perform tests using the latest GitHub version, execute the following script
on each server where pgBackRest is installed :
```bash
vagrant ssh pgsql-srv -c "sudo /check_pgbackrest/test/regress/pgbackrest_build.bash"
```
### Extended activity
```bash
Usage: simulate-extended-activity.bash [-s <scale>] [-a <activity_time>] [-p <local|remote>]
vagrant ssh pgsql-srv -c "sudo /check_pgbackrest/test/regress/simulate-extended-activity.bash -s 10 -a 10 -p local"
```
## Tips
Find all existing VM created by vagrant on your system:
```bash
vagrant global-status
```
Shutdown all VM:
```bash
vagrant halt
```
Restart the halted cluster:
```bash
vagrant up
```
|