서버측 Groovy 스크립트를 사용하여 환경 복제

재해 복구를 위해 서버측 Groovy 스크립트에 EPM Automate 명령을 포함하여 환경을 복제할 수 있습니다. 이렇게 하면 온-프레미스 풋프린트 없이 재해 복구를 설정할 수 있습니다.

비밀번호에 특수 문자가 포함된 경우 특수 문자 처리를 참조하십시오. 또한, 환경에 적합하게 다음 매개변수 값을 바꾸십시오.

Table 4-1 변경할 매개변수

매개변수 설명
password 소스 환경에서 복제 작업을 수행하는 서비스 관리자 비밀번호입니다.
targetpassword 타겟 환경에서 복제 작업을 수행하는 서비스 관리자 비밀번호입니다.
username 소스 환경에서 서비스 관리자의 사용자 ID입니다.
targetusername 타겟 환경에서 서비스 관리자의 사용자 ID입니다. 이 사용자는 타겟 환경에서 ID 도메인 관리자 역할에도 지정되어야 합니다.
email_id 복제 프로세스에 대한 정보를 보낼 전자메일 주소입니다.

비밀번호 암호화 스크립트

EpmAutomate automate = getEpmAutomate()

//Encrypt the password of a Service Administrator in the source environment
EpmAutomateStatus encryptstatus1 = automate.execute('encrypt', 'password','encryptionKey','sourcePassword.epw')
if(encryptstatus1.getStatus() != 0)  throwVetoException(encryptstatus1.getOutput())
println(encryptstatus1.getOutput())

//Encrypt the password of a Service Administrator in the target environment
//This user must also have the Identity Domain Administrator 
//role in the target environment

EpmAutomateStatus encryptstatus2= automate.execute('encrypt', 'targetpassword',
'encryptionKey', 'targetPassword.epw')
if(encryptstatus2.getStatus() != 0) throwVetoException(encryptstatus2.getOutput())
println(encryptstatus2.getOutput())

환경 복제 스크립트

이 스크립트는 이전 스크립트를 사용하여 생성된 암호화된 비밀번호 파일을 사용합니다.

EpmAutomate automate = getEpmAutomate()

//Log into the target environment
EpmAutomateStatus loginstatus = automate.execute('login', 'username','targetPassword.epw' , 'targeturl')
if(loginstatus.getStatus() != 0) throwVetoException(loginstatus.getOutput())
println(loginstatus.getOutput())

//Recreate the target environment
EpmAutomateStatus recreatestatus = automate.execute('recreate' , '-f' )
if(recreatestatus.getStatus() != 0) throwVetoException(recreatestatus.getOutput())
println(recreatestatus.getOutput())

//Copy Artifact Snapshot from the source environment 
//to the target environment
EpmAutomateStatus copystatus = automate.execute('copysnapshotfrominstance',
'Artifact Snapshot', 'sourceusername', 'sourcePassword.epw','source url')
if(copystatus.getStatus() != 0) throwVetoException(copystatus.getOutput())
println(copystatus.getOutput())

//import Artifact Snapshot into the target environment
EpmAutomateStatus importstatus = automate.execute('importsnapshot', 'Artifact Snapshot')
println(importstatus.getOutput())

//Send an email to a designated user with the status of the 
//snapshot import process
EpmAutomateStatus emailstatus = automate.execute('sendmail', 'email_id' ,'Status of DR' , 'BODY='+ importstatus.getOutput())
println(emailstatus.getOutput())

//Sign out of the target environment
EpmAutomateStatus logoutstatus = automate.execute('logout')
println(logoutstatus.getOutput())