

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 設定和顯示二進位日誌組態
<a name="mysql-stored-proc-configuring"></a>

下列預存程序會設定並顯示組態參數，例如二進位日誌檔案保留。

**Topics**
+ [

## mysql.rds\$1set\$1configuration
](#mysql_rds_set_configuration)
+ [

## mysql.rds\$1show\$1configuration
](#mysql_rds_show_configuration)

## mysql.rds\$1set\$1configuration
<a name="mysql_rds_set_configuration"></a>

指定保留二進位日誌的小時數，或延遲複寫的秒數。

### 語法
<a name="mysql_rds_set_configuration-syntax"></a>

 

```
CALL mysql.rds_set_configuration(name,value);
```

### Parameters
<a name="mysql_rds_set_configuration-parameters"></a>

 *name*   
要設定之組態參數的名稱。

 *value*   
組態參數的值。

### 使用須知
<a name="mysql_rds_set_configuration-usage-notes"></a>

`mysql.rds_set_configuration` 程序支援下列組態參數：
+ [binlog 保留 (小時)](#mysql_rds_set_configuration-usage-notes.binlog-retention-hours)

組態參數會永久存放，且在任何資料庫執行個體重新啟動或容錯移轉後依然存在。

#### binlog 保留 (小時)
<a name="mysql_rds_set_configuration-usage-notes.binlog-retention-hours"></a>

`binlog retention hours` 參數用於指定保留二進位日誌檔的小時數。Amazon Aurora 通常會儘快清除二進位日誌，但複寫 Aurora 外部的 MySQL 資料庫時可能仍需要二進位日誌。

`binlog retention hours` 的預設值為 `NULL`。對於 Aurora MySQL，`NULL` 意味著二進位日誌被延遲清理。Aurora MySQL 二進位日誌可能會在系統中保留一段時間，通常不會超過一天。

若要指定在資料庫叢集上保留二進位日誌的時數，請使用 `mysql.rds_set_configuration` 預存程序，並指定讓複寫有足夠時間進行的期間，如下列範例所示。

`call mysql.rds_set_configuration('binlog retention hours', 24);`

**注意**  
不可針對 `binlog retention hours` 使用值 `0`。

對於 Aurora MySQL 2.11.0 版和更新版本，以及第 3 版資料庫叢集，最大 `binlog retention hours` 值是 2160 (90 天)。

設定保留期間之後，請監控資料庫執行個體的儲存體用量，確定保留的二進位日誌沒有佔用太多儲存體。

## mysql.rds\$1show\$1configuration
<a name="mysql_rds_show_configuration"></a>

保留二進位日誌的時數。

### 語法
<a name="mysql_rds_show_configuration-syntax"></a>

 

```
CALL mysql.rds_show_configuration;
```

### 使用須知
<a name="mysql_rds_show_configuration-usage-notes"></a>

若要驗證 Amazon RDS 保留二進位日誌的時數，請使用 `mysql.rds_show_configuration` 預存程序。

### 範例
<a name="mysql_rds_show_configuration-examples"></a>

下列範例顯示保留期間：

```
call mysql.rds_show_configuration;
                name                         value     description
                binlog retention hours       24        binlog retention hours specifies the duration in hours before binary logs are automatically deleted.
```