Skip to content

NCUBE.NET

  • Life Log
  • Cycling Log
  • Photo Log
    • Portrait
    • Landscape
    • Flower
    • Etc
  • Coding Log
  • Information

mariadb logrotate 설정

2014-02-04 by 편리

리눅스 logrotate 데몬을 이용해 mariadb 로그를 관리하기 위해서는 아래와 같은 설정을 사용하면 된다. mariadb는 rpm을 이용해 설치한 경우이다. 소스 컴파일로 설치한 경우 아래 스크립트에서 경로 부분을 직접 수정해야한다. 파일은 /etc/logrotate.d/ 아래에 생성해 주면 된다.

## This logname can be set in /etc/my.cnf
# by setting the variable "err-log"
# in the [safe_mysqld] section as follows:
#
# [safe_mysqld]
# err-log=/var/lib/mysql/mysqld.log
#
# If the root user has a password you have to create a
# /root/.my.cnf configuration file with the following
# content:
#
# [mysqladmin]
#password = <secret>
#user= root
#
# where "<secret>" is the password.
#
# ATTENTION: This /root/.my.cnf should be readable ONLY
# for root !

/var/lib/mysql/mariadb.log {
        # create 600 mysql mysql
        notifempty
        daily
        rotate 3
        missingok
        compress
    postrotate
        if test -n "`ps acx|grep mysqld`"; then
            /usr/bin/mysqladmin flush-logs
        fi
    endscript
}

그리고 /usr/bin/mysqladmin flush-logs 부분이 실행되기 위해서 mariadb의 root 패스워드를 설정했다면 /root/.my.cnf 파일을 생성하고 아래 내용을 추가해줘야 한다.

[mysqladmin]
password = 1234
user = root

위 내용 중에서 1234는 실제 mariadb의 root 패스워드를 적어준다.

Post navigation

Previous Post:

설연휴

Next Post:

ZIO-9500GD 펌웨어 V1.1.2 공개

Recent Posts

  • Windows 10 메모장의 재미난 기능
  • Windows 10 iCloud 사진 저장 폴더 변경
  • VS Code에서 git 히스토리 표시 오류
  • Windows 10 iTunes 백업 폴더 변경
  • Apache 서버에서 htaccess 파일 여러 개 지정하기
  • CentOS 7에서 Apache SELinux 설정
  • PSR 코딩을위해 VS Code 에 php-cs-fixer 적용
  • Instagram Basic Display API 연동
  • phpMyAdmin에서 root 로그인이 불가능한 경우 해결법
  • Ubuntu20.04 에서 PHP8 업그레이드

Recent Comments

  • 편리 on [PHP] HTTP와 PHP를 이용한 html5 video 스트리밍 구현
  • Kim on [PHP] HTTP와 PHP를 이용한 html5 video 스트리밍 구현
  • 편리 on 워드프레스 애니메이션 gif 파일을 mp4로 변환하여 출력하기
  • 고맙습니다 on 워드프레스 애니메이션 gif 파일을 mp4로 변환하여 출력하기
  • 편리 on PHPMailer를 이용한 이메일 발송
  • 초보자 on PHPMailer를 이용한 이메일 발송
  • 편리 on PHPMailer를 이용한 이메일 발송
  • 초보자 on PHPMailer를 이용한 이메일 발송
  • 편리 on 워드프레스 굿스플로 알림톡 플러그인 개발
  • 남민기 on 워드프레스 굿스플로 알림톡 플러그인 개발

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
© 2021 NCUBE.NET | Built using WordPress and SuperbThemes