백업 및 복원 명령
기능 소개
Bahmni 시스템에는 환자 문서, 환자 이미지, DB 데이터 등 다양한 산출물이 있습니다. 하드 드라이브 고장이나 사용자가 잘못된 SQL(예: delete SQL)을 실수로 실행해 데이터가 손실되는 등의 예기치 않은 사건이 발생할 수 있습니다. Bahmni는 모든 산출물을 백업하는 메커니즘을 제공해야 하며, 문제가 발생하면 백업에서 복구해 병원 업무를 가능한 한 빨리 정상화할 수 있어야 합니다.
현재 Bahmni 백업 메커니즘은 파일 백업과 데이터베이스 백업의 두 범주를 지원합니다. 지원 항목은 다음과 같습니다.
- 환자 이미지 문서 이미지 업로드된 파일 업로드된 검사실 결과 PACS 이미지 Queue 기능으로 Report 모듈이 생성한 파일 MySQL 데이터베이스 Postgres 데이터베이스
기존 백업 및 복원 방식
기존 백업 방식
MySQL 및 Postgres 백업 도구가 설치되어 있지 않으면 다음 명령을 사용하는 기존 방식으로 대체됩니다. 다음 명령은 이전 데이터베이스 백업 방식과 동일한 결과를 냅니다.
inventory_file_name을 알맞은 파일 이름으로 바꾸십시오. 아래 예시에서는 local이 inventory 파일 이름입니다.
bahmni -i local backup --backup_type=db --options=clinlimsbahmni -i local backup --backup_type=db --options=openerpbahmni -i local backup --backup_type=db --options=openmrsIf backrest tools are already installed, then uninstall them to perform oldway backup.
To uninstall pgsql backup tool, execute the following commands
sudo rm -f /usr/bin/pgbackrest
sudo rm -f /usr/bin/pg_backrest
sudo rm -rf /usr/lib/perl5/BackRest
sudo rm -rf /usr/share/perl5/BackRest
sudo rm -rf /usr/lib/perl5/pgBackRest
sudo rm -rf /usr/share/perl5/pgBackRest
To uninstall mysql backup tool, execute the following command
yum list installed | grep xtrabackup|xargs yum remove -y기존 복원 방식
inventory_file_name을 알맞은 파일 이름으로 바꾸십시오. 아래 예시에서는 local이 inventory 파일 이름입니다.
bahmni -i local restore --restore_type=db --options=clinlims --strategy=dump --restore_point=clinlims_dump_20170215-150418.sql.gzbahmni -i local restore --restore_type=db --options=openerp --strategy=dump --restore_point=openerp_dump_20170215-150418.sql.gzbahmni -i local restore --restore_type=db --options=openmrs --strategy=dump --restore_point=openmrs_dump_20170221084218.sql.gz완전/전체 백업
가능한 모든 파일과 데이터베이스를 백업하려면 아래 명령을 사용하십시오.
bahmni -i <inventory_file_name> backup --backup_type=all --options=allinventory_file_name을 알맞은 파일 이름으로 바꾸십시오. 아래 예시에서는 local이 inventory 파일 이름입니다.
bahmni -i local backup --backup_type=all --options=all백업 예약:
백업을 예약하려면 명령줄의 --schedule 옵션을 사용할 수 있습니다. 이 옵션은 사용자의 cron 항목을 추가하여 일정에 따라 명령을 실행합니다.
bahmni -i <inventory_file_name> backup --backup_type=<file/db> --options=<options_possible> --strategy=<strategy> --schedule "* * * * *"bahmni -i local backup --backup_type=db --options=openmrs --strategy=full --schedule "30 2 * * 0"
# Use the hash sign to prefix a comment
# +---------------- minute (0 - 59)
# | +------------- hour (0 - 23)
# | | +---------- day of month (1 - 31)
# | | | +------- month (1 - 12)
# | | | | +---- day of week (0 - 7) (Sunday=0 or 7)
# | | | | |
# * * * * * command to be executedMySQL 백업:
MySQL 데이터베이스 백업 명령에는 다음과 같은 구성 항목이 있습니다.
| Key | Default value | Available options | Mandatory |
|---|---|---|---|
| backup_type | all | This value should be db for database backup | No |
| options | all | This Value can be either openmrs or bahmni-reports while taking mysql database backup. | No |
| strategy | full | Possible values are full, incr. | No |
MySQL 전체 백업
데이터베이스 이름을 지정해 특정 MySQL 데이터베이스의 전체 백업을 만들 수 있습니다.
bahmni -i <inventory_file_name> backup --backup_type=db --options=<DBName>inventory_file_name을 알맞은 파일 이름으로, DBName을 데이터베이스 이름으로 바꾸십시오. 아래 예시에서는 local이 inventory 파일 이름입니다.
bahmni -i local backup --backup_type=db --options=openmrsbahmni -i local backup --backup_type=db --options=bahmni_reportsMySQL 증분 백업:
전체 백업 외에 증분 백업도 만들 수 있습니다. 증분 백업에서는 strategy를 "incr"로 지정해야 합니다.
bahmni -i <inventory_file_name> backup --backup_type=db --options=<DBName> --strategy=incrinventory_file_name을 알맞은 파일 이름으로, DBName을 데이터베이스 이름으로 바꾸십시오. 아래 예시에서는 local이 inventory 파일 이름입니다.
bahmni -i local backup --backup_type=db --options=openmrs --strategy=incrbahmni -i local backup --backup_type=db --options=bahmni_reports --strategy=incrMySQL 데이터베이스 복원:
선택한 복원 지점이나 파일이 구성된 복원 경로에 있다면 데이터베이스를 전체 또는 증분 복원 지점으로 복원할 수 있습니다.
bahmni -i <inventory_file_name> restore --restore_type=db --options=<DBName> --strategy=<dump/pitr> --restore_point=<Backup foldername>inventory_file_name을 알맞은 파일 이름으로, DBName을 데이터베이스 이름(openmrs 또는 bahmni_reports)으로 바꾸십시오. 아래 예시에서는 local이 inventory 파일 이름입니다.
MySQL 데이터베이스 복원 명령에는 다음과 같은 구성 항목이 있습니다. 아래 구성에는 기본값이 없습니다.
| Key | Description | Mandatory |
|---|---|---|
| restore_type | Value should be "db" (in case of database restore) | Yes |
| options | Available options for mysql database restore are "openmrs" or "bahmni_reports" | Yes |
| strategy | Strategy | Description |
| pitr | If the restore point value is the folder name of the backup. | |
| dump | If the restore point value is database entire dump gunzip file. |
- 값은 백업 파일의 폴더 이름이어야 합니다(증분 또는 전체). strategy가 dump이면 dump 파일 이름이어야 합니다.
MySQL 덤프 복원
dump gunzip 파일을 지정해 데이터베이스를 복원할 수 있습니다.
bahmni -i local restore --restore_type=db --options=openmrs --strategy=dump --restore_point=openmrs_dump_20170221084218.sql.gzMySQL 전체 복원
전체 백업 파일을 지정해 데이터베이스를 복원할 수 있습니다.
bahmni -i local restore --restore_type=db --options=openmrs --strategy=pitr --restore_point=20170220103125_fullbahmni -i local restore --restore_type=db --options=bahmni_reports --strategy=pitr --restore_point=20170220103125_fullMySQL 증분 복원
증분 백업 파일을 지정해 데이터베이스를 복원할 수 있습니다.
bahmni -i local restore --restore_type=db --options=openmrs --strategy=pitr --restore_point=20170330103125_incrbahmni -i local restore --restore_type=db --options=bahmni_reports --strategy=pitr --restore_point=20170330103125_incrPostgreSQL 데이터베이스 백업:
PostgreSQL 데이터베이스 백업 명령에는 다음과 같은 구성 항목이 있습니다.
| Key | Default value | Available options | Mandatory |
|---|---|---|---|
| backup_type | all | This value should be db for database backup | No |
| options | all | This Value can be either postgres while taking pgsql database backup. | No |
| strategy | full | Possible values are full, incr. | No |
Postgres 전체 백업
options에 postgres 데이터베이스 이름을 지정하여 전체 백업을 만들 수 있습니다.
bahmni -i <inventory_file_name> backup --backup_type=db --options=<DBName>inventory_file_name을 알맞은 파일 이름으로, DBName을 데이터베이스 이름(postgres)으로 바꾸십시오. 아래 예시에서는 local이 inventory 파일 이름입니다.
bahmni -i local backup --backup_type=db --options=postgresPostgres 증분 백업:
전체 백업 외에 증분 백업도 만들 수 있습니다. 증분 백업에서는 strategy를 "incr"로 지정해야 합니다.
bahmni -i <inventory_file_name> backup --backup_type=db --options=<DBName> --strategy=incrinventory_file_name을 알맞은 파일 이름으로, DBName을 데이터베이스 이름으로 바꾸십시오. 아래 예시에서는 local이 inventory 파일 이름입니다.
bahmni -i local backup --backup_type=db --options=postgres --strategy=incrPostgreSQL 데이터베이스 복원:
PostgreSQL 백업 전체를 한 번에 복원할 수 있습니다. 빈 Postgres 데이터베이스를 복원할 때는 먼저 전체 백업으로 DB를 복원한 다음 원하는 증분 백업을 적용해야 합니다.
bahmni -i <inventory_file_name> restore --restore_type=db --options=postgres --strategy=<pitr/dump> --restore_point=<DB backup folder name>PostgreSQL 데이터베이스 복원 명령에는 다음과 같은 구성 항목이 있습니다. 아래 구성에는 기본값이 없습니다.
| Key | Description | Mandatory |
|---|---|---|
| restore_type | Value should be "db" (in case of database restore) | Yes |
| options | value in case of pitr startegy is "postgres".value in case of dump strategy is "clinlims" or "openerp". | Yes |
| strategy | Strategy | Description |
| pitr | If the restore point value is the folder name of the backup. | |
| dump | If the restore point value is database entire dump gunzip file. |
- 값은 백업 파일의 폴더 이름이어야 합니다(증분 또는 전체). strategy가 dump이면 dump 파일 이름이어야 합니다.
Postgres 덤프 복원
inventory_file_name을 알맞은 파일 이름으로 바꾸십시오. 아래 예시에서는 local이 inventory 파일 이름입니다.
OpenERP 덤프 복원
dump gunzip 파일을 지정해 데이터베이스를 복원할 수 있습니다.
bahmni -i local restore --restore_type=db --options=openerp --strategy=dump --restore_point=openerp_dump_20170221084218.sql.gzOpenELIS 덤프 복원
bahmni -i local restore --restore_type=db --options=openerp --strategy=dump --restore_point=openerp_dump_20170221084218.sql.gzPostgres 전체 복원
전체 백업 파일을 지정해 데이터베이스를 복원할 수 있습니다.
bahmni -i local restore --restore_type=db --options=postgres --strategy=pitr --restore_point=20170221-120904FPostgres 증분 복원
증분 백업 파일을 지정해 데이터베이스를 복원할 수 있습니다.
bahmni -i local restore --restore_type=db --options=postgres --strategy=pitr --restore_point= 20170221-121423F_20170222-124131I아티팩트 백업
모든 아티팩트 또는 개별 아티팩트를 백업할 수 있습니다. 사용할 수 있는 구성은 다음과 같습니다.
| Key | Description | Mandatory |
|---|---|---|
| backup_type | This Value should be "file" incase of artifact backup | yes |
| options | Value | Description |
| all | backup all artifacts | |
| patient_images | backup patient images only | |
| document_images | backup document images only | |
| uploaded-files | backup uploaded files only | |
| uploaded_results | backup uploaded results only | |
| reports | backup reports only | |
| pacs_images | backup pacs images only |
아티팩트 전체 백업
local을 알맞은 inventory 파일 이름으로 바꾸십시오. 아래 예시에서는 local이 inventory 파일 이름입니다.
bahmni -i local backup --backup_type=file --options=all아티팩트 개별/선택 백업
inventory_file_name을 알맞은 파일 이름으로, artifact_name을 해당 값으로 바꾸십시오.
bahmni -i <inventory_file_name> backup --backup_type=file --options=<artifact_name>bahmni -i local backup --backup_type=file --options="patient_images" //for patient images
bahmni -i local backup --backup_type=file --options="document_images" //for document images
bahmni -i local backup --backup_type=file --options="uploaded-files" //for uploaded files
bahmni -i local backup --backup_type=file --options="uploaded_results" //for uploaded results
bahmni -i local backup --backup_type=file --options="reports" //for reports
bahmni -i local backup --backup_type=file --options="pacs_images" //for pacs images아티팩트 복원
모든 아티팩트 또는 개별 아티팩트를 복원할 수 있습니다. 사용할 수 있는 구성은 다음과 같습니다.
| Key | Description | Mandatory |
|---|---|---|
| restore_type | This Value should be "file" incase of artifact restore | yes |
| options | Value | Description |
| all | restore all artifacts | |
| patient_images | restore patient images only | |
| document_images | restore document images only | |
| uploaded-files | restore uploaded files only | |
| uploaded_results | restore uploaded results only | |
| reports | restore reports only | |
| pacs_images | restore pacs images only |
아티팩트 전체 복원
local을 알맞은 inventory 파일 이름으로 바꾸십시오. 아래 예시에서는 local이 inventory 파일 이름입니다.
bahmni -i local restore --restore_type=file --options=all아티팩트 개별/선택 복원
inventory_file_name을 알맞은 파일 이름으로, artifact_name을 해당 값으로 바꾸십시오.
bahmni -i <inventory_file_name> restore --restore_type=file --options=<artifact_name>bahmni -i local restore --restore_type=file --options="patient_images" //for patient images
bahmni -i local restore --restore_type=file --options="document_images" //for document images
bahmni -i local backup --restore_type=file --options="uploaded-files" //for uploaded files
bahmni -i local restore --restore_type=file --options="uploaded_results" //for uploaded results
bahmni -i local restore --restore_type=file --options="reports" //for reports
bahmni -i local restore --restore_type=file --options="pacs_images" //for pacs imagesBahmni Wiki · CC BY-SA 4.0