본 시스템은 MariaDB 서버를[1] 데이터베이스로 사용하며 본 문서에서는 그 이름을 때때로 "mysql"로 표현합니다.
데이터베이스 연결 속성
show system mariadb
는 MariaDB 서비스 상태를 표시합니다. 모든 데이터베이스 연결 속성 정보는 암호화되어있는데 show database property {id}
명령어를 사용하면 그 정보를 평문으로 출력 할 수 있습니다. 단, 보안상 암호는 일부가 * 표시로 출력됩니다.
imRAD는 3가지 형식의 연결속성이 존재합니다.
ID | 이름 | 설명 |
---|---|---|
0 | MainDB | 메인 데이터베이스의 연결 속성입니다. 만일 System Failover 목적으로 두 개의 시스템이 존재할때 "active" 장비의 정보가 출력됩니다. |
2 | LocalDB | 현재 장비에 대한 데이터베이스의 연결 속성입니다. |
3 | PeerDB | System Failover 구성시 상대방 장비에 대한 연결 정보입니다. |
보안 목적으로 비밀번호 일부는 *로 표시됩니다.
LYSH@MyHostName# show database property 0 // Display the database connection properties of the MainDB (1) Host:127.0.0.1 Port:6710 User-id:lyon User-Password:*****y@nu24
연결 속성 설정
You can configure the host of Database Connection Properties. However, you don't need to configure because If you configure the System Failover, the properties for other types are set automatically. Therefore, If there's no problem, DO NOT configure the Database Connection Properties.
LYSH@MyHostName# configure configure# database property create 2 127.0.0.1 // Configuring the host of the LocalDB(2) to 127.0.0.1 configure# exit LYSH@MyHostName# show database property 2 // Display the database connection properties of the LocalDB(2)
Configuring Database backup
You can configure to have the system can backup the database and the imRAD is already enabled to backup the database. The default configuration is
- db_backup_interval=1
- db_backup_hour=3
- max_db_backup_file=5
The above configurations mean that the system backup the database at 3 o'clock every 1 day and remain only a recent 5 backup files. In other words, if there are more than 5 backup files after backup, the oldest one is removing.
LYSH@MyHostName# show system db_backup // view the current database backup configuration db_backup task : Active db_backup : enable db_backup_interval : 1 db_backup_hour : 3 max_db_backup_file : 5 last_db_backup_datetime : 2021-04-28 03:30:01 last_db_backup_state : success LYSH@MyHostName# configure configure# database backup enable // enable database backup configure# database backup disable // disable database backup configure# database backup hour 5 // Configure the starting hour of database backup configure# database backup interval 2 // Configure the database backup interval in days configure# database backup maxfile 3 // Configure the maximum number of database backup files to keep
You can verify the current database backup configuration and backup files by the show database backup
command
LYSH@MyHostName# show database backup db_backup task : Active db_backup : enable db_backup_interval : 1 db_backup_hour : 3 max_db_backup_file : 5 last_db_backup_datetime : 2021-04-28 03:30:01 last_db_backup_state : success total 1.7M -rw-r--r-- 1 root root 20 Apr 25 03:30 backup_210425.sql.gz -rw-r--r-- 1 root root 20 Apr 26 03:30 backup_210426.sql.gz -rw-r--r-- 1 root root 20 Apr 27 03:30 backup_210427.sql.gz -rw-r--r-- 1 root root 20 Apr 28 03:30 backup_210428.sql.gz
Connect to Database(mysql)
You can access a database directly if necessary by the mysql
command.
If you want to access a database using "root", you must request an One Time Password (OTP)[2].
You should bear in mind that accessing the Database should be only for the purpose of maintenance or fixing problems.
Verifying Database
You can verify the status, variables, and so on by using the show database {ARG}
command.
argument | Description |
---|---|
backup | It shows you the backup configuration and files. |
connection | It shows you information about which protocol is used.[3] |
process | It shows you which threads are running.[4]
|
property | It shows you decrypted database connection properties. |
replication | You can see the status of the MySQL replication. |
status | It shows you the status of MySQL service. |
variable | It shows you the MySQL global variables. |