Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Halaman ini menjelaskan cara menambahkan flag database untuk instance, mengubah flag database, dan menghapus flag database dari instance dalam cluster AlloyDB untuk PostgreSQL.
Anda menggunakan flag database untuk banyak operasi, termasuk menyesuaikan parameter PostgreSQL, menyesuaikan opsi, serta mengonfigurasi dan melakukan tuning pada sebuah instance.
Perubahan pada nilai flag database tetap ada untuk instance-nya hingga Anda menghapus flag atau mengubah nilainya lagi.
Dalam beberapa kasus, menyetel sebuah flag mungkin akan mengharuskan Anda menyetel flag lain untuk
mengaktifkan fungsionalitas yang diinginkan secara penuh.
Setelah Anda menyetel, menghapus, atau memodifikasi flag untuk sebuah instance database,
AlloyDB mungkin akan memulai ulang instance tersebut. Hal ini bergantung pada flag, seperti yang tercantum di Flag database yang didukung.
Saat Anda mengubah tanda database di instance utama atau kumpulan baca yang perlu dimulai ulang, Anda dapat memilih salah satu kebijakan pemeliharaan berikut:
Periode nonaktif yang singkat. Kebijakan ini diaktifkan secara default. Sebaiknya gunakan kebijakan ini untuk semua cluster AlloyDB produksi Anda karena kebijakan ini meminimalkan periode nonaktif aplikasi.
Jika kebijakan periode nonaktif rendah diaktifkan, memperbarui tanda yang memerlukan
mulai ulang pada instance utama cluster Anda akan memberikan efek berikut:
Instance utama mengalami waktu nonaktif kurang dari satu detik untuk sebagian besar beban kerja.
Tanda pada instance utama selesai diperbarui ke nilai barunya
setelah sekitar 15 menit.
Memperbarui tanda yang memerlukan mulai ulang pada instance kumpulan baca memiliki efek berikut:
Instance kumpulan baca tidak memerlukan periode nonaktif.
Flag pada instance kumpulan baca selesai diperbarui ke nilai
barunya setelah sekitar 10 menit.
Terapkan paksa. Untuk menerapkan update flag dengan lebih cepat, gunakan opsi FORCE_APPLY
dengan perintah gcloud beta alloydb instances update.
Kebijakan ini lebih sesuai untuk lingkungan pengembangan, sehingga Anda dapat menambahkan atau mengubah flag dengan cepat dengan imbalan waktu nonaktif instance yang lebih lama dan penurunan sementara performa atau throughput database. Cluster Anda akan kembali ke performa puncak beberapa menit setelah menerapkan pembaruan flag secara paksa.
Dengan kebijakan penerapan paksa diaktifkan, memperbarui tanda yang memerlukan
mulai ulang pada instance utama cluster Anda akan memberikan efek berikut:
Instance utama mengalami periode nonaktif sekitar satu menit.
Flag pada instance utama selesai diperbarui ke nilai barunya
setelah satu atau dua menit.
Memperbarui tanda yang memerlukan mulai ulang pada instance kumpulan baca memiliki efek berikut:
Instance kumpulan baca mengalami periode nonaktif sekitar satu menit.
Flag pada instance kumpulan baca selesai diperbarui ke nilai
barunya setelah satu atau dua menit.
Untuk menerapkan update flag dengan lebih cepat, sertakan argumen
--update-mode=FORCE_APPLY. Karena hal ini dapat mengurangi performa database untuk sementara, hindari penggunaan opsi ini di lingkungan produksi.
FLAGS_LIST: Daftar spesifikasi tanda database yang dipisahkan koma. Setiap spesifikasi terdiri dari nama tanda, tanda sama dengan (=), dan nilai yang akan ditetapkan ke tanda. Untuk tanda database yang tidak
menggunakan nilai, berikan nama tanda yang diikuti dengan tanda sama dengan (=).
REGION_ID: Region tempat instance ditempatkan—misalnya,
us-central1.
CLUSTER_ID: ID cluster tempat instance ditempatkan.
PROJECT_ID: ID project tempat cluster ditempatkan.
menjalani siklus pemeliharaan dengan waktu henti rendah atau nol, setelah Anda mengubah flag database.
Untuk melihat daftar flag yang saat ini ditetapkan secara manual untuk instance, jalankan perintah berikut:
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-25 UTC."],[[["\u003cp\u003eThis guide details how to add, modify, and delete database flags for instances within an AlloyDB for PostgreSQL cluster, which are used for various operational adjustments.\u003c/p\u003e\n"],["\u003cp\u003eDatabase flag modifications persist until removed or changed, and sometimes, setting one flag necessitates setting another for full functionality.\u003c/p\u003e\n"],["\u003cp\u003eApplying flag changes may trigger an instance restart, and users can choose between a "Low downtime" policy (recommended for production) or a "Force apply" policy (for faster updates, but with potential downtime and performance dips).\u003c/p\u003e\n"],["\u003cp\u003eThe "Low downtime" policy on primary instances results in minimal downtime (less than one second) and read pools experience zero downtime, while "Force apply" results in about one minute of downtime for both, with flag changes applying much faster.\u003c/p\u003e\n"],["\u003cp\u003eYou can manage database flags via the Google Cloud console or by using the \u003ccode\u003egcloud\u003c/code\u003e command-line tool, being cautious that \u003ccode\u003egcloud\u003c/code\u003e commands can reset unlisted flags to their default values.\u003c/p\u003e\n"]]],[],null,["# Configure an instance's database flags\n\nThis page describes how to add database flags for an instance, modify database\nflags, and delete database flags from an instance in an AlloyDB for PostgreSQL\ncluster.\n\nYou use database flags for many operations, including adjusting PostgreSQL\nparameters, adjusting options, and configuring and tuning an instance.\nModifications to a database flag's value persist for its\ninstance until you remove the flag or you modify its value again.\n\nIn some cases, setting one flag may require that you set another flag to\nfully enable the desired functionality.\n\nAfter you set, remove, or modify a flag for a database instance,\nAlloyDB might restart the instance. This depends upon the flag,\nas listed in\n[Supported database flags](https://cloud.google.com/alloydb/docs/reference/database-flags).\n\nWhen you modify a database flag in the primary or a read pool instance\nthat needs a restart, you can choose one of the following maintenance policies:\n\n- **Low downtime.** This policy is enabled by default. We recommend\n using this policy for all your production AlloyDB\n clusters because it minimizes application downtime.\n\n With the low downtime policy enabled, updating a flag that requires a\n restart on your cluster's primary instance has these effects:\n - The primary instance experiences less than one second of downtime\n for most workloads.\n\n - The flag on the primary instance finishes updating to its new value\n after about 15 minutes.\n\n Updating a flag that requires a restart on a read pool instance has\n these effects:\n - The read pool instance does not require any downtime.\n\n - The flag on the read pool instance finishes updating to its new\n value after about 10 minutes.\n\n- **Force apply.** To apply flag updates faster, use the `FORCE_APPLY`\n option with the `gcloud beta alloydb instances update` command.\n\n This policy is more appropriate for development environments, letting\n you quickly add or modify flags in exchange for longer instance\n downtime and a temporary decrease in database performance or\n throughput. Your cluster returns to peak performance several minutes\n after force applying a flag update.\n\n With the force apply policy enabled, updating a flag that requires a\n restart on your cluster's primary instance has these effects:\n - The primary instance experiences about one minute of downtime.\n\n - The flag on the primary instance finishes updating to its new value\n after one or two minutes.\n\n Updating a flag that requires a restart on a read pool instance has\n these effects:\n - The read pool instance experiences about one minute of downtime.\n\n - The flag on the read pool instance finishes updating to its new\n value after one or two minutes.\n\n\nBefore you begin\n----------------\n\n- The Google Cloud project you are using must have been [enabled to access AlloyDB](/alloydb/docs/project-enable-access).\n- You must have one of these IAM roles in the Google Cloud project you are using:\n - `roles/alloydb.admin` (the AlloyDB Admin predefined IAM role)\n - `roles/owner` (the Owner basic IAM role)\n - `roles/editor` (the Editor basic IAM role)\n\n If you don't have any of these roles, contact your Organization Administrator to request\n access.\n\n\u003cbr /\u003e\n\n### Console\n\n1. In the Google Cloud console, go to the **Clusters** page.\n\n [Go to Clusters](https://console.cloud.google.com/alloydb/clusters)\n2. Click a cluster in the **Resource Name** column.\n\n3. In the **Overview** page, go to **Instances in your cluster** ,\n select an instance, and then click **Edit**.\n\n4. Add, modify, or delete a database flag from your instance:\n\n **Add a flag**\n 1. To add a database flag to your instance, click **Add flag**.\n 2. Select a flag from the **New database flag** list.\n 3. Provide a value for the flag.\n 4. Click **Done**.\n\n **Modify a flag**\n 1. To modify a database flag present in your instance, expand the database flag and modify the value of the existing flag in the **Edit database flag** section.\n 2. Click **Done**.\n\n **Delete a flag**\n 1. To delete a database flag from your instance, select a flag and click the delete icon.\n 2. Click **Done**.\n5. Click **Update instance**.\n\n### gcloud\n\nUse the [`gcloud alloydb instances update`](/sdk/gcloud/reference/beta/alloydb/instances/update)\ncommand to change the database flags for an instance.\n**Caution:** Running the following command overwrites all database flags that are previously set. Any database flags that are not explicitly included in the `--database-flags` list are reset to its default value. To retain your instance's database flags while adding new flags, you must include both current and new flags in the `--database-flags` list. \n\n gcloud alloydb instances update \u003cvar translate=\"no\"\u003eINSTANCE_ID\u003c/var\u003e \\\n --database-flags \u003cvar translate=\"no\"\u003eFLAGS_LIST\u003c/var\u003e \\\n --region=\u003cvar translate=\"no\"\u003eREGION_ID\u003c/var\u003e \\\n --cluster=\u003cvar translate=\"no\"\u003eCLUSTER_ID\u003c/var\u003e \\\n --project=\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e\n\nTo apply flag updates more rapidly, include the argument\n`--update-mode=FORCE_APPLY`. Because this can temporarily decrease database\nperformance, avoid using this option in a production environment. \n\n gcloud beta alloydb instances update \u003cvar translate=\"no\"\u003eINSTANCE_ID\u003c/var\u003e \\\n --database-flags \u003cvar translate=\"no\"\u003eFLAGS_LIST\u003c/var\u003e \\\n --region=\u003cvar translate=\"no\"\u003eREGION_ID\u003c/var\u003e \\\n --cluster=\u003cvar translate=\"no\"\u003eCLUSTER_ID\u003c/var\u003e \\\n --project=\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e \\\n --update-mode=FORCE_APPLY\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eINSTANCE_ID\u003c/var\u003e: The ID of the instance.\n- \u003cvar translate=\"no\"\u003eFLAGS_LIST\u003c/var\u003e: A comma-separated list of one or more database flag specifications. Each specification consists of the name of the flag, an equals sign (=), and the value to assign to the flags. For database flags that do not take values, provide the name of the flag followed by an equals sign (=).\n- \u003cvar translate=\"no\"\u003eREGION_ID\u003c/var\u003e: The region where the instance is placed---for example, `us-central1`.\n- \u003cvar translate=\"no\"\u003eCLUSTER_ID\u003c/var\u003e: The ID of the cluster where the instance is placed.\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: The ID of the project where the cluster is placed. undergoing low or zero downtime maintenance cycle, after you modify database flags.\n\nTo see the list of an instance's current, manually-set flags, run the following\ncommand: \n\n gcloud alloydb instances describe \u003cvar translate=\"no\"\u003eINSTANCE_ID\u003c/var\u003e \\\n --region=\u003cvar translate=\"no\"\u003eREGION_ID\u003c/var\u003e \\\n --cluster=\u003cvar translate=\"no\"\u003eCLUSTER_ID\u003c/var\u003e \\\n --project=\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e"]]