пятница, 31 мая 2019 г.

Синхронизация с cwRsync

Синхронизация с cwRsync
How to: cwRsync 5.0+ GUI, rsync on windows
cwRsync_5.5.0_x86_Free
Windows: cwRsync to replicate data from source to target
Installing & Using Rsync on Windows

cwRsync поставляетя в варианте клиента и сервера
клиент стоит 17$, сервер 22$.

В поставках варианты 32 и 64 бит.

rsync --version
rsync  version 3.1.3  protocol version 31
Copyright (C) 1996-2018 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
Capabilities:
    64-bit files, 64-bit inums, 32-bit timestamps, 64-bit long ints,
    socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,
    append, no ACLs, no xattrs, iconv, symtimes, prealloc
rsync comes with ABSOLUTELY NO WARRANTY.  This is free software, and you
are welcome to redistribute it under certain conditions.  See the GNU
General Public Licence for details.

В поставке sygwin на это момент была версия 3.1.2
rsync --version
rsync  version 3.1.2  protocol version 31
Copyright (C) 1996-2015 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
Capabilities:
    64-bit files, 64-bit inums, 32-bit timestamps, 64-bit long ints,
    socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,
    append, ACLs, no xattrs, iconv, symtimes, prealloc
rsync comes with ABSOLUTELY NO WARRANTY.  This is free software, and you
are welcome to redistribute it under certain conditions.  See the GNU
General Public Licence for details. 

Сервер на 10 встает без проблем, но требует действующую или новую учетную запись с паролем. Иногда это не преемлимо, тогда можно установить как сервер как demon



 password :

Stop RsyncServer service
Execute: "C:\Users\user\AppData\Local\Temp\nsxD10B.tmp\icw_base_4.3.0_x64_installer.exe"
Execute: "C:\Users\user\AppData\Local\Temp\nsxD10B.tmp\icw_rsyncserver_2.4.0_x64_installer.exe"  /u=SvcCWRSYNC /p=password
Output folder: C:\Program Files\ICW
Created uninstaller: C:\Program Files\ICW\uninstall_cwrsync_server.exe
Creating shortcuts
Create folder: C:\Users\user\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\cwrsync_server
Output folder: C:\Program Files\ICW
Create shortcut: C:\Users\user\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\cwrsync_server\01. rsyncd.conf.lnk
Create shortcut: C:\Users\user\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\cwrsync_server\02. Prep a Directory for Upload.lnk
Completed






rsyncd.conf :

use chroot = false
strict modes = false
hosts allow = *
log file = rsyncd.log

# Module definitions
# Remember cygwin naming conventions : c:\work becomes /cygwin/c/work
#
[backup]
path = /cygdrive/d/backup
read only = false
transfer logging = yes

Установка демона:

Файл c:\rsyncd\rsyncd.conf

use chroot = false
strict modes = false
hosts allow = *
log file = rsyncd.log

# Module definitions
# Remember cygwin naming conventions : c:\work becomes /cygwin/c/work
#
[diskc]
path = /cygdrive/c/
read only = false
transfer logging = yes

[diskd]
path = /cygdrive/d/
read only = false
transfer logging = yes


[diske]
path = /cygdrive/e/
read only = false
transfer logging = yes


[diskf]
path = /cygdrive/f/
read only = false
transfer logging = yes

 Файл start.bat

c:\rsyncd\bin\rsync.exe --daemon --config=/cygdrive/c/rsyncd/rsyncd.conf  --log-file=/cygdrive/c/rsyncd/rsyncservice.log --address=192.168.1.226

 
Пример:
g:/rsyncd/bin/rsync.exe -r /cygdrive/d/yandex_disk/backup_2019_04_18.7z 192.168.1.226::diskc/rsyncd --progress

backuppc_rsync-server.nsi

Ручная регистрация службы  RsyncServer

c:\rsyncd\bin\cygrunsrv -I "RsyncServer" -p /cygdrive/c/rsyncd/bin/rsync.exe -a "--config=/cygdrive/c/rsyncd/rsyncd.conf --daemon --no-detach" -o -t auto -e "CYGWIN=nontsec binmode" -1 /cygdrive/c/rsyncd/rsyncd-stdin.log -2 /cygdrive/c/rsyncd/rsyncd-stderr.log -y tcpip -f "Rsync daemon service"

Полезные команды:

c:\rsyncd\bin\cygrunsrv --verbose --start "RsyncServer"

Удаление службы RsyncServer

c:\rsyncd\bin\cygrunsrv --verbose --stop "RsyncServer"

c:\rsyncd\bin\cygrunsrv -R "RsyncServer"

c:\rsyncd\bin\cygrunsrv --help


>rsync -r --perms --chmod=777  192.168.0.46::diskd/backup/rsync_32_64.exe .
или
>rsync -r --perms --chmod=ugo+rwx  192.168.0.46::diskd/backup/rsync_32_64.exe .


четверг, 30 мая 2019 г.

Setup rsync server over SSH on Windows

Backing up Windows machines using rsync and ssh

rsync на флешке

Сервер на windows (32 бит)
QtdSync

или

Установить Cygwin
setup-x86.exe
 
Сервер на Windows 10 (64  бит)

setup-x86_64.exe

или 

cygwin-rsyncd


douwnload.bat

@echo off
SET PROGRAMMDIR=%CD%rsync
cd backup
"%PROGRAMMDIR%\rsync.exe" -avz 192.168.10.150::backup . --progress
set MSG="Press Enter"
echo %MSG%
runas /user:# "" >nul 2>&1

upload.bat

@echo off
SET PROGRAMMDIR=%CD%rsync
cd backup
"%PROGRAMMDIR%\rsync.exe" -avz  . 192.168.10.150::backup --progress
set MSG="Press Enter"
echo %MSG%
runas /user:# "" >nul 2>&1


Локальный download

@echo off
SET PROGRAMMDIR=%CD%rsync
cd backup
"%PROGRAMMDIR%\rsync.exe" -avz  /cygdrive/D/backup . --progress
set MSG="Press Enter"
echo %MSG%
runas /user:# "" >nul 2>&1


Локальный upload

@echo off
SET PROGRAMMDIR=%CD%rsync
cd backup
"%PROGRAMMDIR%\rsync.exe" -avz  . /cygdrive/D/backup  --progress
set MSG="Press Enter"
echo %MSG%
runas /user:# "" >nul 2>&1



среда, 29 мая 2019 г.

Дружим rclone с Яндекс.Диском

Дружим rclone с Яндекс.Диском
Yandex Disk
Rclone: rsync для облаков

rclone.exe --config string rclone.conf

c:\Users\user\.config\rclone\rclone .conf

>rclone lsd yandex:
2019/05/29 20:17:35 Automatically upgraded OAuth config.
           0 2019-04-07 20:39:22        -1 backup

>rclone mkdir yandex:backups

rclone sync d:/z yandex:backups
 
rclone sync d:/z yandex:backups --progress
Transferred:      903.496M / 3.208 GBytes, 28%, 10.803 MBytes/s, ETA 3m40s
Errors:                 0
Checks:                 1 / 1, 100%
Transferred:            0 / 1, 0%
Elapsed time:     1m23.6s
Transferring:
 *                           kl_2019-05-28.dt.7z: 27% /3.208G, 11.025M/s, 3m36s 


e:\rclone>rclone sync d:/z yandex:backups --progress --config rclone.conf
Transferred:      828.402M / 3.208 GBytes, 25%, 10.536 MBytes/s, ETA 3m53s6s
Errors:                 0
Checks:                 1 / 1, 100%
Transferred:            0 / 1, 0%
Elapsed time:     1m18.6s
Transferring:

CryptSync

вторник, 28 мая 2019 г.

cygwin-rsyncd 64 бит

Обратить внимание только 64 бит !!!
cygwin-rsyncd
cygwin-rsyncd
Установка BackupPC

Google перевод:

Rsyncd

Загрузите rsyncd вариант без инсталлятора
Вариант с инсталлятором
Создайте папку с именем rsyncd в C: и разархивируйте содержимое в c: rsyncd ,

rsyncd.conf :
use chroot = false
strict modes = false
hosts allow = *
log file = rsyncd.log

# Module definitions

# Remember cygwin naming conventions : c:\work becomes /cygwin/c/work
#
[backup]
path = /cygdrive/d/backup
read only = false
transfer logging = yes

Установка демона:

Файл c:\rsyncd\rsyncd.conf

use chroot = false
strict modes = false
hosts allow = *
log file = rsyncd.log

# Module definitions
# Remember cygwin naming conventions : c:\work becomes /cygwin/c/work
#
[diskc]
path = /cygdrive/c/
read only = false
transfer logging = yes

[diskd]
path = /cygdrive/d/
read only = false
transfer logging = yes


[diske]
path = /cygdrive/e/
read only = false
transfer logging = yes


[diskf]
path = /cygdrive/f/
read only = false
transfer logging = yes

 Файл start.bat

c:/rsyncd/bin/rsync.exe --daemon --config=c:/rsyncd/rsyncd.conf  --log-file=/cygdrive/c/rsyncd/rsyncservice.log --address=192.168.1.226

 
Пример:
g:/rsyncd/bin/rsync.exe -r /cygdrive/d/yandex_disk/backup_2019_04_18.7z 192.168.1.226::diskc/rsyncd --progress

backuppc_rsync-server.nsi

Ручная регистрация службы  RsyncServer

c:\rsyncd\bin\cygrunsrv -I "RsyncServer" -p /cygdrive/c/rsyncd/bin/rsync.exe -a "--config=/cygdrive/c/rsyncd/rsyncd.conf --daemon --no-detach" -o -t auto -e "CYGWIN=nontsec binmode" -1 /cygdrive/c/rsyncd/rsyncd-stdin.log -2 /cygdrive/c/rsyncd/rsyncd-stderr.log -y tcpip -f "Rsync daemon service"

Полезные команды:

c:\rsyncd\bin\cygrunsrv --verbose --start "RsyncServer"

Удаление службы RsyncServer

c:\rsyncd\bin\cygrunsrv --verbose --stop "RsyncServer"

c:\rsyncd\bin\cygrunsrv -R "RsyncServer"

c:\rsyncd\bin\cygrunsrv --help

QtdSync

воскресенье, 26 мая 2019 г.

Установка RSync в Windows Cygwin 32 бит

Установить Cygwin
Готовый варинт cygwin-rsyncd 64 бит
setup-x86_64.exe
setup-x86.exe
TUTORIALS Rsync
SSH and Rsync within Cygwin
Installing & Using Rsync on Windows
Настройка обмена РИБ через RSYNC
RSYNC: Резервное копирование. Простой backup-скрипт
Заметки
Backing up Windows machines using rsync and ssh by Manu Garg
man rsyncd.conf


Найти и установить rsync

Скоприровать файлы (32 bit)

c:\cygwin\bin\rsync.exe
c:\cygwin\bin\cygwin1.dll
c:\cygwin\bin\cygiconv-2.dll
c:\cygwin\bin\cyggcc_s-1.dll
c:\cygwin\bin\cygpopt-0.dll
c:\cygwin\bin\cygintl-8.dll

в папку c:\rsync\

>rsync --version
rsync  version 3.1.2  protocol version 31
Copyright (C) 1996-2015 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
Capabilities:
    64-bit files, 64-bit inums, 32-bit timestamps, 64-bit long ints,
    socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,
    append, ACLs, no xattrs, iconv, symtimes, prealloc

rsync comes with ABSOLUTELY NO WARRANTY.  This is free software, and you
are welcome to redistribute it under certain conditions.  See the GNU
General Public Licence for details.


Создать файл c:\rsync\rsync.conf

use chroot = no
pid file = rsync.pid
strict modes = false


[backup]
    path=/cygdrive/D/Copy/Backup/1
    read only = no
 

Сохранить.

Создать файл c:\rsync\rsync.bat 

del /F /Q c:\rsync\rsync.pid
rsync.exe --daemon --config=/cygdrive/c/rsync/rsync.conf  --log-file=/cygdrive/c/rsync/rsyncservice.log --address=192.168.0.2
 

Сохранить.

Запускать планировщиком при входе в систему
c:\rsync\rsync.bat 

или по необходимости.

На клиенте:

>rsync  -avz 192.168.0.2::backup  /cygdrive/D/z  --progress

Настройка Ubuntu 16.04

$ sudo nano /etc/default/rsync

#RSYNC_ENABLE=false
RSYNC_ENABLE=true

Сохранить.


$ sudo nano /etc/rsyncd.conf
# create new
# any name you like

[backup]
# destination directory to copy

path = /home/backup
# hosts you allow to access

hosts allow = 192.168.1.0/255.255.255.0
hosts deny = *
list = true
uid = root
gid = root
read only = false


Сохранить.

$ sudo mkdir /home/backup
$ sudo systemctl enable rsync
$ sudo systemctl start rsync

RSync. Примеры использования

Проверка:

>rsync 192.168.0.5::backup
drwxr-xr-x          4,096 2019/05/27 19:43:53 .
drwxrwx---          4,096 2019/04/15 17:56:35 backups


Синхронизация:

>rsync -avz  /cygdrive/C/pg_probackup/backups 192.168.0.5::backup --progress 

Синхронизация в папку с датой

>rsync --delete -backup --backup-dir=/backup-%DATE:~6,4%-%DATE:~3,2%-%DATE:~0,2% -avz /cygdrive/C/pg_probackup/backups 192.168.0.5::backup/backup-%DATE:~6,4%-%DATE:~3,2%-%DATE:~0,2% --progress

rsync --delete -backup --backup-dir=/backup-%DATE:~6,4%-%DATE:~3,2%-%DATE:~0,2% -avz /cygdrive/C/pg_probackup/backups 10.8.0.1::backup/backup-%DATE:~6,4%-%DATE:~3,2%-%DATE:~0,2% --progress

rsync --delete -backup --backup-dir=/backup-%DATE:~6,4%-%DATE:~3,2%-%DATE:~0,2% -avz /cygdrive/D/copy/Arhiv 10.8.0.1::backup/backup-%DATE:~6,4%-%DATE:~3,2%-%DATE:~0,2% --progress
 
rsync --delete -avz 10.8.0.1::backup  /cygdrive/D/z  --progress

===================================================
Готовый варинт cygwin-rsyncd 64 бит
Запуск службы, повторить структуру каталогов как
Загрузите rsyncd вариант без инсталлятора 

Заменить *.exe и *.dll на 32 бит из c:\cygwin\bin\
Еще понадобится c:\cygwin\bin\cygrunsrv

Установка демона:

Файл c:\rsyncd\rsyncd.conf

use chroot = false
strict modes = false
hosts allow = *
log file = rsyncd.log

# Module definitions
# Remember cygwin naming conventions : c:\work becomes /cygwin/c/work
#
[diskc]
path = /cygdrive/c/
read only = false
transfer logging = yes

[diskd]
path = /cygdrive/d/
read only = false
transfer logging = yes


[diske]
path = /cygdrive/e/
read only = false
transfer logging = yes


[diskf]
path = /cygdrive/f/
read only = false
transfer logging = yes

 Файл start.bat

c:/rsyncd/bin/rsync.exe --daemon --config=c:/rsyncd/rsyncd.conf  --log-file=/cygdrive/c/rsyncd/rsyncservice.log --address=192.168.1.226

 
Пример:
g:/rsyncd/bin/rsync.exe -r /cygdrive/d/yandex_disk/backup_2019_04_18.7z 192.168.1.226::diskc/rsyncd --progress

backuppc_rsync-server.nsi

Ручная регистрация службы  RsyncServer

c:\rsyncd\bin\cygrunsrv -I "RsyncServer" -p /cygdrive/c/rsyncd/bin/rsync.exe -a "--config=/cygdrive/c/rsyncd/rsyncd.conf --daemon --no-detach" -o -t auto -e "CYGWIN=nontsec binmode" -1 /cygdrive/c/rsyncd/rsyncd-stdin.log -2 /cygdrive/c/rsyncd/rsyncd-stderr.log -y tcpip -f "Rsync daemon service"

Полезные команды:

c:\rsyncd\bin\cygrunsrv --verbose --start "RsyncServer"

Удаление службы RsyncServer

c:\rsyncd\bin\cygrunsrv --verbose --stop "RsyncServer"

c:\rsyncd\bin\cygrunsrv -R "RsyncServer"

c:\rsyncd\bin\cygrunsrv --help


Dns Leak Test может быть выполнен из терминала

суббота, 25 мая 2019 г.

Astra Linux Орёл 2.12.13 КриптоПро 4.0.9963 госзакупки и площадки


Данная статья ремейк
Информация о необходимости проведения настройки рабочего места пользователя

А также требованием установить свежую КриптоПро 4.0.9963

Astra Linux Орёл 2.12 КриптоПро 4.0.9944 госзакупки и площадки
Astra Linux
Еще 
Орёл 2.12 wiki
astralinux доступ к госзакупкам
Работа с КриптоПро CSP
Инструкция по настройке и работе с Крипто-Про для государственных порталов
Установка и настройка КриптоПро CSP в Porteus Linux
Вход с помощью электронной подписи на портал Госуслуг на Linux.


$ sudo apt update
$ sudo apt upgrade
#$ sudo apt install samba ssh
#$ sudo systemctl  enable ssh
#$ sudo systemctl  start ssh

Два варианта либо ставим xrdp

$ sudo apt install xrdp


$ cat /etc/astra_version
CE 2.12.13 (orel)

Загружаем  КриптоПро 4.0.9963

Устанавливаем КриптоПро 4.0.9963
$ tar -zxf linux-amd64_deb.tgz
$ cd linux-amd64_deb
$ sudo ./install_gui.sh

Ставим все галки, лицензию позднее.

Ставим лицензию на Крипто-Про при наличии
$ sudo /opt/cprocsp/sbin/amd64/cpconfig -license -set *****-*****-*****-*****-*****

Если при установке не ввели лицензию, установится demo лицензия
$ /opt/cprocsp/sbin/amd64/cpconfig -license -view
License validity:
4040E-G0037-EK8R3-C6K4U-*****
Expires: 3 month(s) 2 day(s)
License type: Server.


Проверяем версию:
$ /opt/cprocsp/bin/amd64/csptest -keyset -verifycontext
CSP (Type:80) v4.0.9019 KC2 Release Ver:4.0.9963 OS:Linux CPU:AMD64 FastCode:READY:AVX.
AcquireContext: OK. HCRYPTPROV: 9196739
GetProvParam(PP_NAME): Crypto-Pro GOST R 34.10-2012 KC2 CSP
Total: SYS: 0,000 sec USR: 0,000 sec UTC: 0,020 sec
[ErrorCode: 0x00000000]


$ sudo  /opt/cprocsp/bin/amd64/csptestf -tlsc -server zakupki.gov.ru -nosave
HSECPKG_ATTR_PACKAGE_INFO not supported.
DContext expired: OK if file is completely downloaded
Reply status: HTTP/1.1 200 OK
1 connections, 588 bytes in 0.621 seconds;
Total: SYS: 0,060 sec USR: 0,090 sec UTC: 0,680 sec
[ErrorCode: 0x00000000]
==================================================================================
$ export PATH="$(/bin/ls -d /opt/cprocsp/{s,}bin/*|tr '\n' ':')$PATH"


$ sudo apt install alien
$ cd ~/
Скачать плагин  в ~/Загрузки/ (автоматическая загрузка версии плагина, соответствующей Вашей ОС)

$ cp ~/Загрузки/cades_linux_amd64.tar.gz ~/

$ tar -zxf cades_linux_amd64.tar.gz
$ cd ~/cades_linux_amd64

Установить плагин:
$ sudo alien -dc cprocsp-pki-2.0.0-amd64-cades.rpm
$ sudo alien -dc cprocsp-pki-2.0.0-amd64-plugin.rpm
$ sudo dpkg -i cprocsp-pki-cades_2.0.0-2_amd64.deb cprocsp-pki-plugin_2.0.0-2_amd64.deb


Сертификаты которые ставит Crypto-Pro:

$ sudo /opt/cprocsp/bin/amd64/certmgr -list -store mRoot
Certmgr 1.1 (c) "Crypto-Pro",  2007-2018.
program for managing certificates, CRLs and stores


Установка личного сертификата
$ mkdir -p /var/opt/cprocsp/keys/user
 Копируем контейнер в
$ cd /var/opt/cprocsp/keys/user

$ /opt/cprocsp/bin/amd64/csptest -keyset -enum -verifycontext -fqcn
$ /opt/cprocsp/bin/amd64/csptest -keyset -enum -verifycontext -fqcn
CSP (Type:80) v4.0.9019 KC2 Release Ver:4.0.9963 OS:Linux CPU:AMD64 FastCode:READY:AVX.
AcquireContext: OK. HCRYPTPROV: 24774691
\\.\HDIMAGE\▒▒▒ ▒▒▒▒ ▒▒▒▒_16_05_2019_13_31 - Copy
OK.
Total: SYS: 0,000 sec USR: 0,010 sec UTC: 0,270 sec
[ErrorCode: 0x00000000]
Получим уникальное имя для манипуляций с контейнером:
$ /opt/cprocsp/bin/amd64/csptest -keys -enum -verifyc -fqcn -unique
CSP (Type:80) v4.0.9019 KC2 Release Ver:4.0.9963 OS:Linux CPU:AMD64 FastCode:READY:AVX.
AcquireContext: OK. HCRYPTPROV: 37054499
\\.\HDIMAGE\▒▒▒ ▒▒▒▒ ▒▒▒▒_16_05_2019_13_31 - Copy|\\.\HDIMAGE\HDIMAGE\\eeegsvhs.000\BFFC
OK.
Total: SYS: 0,000 sec USR: 0,000 sec UTC: 0,110 sec
[ErrorCode: 0x00000000]
Установить скопированный контейнер:

$ /opt/cprocsp/bin/amd64/certmgr -inst -store uMy -cont '\\.\HDIMAGE\HDIMAGE\\eeegsvhs.000\BFFC'
Установим сертификат:
$ /opt/cprocsp/bin/amd64/certmgr -inst -store uMy -file 7658319.cer  -cont '\\.\HDIMAGE\HDIMAGE\\eeegsvhs.000\BFFC'
Проверим:
$ /opt/cprocsp/bin/amd64/csptest -keyset -check -cont '\\.\HDIMAGE\HDIMAGE\\eeegsvhs.000\BFFC'
Просмотор личных сертификатов:

$ /opt/cprocsp/bin/amd64/certmgr -list -store uMy

Установить расширение firefox на страничке с проверкой плагина:

Настройка firefox на установку дополнений

Установил сертификат как в

Импорт сертификата вручную (для старых версий, проверено на Firefox 56.0.2)



Проверка плагина

Дожаться сообщения:



Проверить подпись.


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++В принципе установивки контейнера с личным сертификтом может быть достаточно.
Проверить можно:
Проверка цепочек
$ /opt/cprocsp/bin/amd64/certmgr -list -store uMy
Смотрим: 
 E=mail@vt70.com

Проверка по e-mail
$ /opt/cprocsp/bin/amd64/cryptcp -copycert -dn  mail@vt70.com -df ~/t.cer
CryptCP 4.0 (c) "КРИПТО-ПРО", 2002-2018.
Утилита командной строки для подписи и шифрования файлов.

Будет использован следующий сертификат:
Субъект: ......
........
Действителен с 17.05.2019 13:07:32 по 17.05.2020 13:07:32

Цепочки сертификатов проверены.
Копирование сертификатов завершено.
[ErrorCode: 0x00000000]

  Для работы будем пользоваться chromium : 
$ sudo apt install chromium

Для работы с сайтом госуслуг используем инструкцию ниже:
Вход с помощью электронной подписи на портал Госуслуг на Linux.

Плагин IFCPlugin-3.0.0-x86_64.deb.zip работать перестал!!!

Скачаем и установим плагин
Плагин качаем при входе в личный кабинет госуслуг по ЭЦП.
Прямая ссылка
Plugin для работы с электронной подписью
прямая ссылка в данный момент версия 3.0.6.0

Установим плагин:
$ cd ~/Загрузки/
$ sudo dpkg -i IFCPlugin-x86_64.deb$ sudo apt install -f

Также установим расширение chrom для сайта госуслуг.
Установить Расширение для gosuslugi.ru  в браузере chromium
Перейти в меню - Дополнительные инструменты - Расширения и включить плагин

Загрузить файл конфигурации для IFCPlugin ( x64) в домашнюю директорию текущего пользователя.
$ cd ~/Загрузки/
$ wget https://www.cryptopro.ru/sites/default/files/public/faq/ifcx64.cfg
$ sudo rm /etc/ifc.cfg
$ sudo cp ~/Загрузки/ifcx64.cfg /etc/ifc.cfg
$ /opt/cprocsp/bin/amd64/csptestf -absorb -certs -autoprov
$  /opt/cprocsp/bin/amd64/csptestf -absorb -certs -autoprov
Match: HDIMAGE\\eeegsvhs.000\BFFC
OK.
Total: SYS: 0,000 sec USR: 0,010 sec UTC: 0,330 sec
[ErrorCode: 0x00000000]

создаем симлинк для корректной работы связи расширения браузера с библиотекой установленного плагина
$ sudo cp /etc/opt/chrome/native-messaging-hosts/ru.rtlabs.ifcplugin.json /etc/chromium/native-messaging-hosts


Войти на госуслуги с помощью сертификата

Вход на госуслуги

Выйти.

После этого успешно заходим на сайт госзакупок браузером chromium

zakupki.gov.ru

После этого можно заходить на основные торговые площадки.
 

Проверено подписывает:
rts-tender.ru

Проверено подписывает:
Единая электронная торговая площадка


Проверно подписывает:
Сбербанк-АСТ


Электронная площадка  Березка с авторизацией на госуслугах

пятница, 24 мая 2019 г.

pg_probackup-10 checkdb --amcheck

petergeoghegan/amcheck
F.2. amcheck

$ sudo apt install postgresql-10-amcheck


Для каждой базы:
postgres=# CREATE EXTENSION amcheck;
или
postgres=# CREATE EXTENSION amcheck_next;

Grigory Smolkin: для PG =<10 рекомендую ( Grigory Smolkin) использовать  amcheck_next

Для каждой базы, например demo:

$ sudo -u postgres psql -d postgres -c "CREATE EXTENSION amcheck_next" 
$ sudo -u postgres psql -d demo -c "CREATE EXTENSION amcheck_next"

$ sudo -u postgres pg_probackup-10 checkdb -B /backupwal --instance main --amcheck

INFO: Start checking data files
INFO: Data files are valid
INFO: Start amchecking PostgreSQL instance
INFO: Amchecking database 'postgres' using extension 'amcheck_next' version 2 from schema 'public'
INFO: Amchecking database 'demo' using extension 'amcheck_next' version 2 from schema 'public'
INFO: Checkdb --amcheck executed successfully
INFO: Indexes are valid


опция --heapallindexed, с ней amcheck проверяет, что хип, который должен быть проиндексирован, действительно проиндексирован

$ sudo -u postgres pg_probackup-10 checkdb -B /backupwal --instance main --amcheck --heapallindexed

INFO: Start checking data files
INFO: Data files are valid
INFO: Start amchecking PostgreSQL instance
INFO: Amchecking database 'postgres' using extension 'amcheck_next' version 2 from schema 'public'
INFO: Amchecking database 'demo' using extension 'amcheck_next' version 2 from schema 'public'
INFO: Checkdb --amcheck executed successfully
INFO: Indexes are valid

---------------------------------------------------
'ERROR: Checkdb --amcheck failed'


Пример:

[gsmol@deck pg_probackup]$ /home/gsmol/git/postgres/contrib/pg_probackup/pg_probackup checkdb --amcheck --skip-block-validation --log-level-console=log -d postgres -p 27313       
LOG: This PostgreSQL instance was initialized with data block checksums. Data block corruption will be detected
INFO: Start amchecking PostgreSQL instance
WARNING: Extension 'amcheck' or 'amcheck_next' are not installed in database postgres
INFO: Amchecking database 'db1' using extension 'amcheck' version 1.0 from schema 'public'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_2604_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_2606_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_2609_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_1255_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_2618_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_3596_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_2619_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_3381_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_2620_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_2396_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_2964_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_3592_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_aggregate_fnoid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_am_name_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_am_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_amop_fam_strat_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_amop_opr_fam_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_amop_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_amproc_fam_proc_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_amproc_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_attrdef_adrelid_adnum_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_attrdef_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_attribute_relid_attnam_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_attribute_relid_attnum_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_authid_rolname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_authid_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_auth_members_role_member_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_auth_members_member_role_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_cast_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_cast_source_target_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_class_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_class_relname_nsp_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_class_tblspc_relfilenode_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_collation_name_enc_nsp_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_collation_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_constraint_conname_nsp_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_constraint_conrelid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_constraint_contypid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_constraint_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_conversion_default_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_conversion_name_nsp_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_conversion_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_database_datname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_database_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_depend_depender_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_depend_reference_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_description_o_c_o_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_shdescription_o_c_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_enum_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_enum_typid_label_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_enum_typid_sortorder_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_index_indrelid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_index_indexrelid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_inherits_relid_seqno_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_inherits_parent_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_init_privs_o_c_o_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_language_name_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_language_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_largeobject_loid_pn_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_largeobject_metadata_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_statistic_ext_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_statistic_ext_name_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_statistic_ext_relid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_namespace_nspname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_namespace_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_opclass_am_name_nsp_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_opclass_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_operator_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_operator_oprname_l_r_n_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_opfamily_am_name_nsp_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_opfamily_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_pltemplate_name_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_proc_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_proc_proname_args_nsp_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_rewrite_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_rewrite_rel_rulename_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_sequence_seqrelid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_shdepend_depender_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_shdepend_reference_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_statistic_relid_att_inh_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_tablespace_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_tablespace_spcname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_transform_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_transform_type_lang_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_trigger_tgconstraint_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_trigger_tgrelid_tgname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_trigger_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_event_trigger_evtname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_event_trigger_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_config_cfgname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_config_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_config_map_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_dict_dictname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_dict_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_parser_prsname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_parser_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_template_tmplname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_template_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_type_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_type_typname_nsp_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_foreign_data_wrapper_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_foreign_data_wrapper_name_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_foreign_server_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_foreign_server_name_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_user_mapping_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_user_mapping_user_server_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_foreign_table_relid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_default_acl_role_nsp_obj_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_default_acl_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_db_role_setting_databaseid_rol_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_seclabel_object_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_shseclabel_object_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_extension_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_extension_name_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_range_rngtypid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_policy_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_policy_polrelid_polname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_replication_origin_roiident_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_replication_origin_roname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_partitioned_table_partrelid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_publication_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_publication_pubname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_publication_rel_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_publication_rel_prrelid_prpubid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_subscription_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_subscription_subname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_subscription_rel_srrelid_srsubid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pgbench_branches_pkey'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pgbench_tellers_pkey'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_13083_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_13088_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_13093_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_13098_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_13103_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_13108_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_13113_index'
WARNING:  page verification failed, calculated checksum 13234 but expected 62739
WARNING: Thread [1]. Amcheck failed for index: 'public.pgbench_accounts_pkey': ERROR:  invalid page in block 5 of relation base/16384/16409

INFO: Amchecking database 'db2' using extension 'amcheck' version 1.0 from schema 'public'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_2604_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_2606_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_2609_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_1255_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_2618_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_3596_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_2619_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_3381_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_2620_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_2396_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_2964_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_3592_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_aggregate_fnoid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_am_name_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_am_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_amop_fam_strat_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_amop_opr_fam_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_amop_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_amproc_fam_proc_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_amproc_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_attrdef_adrelid_adnum_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_attrdef_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_attribute_relid_attnam_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_attribute_relid_attnum_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_authid_rolname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_authid_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_auth_members_role_member_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_auth_members_member_role_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_cast_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_cast_source_target_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_class_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_class_relname_nsp_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_class_tblspc_relfilenode_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_collation_name_enc_nsp_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_collation_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_constraint_conname_nsp_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_constraint_conrelid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_constraint_contypid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_constraint_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_conversion_default_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_conversion_name_nsp_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_conversion_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_database_datname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_database_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_depend_depender_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_depend_reference_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_description_o_c_o_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_shdescription_o_c_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_enum_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_enum_typid_label_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_enum_typid_sortorder_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_index_indrelid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_index_indexrelid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_inherits_relid_seqno_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_inherits_parent_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_init_privs_o_c_o_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_language_name_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_language_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_largeobject_loid_pn_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_largeobject_metadata_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_statistic_ext_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_statistic_ext_name_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_statistic_ext_relid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_namespace_nspname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_namespace_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_opclass_am_name_nsp_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_opclass_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_operator_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_operator_oprname_l_r_n_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_opfamily_am_name_nsp_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_opfamily_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_pltemplate_name_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_proc_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_proc_proname_args_nsp_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_rewrite_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_rewrite_rel_rulename_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_sequence_seqrelid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_shdepend_depender_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_shdepend_reference_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_statistic_relid_att_inh_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_tablespace_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_tablespace_spcname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_transform_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_transform_type_lang_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_trigger_tgconstraint_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_trigger_tgrelid_tgname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_trigger_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_event_trigger_evtname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_event_trigger_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_config_cfgname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_config_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_config_map_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_dict_dictname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_dict_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_parser_prsname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_parser_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_template_tmplname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_template_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_type_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_type_typname_nsp_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_foreign_data_wrapper_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_foreign_data_wrapper_name_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_foreign_server_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_foreign_server_name_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_user_mapping_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_user_mapping_user_server_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_foreign_table_relid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_default_acl_role_nsp_obj_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_default_acl_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_db_role_setting_databaseid_rol_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_seclabel_object_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_shseclabel_object_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_extension_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_extension_name_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_range_rngtypid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_policy_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_policy_polrelid_polname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_replication_origin_roiident_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_replication_origin_roname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_partitioned_table_partrelid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_publication_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_publication_pubname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_publication_rel_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_publication_rel_prrelid_prpubid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_subscription_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_subscription_subname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_subscription_rel_srrelid_srsubid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pgbench_branches_pkey'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pgbench_tellers_pkey'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_13083_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_13088_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_13093_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_13098_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_13103_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_13108_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_13113_index'
WARNING:  page verification failed, calculated checksum 59098 but expected 12348
WARNING: Thread [1]. Amcheck failed for index: 'public.some_index': ERROR:  invalid page in block 5 of relation base/16388/16428

ERROR: Checkdb --amcheck failed
 
=====================================================================
$ sudo su postgres
$ psql -d demo
# 
SELECT bt_index_check(c.oid), c.relname, c.relpages
FROM pg_index i
JOIN pg_opclass op ON i.indclass[0] = op.oid
JOIN pg_am am ON op.opcmethod = am.oid
JOIN pg_class c ON i.indexrelid = c.oid
JOIN pg_namespace n ON c.relnamespace = n.oid
WHERE am.amname = 'btree' AND n.nspname = 'pg_catalog'
-- Не проверять временные таблицы (они могут относиться к другим сеансам):
AND c.relpersistence != 't'
-- Функция может выдать ошибку без этих условий:
AND i.indisready AND i.indisvalid
ORDER BY c.relpages DESC LIMIT 10;"$ sudo su postgres 
$ psql -d demo# SELECT bt_index_check(c.oid), c.relname, c.relpages
FROM pg_index i
JOIN pg_opclass op ON i.indclass[0] = op.oid
JOIN pg_am am ON op.opcmethod = am.oid
JOIN pg_class c ON i.indexrelid = c.oid
JOIN pg_namespace n ON c.relnamespace = n.oid
WHERE am.amname = 'btree' AND n.nspname = 'pg_catalog'
-- Не проверять временные таблицы (они могут относиться к другим сеансам):
AND c.relpersistence != 't'
-- Функция может выдать ошибку без этих условий:
AND i.indisready AND i.indisvalid
ORDER BY c.relpages DESC LIMIT 10;
 
или
 
$ sudo -u postgres psql -d demo -c "
SELECT bt_index_check(c.oid), c.relname, c.relpages
FROM pg_index i
JOIN pg_opclass op ON i.indclass[0] = op.oid
JOIN pg_am am ON op.opcmethod = am.oid
JOIN pg_class c ON i.indexrelid = c.oid
JOIN pg_namespace n ON c.relnamespace = n.oid
WHERE am.amname = 'btree' AND n.nspname = 'pg_catalog'
-- Не проверять временные таблицы (они могут относиться к другим сеансам):
AND c.relpersistence != 't'
-- Функция может выдать ошибку без этих условий:
AND i.indisready AND i.indisvalid
ORDER BY c.relpages DESC LIMIT 10;"
$ sudo su postgres 
$ psql -d demo
# SELECT bt_index_check(c.oid), c.relname, c.relpages
FROM pg_index i
JOIN pg_opclass op ON i.indclass[0] = op.oid
JOIN pg_am am ON op.opcmethod = am.oid
JOIN pg_class c ON i.indexrelid = c.oid
JOIN pg_namespace n ON c.relnamespace = n.oid
WHERE am.amname = 'btree' AND n.nspname = 'pg_catalog'
-- Не проверять временные таблицы (они могут относиться к другим сеансам):
AND c.relpersistence != 't'
-- Функция может выдать ошибку без этих условий:
AND i.indisready AND i.indisvalid
ORDER BY c.relpages DESC LIMIT 10;


$ reindexdb demo

$ sudo -u postgres psql -d demo -c "SELECT bt_index_check(c.oid);"
sudo -u postgres pg_probackup-10 checkdb -B /backupwal --instance main --amcheck --heapallindexed--skip-block-validation --log-level-console=log 

для консоли:
$ sudo -u postgres pg_probackup-10 checkdb -B /backupwal --instance main --amcheck --heapallindexed --skip-block-validation --log-level-console=log

для скрипта:

$ sudo -u postgres pg_probackup-10 checkdb -B /backupwal --instance main --amcheck --heapallindexed --skip-block-validation --log-level-file=log
 
 

четверг, 23 мая 2019 г.

Размещение stats_temp_directory на виртуальном диске

Размещение stats_temp_directory на виртуальном диске

Перевод.

Размещение stats_temp_directory на виртуальном диске

Этот хак является старым каштаном среди тюнеров производительности PostgreSQL, но, похоже, не так широко известен в других местах. Это позор, потому что это чистая победа, и ее нелепо легко настроить. Вам даже не нужно перезапускать PostgreSQL.
Вот ситуация: PostgreSQL записывает определенную временную статистику. Они идут в dir, заданном stats_temp_directoryнастройкой. По умолчанию это pg_stat_tmpв каталоге данных. Временные файлы много пишутся, но их не нужно сохранять.
Это делает их идеальными кандидатами на виртуальный диск (он же RAM-диск). RAM-диск - это фрагмент памяти, который ОС рассматривает как блочное устройство. Потому что это ОЗУ, это супер-быстро. Что касается приложения, виртуальный диск содержит файловую систему, которую он может читать и записывать, как и любую другую. Более того, PostgreSQL обычно требуется всего несколько сотен килобайт stats_temp_directoryлюбой современный сервер может разместить это в оперативной памяти.
В Linux вы устанавливаете виртуальный диск как этот:
Как root:
'mkdir /var/lib/pgsql_stats_tmp' [1]
'chmod 777 /var/lib/pgsql_stats_tmp'
'chmod +t /var/lib/pgsql_stats_tmp'
Добавьте эту строку в /etc/fstabЭто 2G является верхним пределом; система будет использовать столько, сколько ей нужно.
tmpfs /var/lib/pgsql_stats_tmp tmpfs size=2G,uid=postgres,gid=postgres 0 0
'mount /var/lib/pgsql_stats_tmp'
Тогда как postgres:
Измените параметр stats_temp_directory в postgresql.conf:
stats_temp_directory = '/var/lib/pgsql_stats_tmp'
Скажите PostgreSQL перечитать его конфигурацию:
'pg_ctl -D YOUR_DATA_DIR reload'
И это все!
Другие операционные системы имеют разные способы установки виртуальных дисков. Возможно, я расскажу о них в следующем посте.
[1] Каталог /var/lib/pgsql_stats_tmpявляется произвольным выбором, но он хорошо работает для разметки файловой системы Debian.

=================================================================================

Опыт на виртуальной машине:

До

Тест  pgbench

$ sudo -u postgres psql -c "CREATE DATABASE example;"
$ sudo -u postgres pgbench -i -s 500 example
$ sudo -u postgres pgbench -c 10 -j 10 -t 10000 example

2 измерения.

$ sudo -u postgres pgbench -c 10 -j 10 -t 10000 example
starting vacuum...end.
transaction type: <builtin: TPC-B (sort of)>
scaling factor: 500
query mode: simple
number of clients: 10
number of threads: 10
number of transactions per client: 10000
number of transactions actually processed: 100000/100000
latency average = 3.880 ms
tps = 2577.602763 (including connections establishing)
tps = 2578.929607 (excluding connections establishing)

$ sudo -u postgres pgbench -c 10 -j 10 -t 10000 example
starting vacuum...end.
transaction type: <builtin: TPC-B (sort of)>
scaling factor: 500
query mode: simple
number of clients: 10
number of threads: 10
number of transactions per client: 10000
number of transactions actually processed: 100000/100000
latency average = 4.640 ms
tps = 2155.091523 (including connections establishing)
tps = 2155.908282 (excluding connections establishing)

Перенос  stats_temp_directory на виртуальный диске

$ sudo mkdir /var/lib/pgsql_stats_tmp
$ sudo chmod 777 /var/lib/pgsql_stats_tmp
$ sudo chmod +t /var/lib/pgsql_stats_tmp
$ sudo nano /etc/fstab
tmpfs /var/lib/pgsql_stats_tmp tmpfs size=2G,uid=postgres,gid=postgres 0 0
Сохранить.
$ sudo mount /var/lib/pgsql_stats_tmp
$ df -h
Файл.система   Размер Использовано  Дост Использовано% Cмонтировано в
udev             7,9G            0  7,9G            0% /dev
tmpfs            1,6G         1,1M  1,6G            1% /run
/dev/sda1        985G          17G  918G            2% /
tmpfs            7,9G          52K  7,9G            1% /dev/shm
tmpfs            5,0M            0  5,0M            0% /run/lock
tmpfs            7,9G            0  7,9G            0% /sys/fs/cgroup
tmpfs            1,6G            0  1,6G            0% /run/user/999
tmpfs            1,6G            0  1,6G            0% /run/user/1000
tmpfs            2,0G            0  2,0G            0% /var/lib/pgsql_stats_tmp

 
$ sudo nano /etc/postgresql/10/main/postgresql.conf

Добавить строку:

stats_temp_directory = '/var/lib/pgsql_stats_tmp'

Сохранить. 
 
$ sudo systemctl restart postgresql.service

 
После:
user@u1604:~$ sudo -u postgres pgbench -c 10 -j 10 -t 10000 example
starting vacuum...end.
transaction type: <builtin: TPC-B (sort of)>
scaling factor: 500
query mode: simple
number of clients: 10
number of threads: 10
number of transactions per client: 10000
number of transactions actually processed: 100000/100000
latency average = 3.666 ms
tps = 2727.513649 (including connections establishing)
tps = 2728.516695 (excluding connections establishing)
 


user@u1604:~$ sudo -u postgres pgbench -c 10 -j 10 -t 10000 example
starting vacuum...end.
transaction type: <builtin: TPC-B (sort of)>
scaling factor: 500
query mode: simple
number of clients: 10
number of threads: 10
number of transactions per client: 10000
number of transactions actually processed: 100000/100000
latency average = 3.830 ms
tps = 2611.254894 (including connections establishing)
tps = 2613.189750 (excluding connections establishing)