您可以使用 GDC 控制台或 gdcloud CLI 變更下列資料庫叢集屬性:
- 管理員使用者的資料庫密碼
- 外部連線 (啟用/停用)
- 可用性等級 (僅限 AlloyDB Omni 和 PostgreSQL)
- 已啟用備份功能和備份保留天數
- 資料庫標記
- 指派給資料庫叢集的 CPU、記憶體或儲存空間
如要瞭解如何修改屬性,請參閱與要更新的屬性類型對應的工作流程:
主控台
高可用性
對於 AlloyDB Omni 和 PostgreSQL 資料庫叢集,您可以啟用或停用同區域高可用性。詳情請參閱「設定高可用性」一節。
資料保護
您可以為所有資料庫叢集類型啟用或停用資料保護功能:
- 前往「資料保護」,然後按一下「編輯」,即可存取資料保護設定表單。如果啟用自動備份功能,您也可以設定備份資料的保留時間。
- 完成變更後,按一下「儲存」,即可將更新套用至資料庫叢集。
連線
對於所有資料庫叢集類型,您可以選擇資料庫叢集是否只能從 GDC 專案內部存取,或是也能從專案外部存取:
- 前往「連線」,然後按一下「編輯」。
- 更新連線設定。
按一下 [Save] (儲存) 套用您的變更。
執行個體
對於所有資料庫叢集類型,您都可以編輯主要執行個體屬性:
- 前往「主要執行個體」,然後按一下「編輯」。
您可以選擇「高效能」、「標準」、「最低」或「自訂」設定。「自訂」選項可讓您選擇主要執行個體的 CPU 數量、記憶體和儲存空間。
更新主要執行個體的 CPU、記憶體或儲存空間時,需要重新啟動執行個體。選取「儲存並重新啟動」,即可套用變更。
對於所有資料庫叢集類型,您也可以透過這個表單新增、修改或移除資料庫旗標。可用的旗標組合由 GDC 預先決定。詳情請參閱「設定資料庫標記」一節。
gdcloud CLI
使用下列指令更新資料庫叢集:
sh
gdcloud database clusters update CLUSTER_NAME [options]
更改下列內容:
- CLUSTER_NAME,其中 CLUSTER_NAME 是要更新的資料庫叢集名稱。
如需完整選項清單,請參閱指令參考資料或執行 sh
gdcloud database clusters update --help
API
資料保護
對於所有資料庫叢集類型,您都可以為該資料庫叢集建立 BackupPlan 資源,啟用資料保護功能。
apiVersion: DBENGINE_NAME.dbadmin.gdc.goog/v1
kind: BackupPlan
metadata:
name: DBCLUSTER_NAME-backupplan
namespace: USER_PROJECT
spec:
dbclusterRef: DBCLUSTER_NAME
backupRetainDays: RETENTION_DAYS
請替換下列變數:
DBENGINE_NAME
:資料庫引擎的名稱。這是alloydbomni
、postgresql
或oracle
其中之一。DBCLUSTER_NAME
:要啟用資料保護機制的資料庫叢集名稱。USER_PROJECT
:要建立資料庫叢集的使用者專案名稱。RETENTION_DAYS
:AlloyDB Omni Operator 保留這項備份的天數。必須是介於 1 至 90 之間的整數。
您也可以編輯對應的 BackupPlan 資源,設定資料保護設定 (例如保留天數)。
如要關閉資料庫叢集的資料保護功能,請刪除先前建立的對應 BackupPlan 資源。
設定資料庫旗標
GDC 隨附的資料庫映像檔會採用預設設定。不過,您可以自訂預設資料庫引擎,以滿足應用程式的需求。資料庫叢集提供預先定義的旗標,您可以使用 GDC 控制台或 gdcloud CLI 設定這些旗標:
主控台
在導覽選單中選取「資料庫服務」。
在資料庫叢集清單中,按一下要設定資料庫標記的資料庫叢集。
在「資料庫叢集中的執行個體」部分,按一下「編輯主節點」。
在「Flags」(旗標) 區段中,按一下「Add a Database Flag」(新增資料庫旗標)。
選擇旗標並輸入值。如果您輸入的值無效,GDC 控制台會提供操作說明,引導您輸入符合規定範圍或值類型的值。
按一下 [完成]。
如要設定,請按一下「儲存」。如要讓部分標記生效,您必須重新啟動資料庫叢集。在本例中,請按一下「儲存並重新啟動」。
如要確認已設定新旗標,請返回資料庫叢集的「Instances in your database cluster」(資料庫叢集中的執行個體) 部分,並確認新旗標和值是否顯示。
如要編輯資料庫旗標,請返回「旗標」部分,然後修改現有旗標。將游標懸停在旗標元件上,然後按一下「刪除」
圖示,即可移除資料庫旗標。gdcloud
您可以為叢集設定新的資料庫標記,或將所有現有標記重設為預設值:
如要為資料庫叢集設定資料庫旗標,請執行下列指令:
gdcloud database clusters update CLUSTER_NAME \ --database-flags DB_FLAGS
更改下列內容:
CLUSTER_NAME
:資料庫叢集的名稱。DB_FLAGS
:以逗號分隔的資料庫旗標清單,用於在資料庫叢集中執行的資料庫上設定。每個資料庫旗標和值都會設為鍵/值組合。定義沒有值的旗標時,=
字元後方可不接字串。
舉例來說,下列指令會為
test-db-cluster
設定多個資料庫標記:gdcloud database clusters update test-db-cluster \ --database-flags max_allowed_packet=55555,skip_grant_tables=,log_output=1
如需可用資料庫標記的清單,請參閱「可用資料庫標記」。
如要將所有資料庫旗標重設為預設設定,請執行下列指令:
gdcloud database clusters update CLUSTER_NAME --clear-database-flags
將
CLUSTER_NAME
替換為資料庫叢集的名稱。
API
如要為資料庫叢集設定資料庫旗標,請執行下列指令:
kubectl patch dbcluster.DBENGINE_NAME.dbadmin.gdc.goog DBCLUSTER_NAME -p '{"spec":{"primarySpec": {"parameters": DB_FLAGS}}}' --type=merge -n USER_PROJECT
請替換下列變數:
DBENGINE_NAME
:資料庫引擎的名稱。這是alloydbomni
、postgresql
或oracle
。DBCLUSTER_NAME
:資料庫叢集的名稱。USER_PROJECT
:建立資料庫叢集的使用者專案名稱。DB_FLAGS
:要新增或更新的資料庫設定參數。這應該是鍵/值組合的 JSON 格式物件,其中鍵是資料庫參數名稱,值則是各自的設定。舉例來說,下列程式碼會設定多個資料庫旗標:
"autovacuum": "on", "autovacuum_analyze_threshold": "2147483647", "dbs.enable_anon": "on"
如需可用資料庫標記的清單,請參閱「可用資料庫標記」。
如要將所有資料庫旗標重設為預設設定,請執行下列指令:
kubectl patch dbcluster.DBENGINE_NAME.dbadmin.gdc.goog DBCLUSTER_NAME --type=json -p='[{"op": "remove", "path": "/spec/primarySpec/parameters"}]' -n USER_PROJECT
請替換下列變數:
DBENGINE_NAME
:資料庫引擎的名稱。這是alloydbomni
、postgresql
或oracle
。DBCLUSTER_NAME
:資料庫叢集的名稱。USER_PROJECT
:建立資料庫叢集的使用者專案名稱。
可用的資料庫旗標
接下來,我們會根據您設定的資料庫引擎,提供可為資料庫叢集設定的資料庫標記。
PostgreSQL 資料庫標記
旗標 | 範圍 | 類型 | 需要重新啟動 |
---|---|---|---|
max_connections | [1, 262143] | 整數 | TRUE |
temp_file_limit | [1048576, 2147483647] | 整數 | FALSE |
log_min_duration_statement | [-1, 2147483647] | 整數 | FALSE |
log_connections | 開啟、關閉 | 布林值 | FALSE |
log_lock_waits | 開啟、關閉 | 布林值 | FALSE |
log_disconnections | 開啟、關閉 | 布林值 | FALSE |
log_checkpoints | 開啟、關閉 | 布林值 | FALSE |
log_temp_files | [-1, 2147483647] | 整數 | FALSE |
log_statement | none、ddl、mod、all | 列舉 | FALSE |
pgaudit.log | read、write、function、role、ddl、misc、misc_set、 all、none、-read、-write、-function、-role、-ddl、 -misc、-misc_set、-all、-none |
重複字串 | FALSE |
work_mem | [64, 2147483647] | 整數 | FALSE |
autovacuum | 開啟、關閉 | 布林值 | FALSE |
maintenance_work_mem | [1024, 2147483647] | 整數 | FALSE |
random_page_cost | [0, 2147483647] | 浮點值 | FALSE |
log_min_messages | debug5、debug4、debug3、debug2、debug1、info notice、warning、error、log、fatal、panic |
列舉 | FALSE |
idle_in_transaction_session_timeout | [0, 2147483647] | 整數 | FALSE |
max_wal_size | [2, 2147483647] | 整數 | FALSE |
autovacuum_vacuum_scale_factor | [0, 100] | 浮點值 | FALSE |
log_autovacuum_min_duration | [-1, 2147483647] | 整數 | FALSE |
autovacuum_vacuum_cost_limit | [-1, 10000] | 整數 | FALSE |
autovacuum_max_workers | [1, 262143] | 整數 | TRUE |
autovacuum_analyze_scale_factor | [0, 100] | 浮點值 | FALSE |
track_activity_query_size | [100, 1048576] | 整數 | TRUE |
log_duration | 開啟、關閉 | 布林值 | FALSE |
autovacuum_vacuum_cost_delay | [-1, 100] | 整數 | FALSE |
checkpoint_completion_target | [0, 1] | 浮點值 | FALSE |
log_statement_stats | 開啟、關閉 | 布林值 | FALSE |
max_worker_processes | [8, 4096] | 整數 | TRUE |
log_min_error_statement | debug5、debug4、debug3、debug2、debug1、info、 notice、warning、error、log、fatal、panic |
列舉 | FALSE |
default_statistics_target | [1, 10000] | 整數 | FALSE |
checkpoint_timeout | [30, 86400] | 整數 | FALSE |
wal_buffers | [-1, 262143 ] | 整數 | TRUE |
effective_cache_size | [1, 2147483647] | 整數 | FALSE |
autovacuum_work_mem | [1, 2147483647] | 整數 | FALSE |
log_hostname | 開啟、關閉 | 布林值 | FALSE |
autovacuum_vacuum_threshold | [0, 2147483647] | 整數 | FALSE |
autovacuum_naptime | [1, 2147483] | 整數 | FALSE |
autovacuum_analyze_threshold | [0, 2147483647] | 整數 | FALSE |
pgaudit.log_client | 開啟、關閉 | 布林值 | FALSE |
pgaudit.log_parameter | 開啟、關閉 | 布林值 | FALSE |
pgaudit.log_level | debug5、debug4、debug3、debug2、debug1、info、 notice、warning、error、log |
列舉 | FALSE |
pgaudit.log_relation | 開啟、關閉 | 布林值 | FALSE |
pgaudit.log_catalog | 開啟、關閉 | 布林值 | FALSE |
pgaudit.role | 字串 | FALSE | |
autovacuum_freeze_max_age | [100000, 2000000000] | 整數 | TRUE |
autovacuum_multixact_freeze_max_age | [10000, 2000000000] | 整數 | TRUE |
pgaudit.log_statement_once | 開啟、關閉 | 布林值 | FALSE |
anon.algorithm | 字串 | FALSE | |
anon.maskschema | 字串 | FALSE | |
anon.restrict_to_trusted_schemas | 開啟、關閉 | 布林值 | FALSE |
anon.salt | 字串 | FALSE | |
anon.sourceschema | 字串 | FALSE | |
dbs.enable_anon | on、off | 布林值 | TRUE |
dbs.enable_pg_bigm | on、off | 布林值 | TRUE |
dbs.enable_pg_cron | on、off | 布林值 | TRUE |
dbs.enable_pg_hint_plan | on、off | 布林值 | TRUE |
dbs.enable_pg_wait_sampling | on、off | 布林值 | TRUE |
pg_bigm.enable_recheck | 開啟、關閉 | 布林值 | FALSE |
pg_bigm.gin_key_limit | [0, 2147483647] | 整數 | FALSE |
pg_bigm.similarity_limit | [0, 1] | 浮點值 | FALSE |
pg_hint_plan.debug_print | off、on、detailed、verbose、0、1、2、3、no、yes、false、true | 列舉 | TRUE |
pg_hint_plan.enable_hint | 開啟、關閉 | 布林值 | FALSE |
pg_hint_plan.enable_hint_table | 開啟、關閉 | 布林值 | FALSE |
pg_hint_plan.message_level | debug5、debug4、debug3、debug2、debug1、debug、info、notice、warning、error、log | 列舉 | FALSE |
pg_hint_plan.parse_messages | debug5、debug4、debug3、debug2、debug1、debug、info、notice、warning、error、log | 列舉 | FALSE |
pg_stat_statements.max | [100, 2147483647] | 整數 | TRUE |
pg_stat_statements.save | 開啟、關閉 | 布林值 | FALSE |
pg_stat_statements.track | none、top、all | 列舉 | FALSE |
pg_stat_statements.track_utility | 開啟、關閉 | 布林值 | FALSE |
pg_wait_sampling.history_period | [1, 2147483647] | 整數 | FALSE |
pg_wait_sampling.history_size | [1, 2147483647] | 整數 | FALSE |
pg_wait_sampling.profile_period | [1, 2147483647] | 整數 | FALSE |
pg_wait_sampling.profile_pid | 開啟、關閉 | 布林值 | FALSE |
pg_wait_sampling.profile_queries | 開啟、關閉 | 布林值 | FALSE |
pglogical.batch_inserts | 開啟、關閉 | 布林值 | TRUE |
pglogical.conflict_log_level | debug5、debug4、debug3、debug2、debug1、info、notice、warning、error、log、fatal、panic | 列舉 | FALSE |
pglogical.conflict_resolution | error、apply_remote、keep_local、last_update_wins、first_update_wins | 列舉 | FALSE |
pglogical.extra_connection_options | 字串 | FALSE | |
pglogical.synchronous_commit | 開啟、關閉 | 布林值 | TRUE |
pglogical.use_spi | 開啟、關閉 | 布林值 | TRUE |
pgtt.enabled | 開啟、關閉 | 布林值 | FALSE |
plv8.execution_timeout | [1, 65536] | 整數 | FALSE |
plv8.memory_limit | [256, 3096] | 整數 | FALSE |
plv8.start_proc | 字串 | FALSE | |
rdkit.agent_FP_bit_ratio | [0, 3] | 浮點值 | FALSE |
rdkit.avalon_fp_size | [64, 9192] | 整數 | FALSE |
rdkit.dice_threshold | [0, 1] | 浮點值 | FALSE |
rdkit.difference_FP_weight_agents | [-10, 10] | 整數 | FALSE |
rdkit.difference_FP_weight_nonagents | [1, 20] | 整數 | FALSE |
rdkit.do_chiral_sss | 開啟、關閉 | 布林值 | FALSE |
rdkit.do_enhanced_stereo_sss | 開啟、關閉 | 布林值 | FALSE |
rdkit.featmorgan_fp_size | [64, 9192] | 整數 | FALSE |
rdkit.hashed_atompair_fp_size | [64, 9192] | 整數 | FALSE |
rdkit.hashed_torsion_fp_size | [64, 9192] | 整數 | FALSE |
rdkit.ignore_reaction_agents | 開啟、關閉 | 布林值 | FALSE |
rdkit.init_reaction | 開啟、關閉 | 布林值 | FALSE |
rdkit.layered_fp_size | [64, 9192] | 整數 | FALSE |
rdkit.morgan_fp_size | [64, 9192] | 整數 | FALSE |
rdkit.move_unmmapped_reactants_to_agents | 開啟、關閉 | 布林值 | FALSE |
rdkit.rdkit_fp_size | [64, 9192] | 整數 | FALSE |
rdkit.reaction_difference_fp_size | [64, 9192] | 整數 | FALSE |
rdkit.reaction_difference_fp_type | [1, 3] | 整數 | FALSE |
rdkit.reaction_sss_fp_size | [64, 9192] | 整數 | FALSE |
rdkit.reaction_sss_fp_type | [1, 5] | 整數 | FALSE |
rdkit.sss_fp_size | [64, 4096] | 整數 | FALSE |
rdkit.tanimoto_threshold | [0, 1] | 浮點值 | FALSE |
rdkit.threshold_unmapped_reactant_atoms | [0, 1] | 浮點值 | FALSE |
下表列出與供應商預設值不同的旗標預設值:
旗標 | 值/公式 | |
---|---|---|
shared_buffers | 1/3 * totalMemory(MiB) | |
max_wal_size | 1504MB | |
max_connections | 記憶體總量 >= ? | 值 |
120 GB | 1000 | |
60 GB | 800 | |
15 GB | 500 | |
7.5 GB | 400 | |
6GB | 200 | |
3.75 GB | 100 | |
1.7GB | 50 | |
0 | 25 | |
effective_cache_size | 2/5 * totalMemory | |
temp_file_limit | 1/10 * storageSize | |
log_connections | 開啟 | |
log_disconnections | 開啟 | |
pgaudit.log | all, -misc | |
log_hostname | 開啟 | |
pgaudit.log_parameter | 開啟 |
Oracle 資料庫旗標
旗標 | 範圍 | 類型 | 需要重新啟動 |
---|---|---|---|
aq_tm_processes | [0, 40] | 整數 | FALSE |
background_core_dump | FULL、PARTIAL | 列舉 | FALSE |
bitmap_merge_area_size | [0, 2147483647] | 整數 | TRUE |
control_management_pack_access | 無、診斷、診斷 + 調整 | 列舉 | FALSE |
cursor_sharing | FORCE、EXACT、SIMILAR | 列舉 | FALSE |
db_cache_size | [0, 10995116277760] | 整數 | FALSE |
db_files | [200, 20000] | 整數 | TRUE |
db_flashback_retention_target | [30, 2147483647] | 整數 | FALSE |
db_keep_cache_size | [0, 10995116277760] | 整數 | FALSE |
db_recovery_file_dest_size | [0, 10995116277760] | 整數 | FALSE |
活動 | 字串 | TRUE | |
large_pool_size | [0, 10995116277760] | 整數 | FALSE |
log_buffer | [2097152, 10995116277760] | 整數 | TRUE |
open_cursors | [5, 65535] | 整數 | FALSE |
pga_aggregate_limit | [0, 10995116277760] | 整數 | FALSE |
pga_aggregate_target | [10485760, 10995116277760] | 整數 | FALSE |
程序 | [100, 20000] | 整數 | TRUE |
recyclebin | 開啟、關閉 | 列舉 | TRUE |
resource_limit | TRUE、FALSE | 布林值 | FALSE |
sec_max_failed_login_attempts | [1, 2147483647] | 整數 | TRUE |
sga_max_size | [377487360, 10995116277760] | 整數 | TRUE |
sga_target | [377487360, 10995116277760] | 整數 | FALSE |
shared_pool_size | [0, 10995116277760] | 整數 | FALSE |
undo_retention | [0, 2147483647] | 整數 | FALSE |
global_names | TRUE、FALSE | 布林值 | FALSE |
DBFIPS_140 | TRUE、FALSE | 布林值 | TRUE |
parallel_max_servers | [0, 32767] | 整數 | FALSE |
_fix_control | 字串 | FALSE | |
_sql_plan_directive_mgmt_control | [0, 65535] | 整數 | FALSE |
_optimizer_dsdir_usage_control | [0, 126] | 整數 | FALSE |
skip_unusable_indexes | TRUE、FALSE | 布林值 | FALSE |
下表列出與供應商預設值不同的旗標預設值:
旗標 | 值/公式 |
---|---|
sga_target | 4/5* (totalMemory-1GiB) |
pga_aggregate_target | 1/5* (totalMemory-1GiB) |
open_cursors | 300 |
程序 | 300 |
DBFIPS_140 | TRUE |
global_names | TRUE |
AlloyDB Omni 資料庫旗標
旗標 | 範圍 | 類型 | 需要重新啟動 |
---|---|---|---|
google_columnar_engine.enabled | 開啟、關閉 | 布林值 | TRUE |
google_columnar_engine.memory_size_in_mb | [128, 2147483647] | 整數 | TRUE |
anon.algorithm | 字串 | FALSE | |
anon.maskschema | 字串 | FALSE | |
anon.restrict_to_trusted_schemas | 開啟、關閉 | 布林值 | FALSE |
anon.salt | 字串 | FALSE | |
anon.sourceschema | 字串 | FALSE | |
dbs.enable_anon | on、off | 布林值 | TRUE |
dbs.enable_pg_bigm | on、off | 布林值 | TRUE |
dbs.enable_pg_cron | on、off | 布林值 | TRUE |
dbs.enable_pg_hint_plan | on、off | 布林值 | TRUE |
dbs.enable_pg_squeeze | on、off | 布林值 | TRUE |
dbs.enable_pg_wait_sampling | on、off | 布林值 | TRUE |
pg_bigm.enable_recheck | 開啟、關閉 | 布林值 | FALSE |
pg_bigm.gin_key_limit | [0, 2147483647] | 整數 | FALSE |
pg_bigm.similarity_limit | [0, 1] | 浮點值 | FALSE |
pg_hint_plan.debug_print | off、on、detailed、verbose、0、1、2、3、no、yes、false、true | 列舉 | TRUE |
pg_hint_plan.enable_hint | 開啟、關閉 | 布林值 | FALSE |
pg_hint_plan.enable_hint_table | 開啟、關閉 | 布林值 | FALSE |
pg_hint_plan.message_level | debug5、debug4、debug3、debug2、debug1、debug、info、notice、warning、error、log | 列舉 | FALSE |
pg_hint_plan.parse_messages | debug5、debug4、debug3、debug2、debug1、debug、info、notice、warning、error、log | 列舉 | FALSE |
pg_stat_statements.max | [100, 2147483647] | 整數 | TRUE |
pg_stat_statements.save | 開啟、關閉 | 布林值 | FALSE |
pg_stat_statements.track | none、top、all | 列舉 | FALSE |
pg_stat_statements.track_utility | 開啟、關閉 | 布林值 | FALSE |
pg_wait_sampling.history_period | [1, 2147483647] | 整數 | FALSE |
pg_wait_sampling.history_size | [1, 2147483647] | 整數 | FALSE |
pg_wait_sampling.profile_period | [1, 2147483647] | 整數 | FALSE |
pg_wait_sampling.profile_pid | 開啟、關閉 | 布林值 | FALSE |
pg_wait_sampling.profile_queries | 開啟、關閉 | 布林值 | FALSE |
pgaudit.log | read、write、function、role、ddl、misc、misc_set、 all、none、-read、-write、-function、-role、-ddl、 -misc、-misc_set、-all、-none |
重複字串 | FALSE |
pgaudit.log_client | 開啟、關閉 | 布林值 | FALSE |
pgaudit.log_parameter | 開啟、關閉 | 布林值 | FALSE |
pgaudit.log_level | debug5、debug4、debug3、debug2、debug1、info、 notice、warning、error、log |
列舉 | FALSE |
pgaudit.log_relation | 開啟、關閉 | 布林值 | FALSE |
pgaudit.log_catalog | 開啟、關閉 | 布林值 | FALSE |
pgaudit.role | 字串 | FALSE | |
pgaudit.log_statement_once | 開啟、關閉 | 布林值 | FALSE |
pglogical.batch_inserts | 開啟、關閉 | 布林值 | TRUE |
pglogical.conflict_log_level | debug5、debug4、debug3、debug2、debug1、info、notice、warning、error、log、fatal、panic | 列舉 | FALSE |
pglogical.conflict_resolution | error、apply_remote、keep_local、last_update_wins、first_update_wins | 列舉 | FALSE |
pglogical.extra_connection_options | 字串 | FALSE | |
pglogical.synchronous_commit | 開啟、關閉 | 布林值 | TRUE |
pglogical.use_spi | 開啟、關閉 | 布林值 | TRUE |
pgtt.enabled | 開啟、關閉 | 布林值 | FALSE |
plv8.execution_timeout | [1, 65536] | 整數 | FALSE |
plv8.memory_limit | [256, 3096] | 整數 | FALSE |
plv8.start_proc | 字串 | FALSE |