문서유형ㅣ기술정보
분야ㅣ인터페이스/연동
적용제품버전ㅣTibero 6 (FS07)
문서번호ㅣTIITI035
개요
본 문서에서는 Redhat 8.X 에서 Pacemakers 연동 시 system unit file 및 systemctl 명령어를 이용하여 DB 기동/종료 서비스를 생성하는 작업을 안내합니다.
방법
테스트 환경
OS : Red Hat Enterprise Linux release 8.2 (Ootpa) Kernel : Linux finlin 4.18.0-193.el8.x86_64 #1 SMP Fri Mar 27 14:35:58 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux Tibero Version ; Tibero 6 (DB 6.0 FS07_CS_2005) |
기동 / 종료 스크립트
#!/bin/bash su - test -c "tbdown clean su - test -c "tbboot" exit 0 |
#!/bin/bash su - test -c "tbdown immediate" exit ## 이중화 테스트 시 tbdown abort 변경 |
start/stop shell 생성 후 owner의 실행 권한 변경이 필요합니다.
$ chmod o+x /tmp/tibero/start.sh $ chmod o+x /tmp/tibero/stop.sh
1. Systemd unit 스크립트 작성
# root 로 수행 생성 경로 : /lib/systemd/system/dbtib.service $ vi /lib/systemd/system/dbtib.service [Unit] Description=The Tibero Database Service After=syslog.target network.target [Service] # systemd ignores PAM limits, so set any necessary limits in the service. # Not really a bug, but a feature. # https://bugzilla.redhat.com/show_bug.cgi?id=754285 LimitMEMLOCK=infinity LimitNOFILE=65535 #Type=simple Type=forking # forking 방식 사용 할 경우 systemctl status에 foking 된 프로세스를 보여줌 # idle: similar to simple, the actual execution of the service binary is delayed # until all jobs are finished, which avoids mixing the status output with shell output of services. RemainAfterExit=yes Restart=no ## Tibero Stop ExecStop=/bin/bash -c '/tmp/tibero/stop.sh' ## Tibero Start ExecStart=/bin/bash -c '/tmp/tibero/start.sh' [Install] WantedBy=multi-user.target
2. systemctl 작업 (root 유저로 수행)
2.1 서비스 갱신
$ sysctlctl daemon-reload
2.2 서비스 확인
$ systemctl status dbtib.service
2.3 서비스 시작
$ systemctl stop dbtib.service
[simple type]
[ forking type]
2.4 서비스 종료
$ systemctl stop dbtib.service
2.5 서비스 활성화
$ systemctl enable dbtib.service
참고 사항
systemd
일부 리눅스 배포판에서 유닉스 시스템 V나 BSD init 시스템 대신 사용자 공간을 부트스트래핑하고 최종적으로 모든 프로세스들을 관리하는 init 시스템 입니다.
- systemd라는 이름 뒤에 추가된 d는 유닉스에서의 데몬(daemon)을 의미합니다.
- GNU LGPL 버전 2.1 이상으로 허 가된 자유 및 오픈 소스 소프트웨어로 출시되었습니다.
- systemd의 기본 목표 중 하나는 모든 배포판들에 대해 기본 리눅스 구성과 서비스 동작을 통일하는 것입니다.
systemctl
리눅스의 systemd 와 service manager 를 컨트롤 하기위한 도구 입니다.
- 서비스의 상태 진단, 설정변경, 구동과 중단 등의 전반적인 관리 기능을 제공합니다.
Pacemaker 연동 관련
- Redhat 8.x 부터 Pacemaker 연동 시 systemd unit 파일을 systemd에 등록하여 관리하는 방식을 권고합니다.
- Tibero에서 구형 방식의 init 파일 형태나 Systemd의 unit 파일로 제공이 필요합니다.
- 현재 RHEL7/8은 fstab 및 file system도 Systemd로 관리하는 추세입니다. (OCF 방식)
- Systemd unit 파일이 불가한 경우 init 파일을 하나의 파일에 시작/중지/상태에 대한 모든 내용이 들어간 파일이어야 합니다. (LSB 방식)