1

Topic: bases on Yandex-disk

I will give an example the organizations  small (but important smile) bases, can to someone will useful.
As I will be grateful for efficient comments/councils from more skilled companions.
Server Ubuntu 16.04.3 LTS, Firebird 3.0.2
High lights:
After  it is fulfilled test  and garbage collection
it is archived and copied on a jandeks-disk
Become outdated  are deleted, thus locally it is saved 5 , on a jandeks-disk 62  (for two months)
The broad gull with results of all operations goes on mail, whether on a letter subject it were possible to orient errors
[spoiler backup_db.sh]
The script is launched  at night.

#!/bin/bash
# Database adjustments
DBALIAS=
DBUSER=SYSDBA
DBPASS=
# Mail adjustments
MAILFROM =... @yandex.ru
MAILTO =... @yandex.ru
SMTPSERVER=smtp.yandex.com
SMTPLOGIN =... @yandex.ru
SMTPPASS=
# Folders
BKPPATH =/var/firebird/backup
YADPATH =/mnt/yadisk/DB
LOGPATH =/var/log
# Names of files
BKPNAME = $ DBALIAS - $ (date + %Y%m%d- % H%M)
BKPFILE = $ BKPNAME.fbk
ARCFILE = $ BKPNAME.tar.gz
RSTFILE = $ BKPFILE.fdb
# Files of dens
LOGFILE = $ LOGPATH/backup _ "$ DBALIAS" _last.log
LOGCOMM = $ LOGPATH/backup _ "$ DBALIAS".log
# Amount saved 
BACKUP_COUNT_LOC=5
BACKUP_COUNT_YAD=62
echo ""> $LOGFILE
echo "== [$ (date ' + %d. % m. % Y %H: % M ')] ====================">> $LOGFILE
echo "">> $LOGFILE
RES_ERR=0
cd $BKPPATH
# ---------------------------------------------------------------------------------------------------------------
echo "--- Bekap"
echo "--- Bekap">> $LOGFILE
SECONDS=0
gbak-b-g-se localhost:service_mgr-USER $DBUSER-PAS $DBPASS $DBALIAS $BKPPATH / $ BKPFILE &>> $LOGFILE
if [[$?! = 0]]
then
RES_ERR=1
echo "the Error at reserve copying">> $LOGFILE
else
echo "Ok">> $LOGFILE
fi
echo "Runtime: $SECONDS second">> $LOGFILE
echo "">> $LOGFILE
# Test -----------------------------------------------------------------------------------------------------
if [[$RES_ERR == 0]]
then
echo "--- Test recovery"
echo "--- Test recovery">> $LOGFILE
SECONDS=0
gbak-c-rep-se localhost:service_mgr-USER $DBUSER-PAS $DBPASS $BKPPATH / $ BKPFILE $BKPPATH / $ RSTFILE &>> $LOGFILE
if [[$?! = 0]]
then
RES_ERR=1
echo "the Error at test recovery">> $LOGFILE
else
echo "Ok">> $LOGFILE
fi
echo "Runtime: $SECONDS second">> $LOGFILE
echo "">> $LOGFILE
rm $RSTFILE
fi
# -------------------------------------------------------------------------------------------------------
if [[$RES_ERR == 0]]
then
echo "--- Arhivirovanie"
echo "--- Arhivirovanie">> $LOGFILE
rm $ARCFILE
SECONDS=0
tar-cvzf $ARCFILE $BKPFILE &>> $LOGFILE
if [[$?! = 0]]
then
RES_ERR=1
echo "the Error at ">> $LOGFILE
else
echo "Ok">> $LOGFILE
fi
echo "Runtime: $SECONDS second">> $LOGFILE
echo "">> $LOGFILE
rm $BKPFILE
# Removal become outdated  on a local disk
declare-i ARC_NUM=0
LS = "$ (ls-r $DBALIAS*.tar.gz)"
for ARC in $LS
do
ARC_NUM = $ ARC_NUM+1
if [[$ARC_NUM-gt $BACKUP_COUNT_LOC]]
then
rm $ARC
fi
done
fi
# Garbage collection-------------------------------------------------------------------------------------------------------
if [[$RES_ERR == 0]]
then
echo "--- Garbage collection"
echo "--- Garbage collection">> $LOGFILE
SECONDS=0
gfix-sweep $DBALIAS-USER $DBUSER-PA $DBPASS &>> $LOGFILE
if [[$?! = 0]]
then
RES_ERR=1
echo "the Error at garbage collection">> $LOGFILE
else
echo "Ok">> $LOGFILE
fi
echo "Runtime: $SECONDS second">> $LOGFILE
echo "">> $LOGFILE
fi
# Copying on a jandeks-disk------------------------------------------------------------------------------------------
if [[$RES_ERR == 0]]
then
echo "--- Copying on Yandex. A disk"
echo "--- Copying on Yandex. A disk">> $LOGFILE
mount/mnt/yadisk &>> $LOGFILE
SECONDS=0
cp $ARCFILE $YADPATH &>> $LOGFILE
if [[$?! = 0]]
then
RES_ERR=1
echo "the Error at copying on Yandex. A disk">> $LOGFILE
else
echo "Ok">> $LOGFILE
fi
echo "Runtime: $SECONDS second">> $LOGFILE
echo "">> $LOGFILE
# Removal become outdated  on Yandex. A disk
cd $YADPATH
declare-i ARC_NUM=0
LS = "$ (ls-r $DBALIAS*.tar.gz)"
for ARC in $LS
do
ARC_NUM = $ ARC_NUM+1
if [[$ARC_NUM-gt $BACKUP_COUNT_YAD]]
then
rm $ARC
fi
done
umount/mnt/yadisk &>> $LOGFILE
fi
# Filling of the general broad gull----------------------------------------------------------------------------------------------
cat $LOGFILE>> $LOGCOMM
# Broad gull sending on mail----------------------------------------------------------------------------------------------
echo "--- Sending of a broad gull on mail"
echo "--- Sending of a broad gull on mail">> $LOGCOMM
if [[$RES_ERR == 0]]
then
MAILSUBJ = "Reserve copying of a DB - Ok"
else
MAILSUBJ = "Reserve copying of a DB - the Error"
fi
/usr/bin/sendEmail-f "$MAILFROM"-t "$MAILTO"-o message-charset=utf-8-u "$MAILSUBJ"-o message-file = $ LOGFILE-s $SMTPSERVER-o tls=yes-xu $SMTPLOGIN-xp $SMTPPASS &>> $LOGCOMM

[/spoiler]
[spoiler access Adjustment to a jandeks-disk through webdav]
On the server it is executable:

apt-get install davfs2
If it is necessary to change adjustment:
dpkg-reconfigure davfs2
We create a folder/mnt/yadisk
We edit "/etc/davfs2/secrets", we add a line:
/mnt/yadisk @yandex.ru the password
We edit "/etc/fstab", we add a line:
https://webdav.yandex.ru/mnt/yadisk davfs user, rw, noauto 0 0
We check assembling:
mount/mnt/yadisk
Let's dismount:
umount/mnt/yadisk

[/spoiler]
[spoiler the Example of a broad gull which comes on mail]
Letter subject: "Reserve copying of a DB - Ok"

==[2/18/2018 03:00] ====================
---- 

Runtime: 22 seconds
---- Test recovery

Runtime: 33 seconds
---- 
db-20180218-0300.fbk

Runtime: 19 seconds
---- Garbage collection

Runtime: 2 seconds
---- Copying on Yandex. A disk

Runtime: 1 seconds

[/spoiler]

2

Re: bases on Yandex-disk

Earlier there were jokes about  for a companion of the major, time of a new coil came...
In what sense to store a cutoff "important"  on a free and sad cloud which besides at the first possibility it will be over to that by whom asks?
Worthless advertizing, .

3

Re: bases on Yandex-disk

Thanks.
Igor Guryanov> As I will be grateful for efficient comments/councils from more skilled companions.
Igor Guryanov> a. After  it is fulfilled test  and garbage collection>
And sense to do and , and garbage collection?
The basis does not stop, it is impossible to change?

4

Re: bases on Yandex-disk

Guryanov wrote:

gbak-c-rep

Charm, charm....

5

Re: bases on Yandex-disk

In this case , it not a DB file.

6

Re: bases on Yandex-disk

mars478 wrote:

there were jokes about  for a companion of the major Earlier, time of a new coil came...
In what sense to store a cutoff "important"  on a free and sad cloud which besides at the first possibility it will be over to that by whom asks?
Worthless advertizing, .

With interest I will study your method of reserve copying inaccessible to a companion to the major, protected from those who asks, and thus economically expedient for small business smile
And if on business:
Exception of process of one only a jandeks-disk of complexities for a companion of the major especially you will not add (it is recalled  at all providers, laws Summer and others);
From those who asks reliably enough protects enciphering of archive by the archiver;
Far not for each business (small) it is economically expedient to tear own server for similar tasks;
The sad jandeks-disk is not pleasant - use bourgeois analogs.

7

Re: bases on Yandex-disk

Rustam wrote:

And sense to do and , and garbage collection?
The basis does not stop, it is impossible to change?

Yes, the basis does not stop.

8

Re: bases on Yandex-disk

Gadzhimuradov Rustam;
In this case it is a schizophrenia (I about simultaneous instructions-c-rep). One hope that in any version Firebird developers all the same teach gbak to use foul language on simultaneous instructions of parallel options.
And then we learn, how to many people suffers that are not able to read.
Besides, I am am admired here with it
rm $RSTFILE
Already how many time I spoke - if you do test  what horse-radish you  delete result? IT should be archived and saved, instead of .
Yes,  the basis is more in size, than . But it is already ready to usage, unlike .
Or do not do test , or do not store  after .

9

Re: bases on Yandex-disk

kdv> Already how many time I spoke-... Or do not do test , or do not store  after .
Whether that you told Mahlo. "" basis of anything, except saving
Time on  in a case  does not give. And in this case the small
The scoring on time can be , problems will be more important.

10

Re: bases on Yandex-disk

Guryanov wrote:

With interest I will study your method of reserve copying inaccessible to a companion to the major, protected from those who asks, and thus economically expedient for small business

All that is stored in the generally available Internet it is possible to consider already potentially merged, but after all the basis is declared "important" - it means is inadmissible. And considering that it also "small" - on an exterior disk in 2 should get, with enciphering quite to itself a variant. In case of failure other carrier with  on it a key is successfully lost - even if it was necessary to give a disk, let play with it while all will not be completed behind the prescription expiry of the term.
But yes, if to the server come with the decision - all that is necessary people receive, so described above concerns only  and displays of "preschedule" interest to them.

11

Re: bases on Yandex-disk

Rustam wrote:

"Otrestorennaja" basis of anything, except saving
Time on  in a case  does not give. And in this case the small
The scoring on time can be , problems will be more important.

basis it already basis which can be used, either as rid-onli, or as archive, etc.
It is clear that if at the person 62  on a jandeks-disk, bases at it small.
However, it acquires at present bad habits which, as a rule, are saved.
And when bases will be more, here then these bad habits already will look extremely strange.
Normally happens so - when you see here such delirium in scripts  and , you ask - who  invented this?
In the answer - yes who knows it, so has already been written to us.

12

Re: bases on Yandex-disk

kdv wrote:

in this case it is a schizophrenia (I about simultaneous instructions-c-rep). One hope that in any version Firebird developers all the same teach gbak to use foul language on simultaneous instructions of parallel options.
And then we learn, how to many people suffers that are not able to read.

Well, here it agree. Re-read the documentation.

kdv wrote:

IT should be archived and saved, instead of .
Yes,  the basis is more in size, than . But it is already ready to usage, unlike .
Or do not do test , or do not store  after .

Well so this your especially personal judgement, what for it to all to impose in such categorical form. Test  I do not from the big desire, and because of  singularities . In what else DBMS  can unmistakably form, but thus to be unsuitable for basis recovery? And about to store a file of basis instead of  - generally a question at issue. That it is more important: time of recovery or the volume occupied  and transferred on communication channels - entirely depends on project singularities. Somewhere one is more important, somewhere another.
P.S.
Though, thinking I partially with you I will agree)) to Archive and far off store I all the same I will , but here locally to save the torn basis in certain cases it will be useful.

13

Re: bases on Yandex-disk

Guryanov wrote:

Test  I do not from the big desire, and because of  singularities . In what else DBMS  can unmistakably form, but thus to be unsuitable for basis recovery?

In what else DBMS is  in the form of export of the data to other format, instead of in the form of a page copy?
What there with a question practical side?
What claims in Firebrid to  in the form of those page copies?
Can it is necessary to study a question before doing such outputs?
For, judging by the used keys gbak, the question was not studied rather superficially...

14

Re: bases on Yandex-disk

Guryanov wrote:

As I will be grateful for efficient comments/councils

1. nbackup-L
2. To compress basis with the help lzma with  1
3. To suppose archive on reverse EncFS, mount point in a jandeks-disk folder
4. nbackup-N

15

Re: bases on Yandex-disk

hvlad wrote:

In what else DBMS is  in the form of export of the data to other format, instead of in the form of a page copy?
What there with a question practical side? [/hvlad]
In PG is :-) Also there is a whole article in them  why  does not give 100 % of a warranty and can not be recovered :-) But it is guilty as always , aha.

16

Re: bases on Yandex-disk

Guryanov wrote:

That is more important: time of recovery or the volume occupied  and transferred on communication channels - entirely depends on project singularities. Somewhere one is more important, somewhere another.

While at you basis and  microscopic, to you it is not important neither volume, nor downloading time on channels, other nonsense.
Here when at you  will last at least minutes 15-20 then you cease to reflect that it is necessary to save -  or ready basis.

17

Re: bases on Yandex-disk

the commentator wrote:

it is passed...
1. nbackup-L
2. To compress basis with the help lzma with  1
3. To suppose archive on reverse EncFS, mount point in a jandeks-disk folder
4. nbackup-N

3 and 4 to change in places

18

Re: bases on Yandex-disk

kdv wrote:

Here when at you  will last at least minutes 15-20 then you cease to reflect that it is necessary to save -  or ready basis.

If test recovery becomes on a separate network share - it is not necessary to reflect especially.
If test recovery becomes on a local disk, it is necessary to reflect - that better: quickly to be recovered or store it is more .
Well or to reflect on the organization of more difficult procedure since the place for working basis, " the saved basis" and current pair "a file  and test recovery" is required to "an uncontested variant".

Posts [ 18 ]

Pages 1

You must login or register to post a reply