"CLI - Database"의 두 판 사이의 차이

(새 문서: __FORCETOC__ The imRAD use the MariaDB server<ref>https://en.wikipedia.org/wiki/MariaDB</ref>. We name it "mysql". In this wiki, you use both terms "MariaDB" and "mysql", but they ar...)
 
1번째 줄: 1번째 줄:
 
__FORCETOC__
 
__FORCETOC__
The imRAD use the MariaDB server<ref>https://en.wikipedia.org/wiki/MariaDB</ref>. We name it "mysql". In this wiki, you use  both terms "MariaDB" and "mysql", but they are the same.
+
본 시스템은 MariaDB 서버를<ref>https://en.wikipedia.org/wiki/MariaDB</ref> 데이터베이스로 사용하며 본 문서에서는 그 이름을 때때로 "mysql"로 표현합니다.
  
=== Database Connection Properties ===
+
=== 데이터베이스 연결 속성 ===
If you run the <code>show system mariadb</code> command, it shows the version of the Database.
+
<code>show system mariadb</code>는 MariaDB 서비스 상태를 표시합니다. 모든 데이터베이스 연결 속성 정보는 암호화되어있는데 <code>show database property {id}</code> 명령어를 사용하면 그 정보를 평문으로 출력 할 수 있습니다. 단, 보안상 암호는 일부가 * 표시로 출력됩니다.
All Database Connection Properties are securely encrypted. If you want to see properties as plaintext, use the <code>show database property</code> command.<br>
+
 
The imRAD consists of three types of Database Connection Properties.
+
imRAD는 3가지 형식의 연결속성이 존재합니다.
 
{| class="wikitable"
 
{| class="wikitable"
! style='width:50px' | ID !! Name !! Description
+
! style='width:50px' | ID !! 이름 !! 설명
 
|-
 
|-
| style='text-align:center' | 0 || MainDB || It is the properties for imRAD main database. If there are two systems for the purpose of the [[System Failover]], one of them is the main system. In other words, an active system is the main system and it has the main database.
+
| style='text-align:center' | 0 || MainDB || 메인 데이터베이스의 연결 속성입니다. 만일 [[System Failover]] 목적으로 두 개의 시스템이 존재할때 "active" 장비의 정보가 출력됩니다.
 
|-
 
|-
| style='text-align:center' | 2 || LocalDB || It is the properties for local database.  
+
| style='text-align:center' | 2 || LocalDB || 현재 장비에 대한 데이터베이스의 연결 속성입니다.  
 
|-
 
|-
| style='text-align:center' | 3 || PeerDB || If you configure the [[System Failover]], these properties are written. If not, no properties for the type 3 exist.
+
| style='text-align:center' | 3 || PeerDB || [[System Failover]] 구성시 상대방 장비에 대한 연결 정보입니다.
 
|-
 
|-
 
|}
 
|}
  
Note that the leading five characters of the password are marked to * for the purpose of security.
+
보안 목적으로 비밀번호 일부는 *로 표시됩니다.
 
<pre>LYSH@MyHostName# show database property 0 // Display the database connection properties of the MainDB (1)
 
<pre>LYSH@MyHostName# show database property 0 // Display the database connection properties of the MainDB (1)
 
   Host:127.0.0.1
 
   Host:127.0.0.1
25번째 줄: 25번째 줄:
 
</pre>
 
</pre>
  
=== Configuring Database Connection Properties ===
+
=== 연결 속성 설정 ===
 
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.
 
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.
 
<pre>
 
<pre>

2021년 5월 17일 (월) 18:31 판

본 시스템은 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]
  • ID: The client's process ID.
  • USER: The username associated with the process.
  • HOST: The host the client is connected to.
  • DB: The default database of the process (NULL if no default).
  • COMMAND: The command type. See Thread Command Values.
  • TIME: The amount of time, in seconds, the process has been in its current state.
  • INFO: The statement being executed.
  • PROGRESS: The total progress of the process (0-100%) (see Progress Reporting).
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.

References