리눅스 시스템이 재부팅을 했을 때, 특정 데몬들을 자동실행하고 싶은 경우가 있다. 빅데이터 클러스터의 경우 ambari-agent 등의 데몬을 자동 실행하도록 설정해두면, 장비의 점검이 끝나고 재부팅이 되었을 때 Ambari 서버에서 쉽게 컴포넌트들을 재시작할 수 있다.
리눅스 서비스 (Linux Service)
윈도우에서 시스템이 재부팅되면 자동으로 실행되는 프로그램들이 있다. 마찬가지로 리눅스에서도 시스템이 부팅될 때 백그라운드에서 자동 실행되는 응용프로그램들이 있다. 백그라운드에서 동작하면서 사용자에게 어떠한 서비스들을 제공하기 위한 이런 데몬들을 '리눅스 서비스'라고 생각하면 된다.
CentOS 7 - systemctl 명령
CentOS 7에서는 서비스와 관련된 설정을 세팅하거나 확인하기 위해 systemctl 이라는 명령을 제공한다.
서비스 상태 확인
systemctl status ${service_name}.service
서비스 시작
systemctl start ${service_name}.service
서비스 재시작
systemctl restart ${service_name}.service
서비스 중지
systemctl stop ${service_name}.service
부팅시 서비스 자동시작
systemctl enable ${service_name}.service
부팅시 서비스 자동 시작 해제
systemctl disable ${service_name}.service
자동시작 여부 확인
systemctl is-enabled ${service_name}
서비스 목록 보기
systemctl list-units --type=service
CentOS 6 - service 명령 & chkconfig
서비스 상태 확인
service ${service_name} status
서비스 시작
service ${service_name} start
서비스 재시작
service ${service_name} restart
서비스 중지
service ${service_name} stop
부팅시 서비스 자동시작
chkconfig ${service_name} on
부팅시 서비스 자동 시작 해제
chkconfig ${service_name} off
자동시작 여부 확인
chkconfig ${service_name}
서비스 목록 보기
chkconfig --list
댓글