Ubuntu 22.04.03에서 Redmine 5.0 구성하기 [ 3 ] - MySQL 설정
이번 섹션은 "Redmine을 위한 MySQL 설정"에 대하여 작성합니다.
Redmine은 여러 데이터베이스 백엔드를 사용할 수 있습니다. 기존 Redmine 서버는 MySQL에서 실행되고 있으므로, 데이터베이스 마이그레이션 프로세스를 간소화하기 위해 이번 설치에서도 MySQL을 사용합니다.
위에서 설치하지 않았다면, MySQL에 필요한 모든 구성 요소를 설치하세요.
$ sudo apt-get install mysql-server mysql-client
다음으로 MySQL에서 Redmine 계정을 설정해야 합니다. root 사용자로 MySQL 명령줄 클라이언트를 실행하세요.
$ sudo mysql
[sudo] password for administrator: "<Enter your admin password here>"
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.29-0ubuntu0.22.04.2 (Ubuntu)
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql>
Redmine 데이터베이스와 Redmine 사용자를 생성하세요. MySQL 데이터베이스에 대해 추측하기 어려운 비밀번호를 선택하고, 아래의 mysql-redmine-password 대신 사용하세요. 나중에 Redmine을 구성할 때 이 비밀번호가 필요합니다.
mysql> CREATE DATABASE redmine CHARACTER SET utf8mb4;
Query OK, 1 row affected (0.10 sec)
mysql> CREATE USER ‘redmine’@’localhost’ IDENTIFIED BY ‘<mysql-redmine-password>’;
Query OK, 0 rows affected (0.18 sec)
mysql> GRANT ALL PRIVILEGES ON redmine.* TO ‘redmine’@’localhost’;
Query OK, 0 rows affected (0.02 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)
MySQL은 데이터베이스 업데이트를 재생하는 데 사용되는 바이너리 로그를 유지합니다. 이러한 로그는 시간이 지남에 따라 축적되어 디스크 공간을 차지하며, 경우에 따라 모든 저장 공간을 소진할 수도 있습니다. 이를 방지하기 위해 MySQL이 2일 이상된 바이너리 로그를 자동으로 삭제하도록 설정해야 합니다.
mysql> SET PERSIST binlog_expire_logs_seconds = 172800;
Query OK, 0 rows affected (0.01 sec)
mysql> show variables like 'binlog_expire_logs_seconds';
+----------------------------+--------+
| Variable_name | Value |
+----------------------------+--------+
| binlog_expire_logs_seconds | 172800 |
+----------------------------+--------+
1 row in set (0.00 sec)
표시된 값이 SET 명령어에서 설정한 값과 일치하는지 확인하세요.
마지막 단계로 MySQL을 종료하세요.
mysql> exit
Bye
이전 legacy Redmine 설치에서 데이터를 마이그레이션하는 경우, 기존 Redmine 데이터를 추출하고 새로운 Redmine 서버에 복원해야 합니다.
$ sudo -c bash ‘mysqldump redmine >redmine_backup.sql’
$ sudo -c bash ‘cd <path-to-redmine-install> ; tar -cvzf redmine_files.tar.gz files’
$ sudo mv <path-to-redmine-install</redmine_files.tar.gz redmine_files.tar.gz
이 과정에서는 두 개의 파일이 생성됩니다:
- 데이터베이스를 복원하는 데 필요한 SQL이 포함된 대용량 텍스트 파일
- 사용자가 업로드한 모든 콘텐츠를 포함하는 tarball 파일
이전 서버에서 Redmine 데이터베이스 이름이 "redmine"이 아닐 경우, 해당 명령어를 적절히 수정해야 합니다. 또한, `path-to-redmine-install`을 이전 시스템에서 Redmine이 설치된 실제 경로로 변경해야 합니다.
`redmine_backup.sql` 및 `redmine_files.tar.gz` 파일을 새로운 Redmine 서버의 관리자 계정으로 복사한 후, 해당 명령어를 실행하세요.
$ sudo -c bash 'mysql redmine <redmine_backup.sql>'
Redmine 설치 과정에서는 최종 데이터 마이그레이션을 수행하는 단계가 포함됩니다.
다음 섹션은 "Redmine 설치하기"이며, 업로드된 Redmine 파일을 복원하는 과정도 안내하겠습니다.