배치작업의 시작

1. Kubernetes 환경일 경우 - yaml을 이용하여 배치작업 실행

Kubernetes에서의 yaml 파일을 이용한 Job 실행은 고객사의 프로젝트 환경에 따라 실행 할 수 있는 yaml을 서버에서 생성하여 관리할 필요가 있다.

다음은 yaml 파일의 실행 예제이다.

  • 배치 yaml 파일 예

			kind: Job
			apiVersion: batch/v1
			metadata:
			  name: sample-init-20231113
			  namespace: bxcm300
			spec:
			  template:
			    metadata:
			      labels:
			        app: sample-init-20231113
			    spec:
			      containers:
			      - name: bxcm-sample-batch
			        image: bxcm-sample-batch:latest
			        imagePullPolicy: IfNotPresent
			        env:
			        - name: BATCH_LOG_PATH
			          value: "/bxframework-batch-file"
			        command: [java, -jar, app.jar, sample-init, "test=0001", "deptNo=10"]
			      restartPolicy: Never
			  backoffLimit: 0
  • yaml 파일 실행 예

            # 배치 - Kubernetes Job 실행
            $ kubectl apply -f batch-sample-job.yaml
            job.batch/sample-init-20231113 created

            # 배치 - Kubernetes Job 실행 결과 확인
            $ kubectl get po | grep sample-init
            sample-init-20231113-plv9x                     0/1     Completed   0               30s

            # 배치 - Kubernetes Job 실행 로그 확인
            $ kubectl logs -f sample-init-20231113-plv9x
            08:08:10.428 [main] INFO bxmc.batch.util.BatchSystemUtils - Batch job id : [sample-init]
            08:08:10.632 [main] INFO bxmc.batch.BxmCloudBatchApplication - # Input Arguments : [sample-init, test=0001]
            08:08:10.662 [main] INFO bxmc.batch.BxmCloudBatchApplication - bootstrap config name : [bxframework-batch]
            08:08:11.034 [main] DEBUG io.fabric8.kubernetes.client.Config - Trying to configure client from Kubernetes config...
            08:08:11.034 [main] DEBUG io.fabric8.kubernetes.client.Config - Did not find Kubernetes config at: [/root/.kube/config]. Ignoring.
            08:08:11.034 [main] DEBUG io.fabric8.kubernetes.client.Config - Trying to configure client from service account...
            08:08:11.034 [main] DEBUG io.fabric8.kubernetes.client.Config - Found service account host and port: 10.43.0.1:443
            08:08:11.040 [main] DEBUG io.fabric8.kubernetes.client.Config - Found service account ca cert at: [/var/run/secrets/kubernetes.io/serviceaccount/ca.crt}].
            08:08:11.045 [main] DEBUG io.fabric8.kubernetes.client.Config - Found service account token at: [/var/run/secrets/kubernetes.io/serviceaccount/token].
            08:08:11.045 [main] DEBUG io.fabric8.kubernetes.client.Config - Trying to configure client namespace from Kubernetes service account namespace path...
            08:08:11.046 [main] DEBUG io.fabric8.kubernetes.client.Config - Found service account namespace at: [/var/run/secrets/kubernetes.io/serviceaccount/namespace].
            08:08:12.533 [main] INFO bxmc.common.util.KubernetesUtils - KUBERNETES_SERVICE_HOST connect : [true], elapsed time : [1849]
            08:08:12.533 [main] DEBUG bxmc.common.util.KubernetesUtils - set namespace : bxcm300
            2023-12-01 08:08:14.143 DEBUG [bxcm-sample-batch,,] 1 --- [           main] gerReplayToApplicationContextInitializer : [] class bxmc.config.boot.LoggerReplayToApplicationContextInitializer.initialize.
            2023-12-01 08:08:14.145 DEBUG [bxcm-sample-batch,,] 1 --- [           main] b.c.boot.BxmEnvironmentPostProcessor     : [] spring.cloud.bootstrap.name: bxframework-batch
            2023-12-01 08:08:14.948  INFO [bxcm-sample-batch,,] 1 --- [           main] o.s.c.k.f.config.Fabric8ConfigUtils      : [] config-map with name : 'bxcm-sample-batch-kubernetes' not present in namespace : 'bxcm300'
            2023-12-01 08:08:14.950  INFO [bxcm-sample-batch,,] 1 --- [           main] b.c.PropertySourceBootstrapConfiguration : [] Located property source: [BootstrapPropertySource {n
            ...

2. 온디맨드 배치작업 실행

  • 온라인에서 API를 호출하여 실행

기본적으로 온디맨드 배치작업 실행은 Job Scheduler와 연동하여 배치를 실행하는 것으로 권장하며, Job Scheduler에서 제공하는 API를 이용하여 호출 할 수 있도록 한다.

3. 데몬 배치 실행

데몬배치는 데몬배치 기동 시 배치 데몬 관리에 정의된 데몬배치에 한해서 실행을 한다. 실행 확인은 웹어드민 → 배치 관리 → 배치 데몬 모니터링에서 확인할 수 있다.

데몬배치의 경우에는 웹어드민 사용자 가이드를 참고한다.

SWLab Bankware Global
  • 전체
  • BXM
  • BXCM
  • BXCP
  • BXI
제품 선택 시 더 정확한 매뉴얼 가이드를 제공해드립니다.

Copyright© Bankwareglobal All Rights Reserved.