[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-05。"],[],[],null,["# Set up AlloyDB Omni for production\n\nSelect a documentation version: 16.8.0keyboard_arrow_down\n\n- [Current (16.8.0)](/alloydb/omni/current/docs/configure-omni)\n- [16.8.0](/alloydb/omni/16.8.0/docs/configure-omni)\n- [16.3.0](/alloydb/omni/16.3.0/docs/configure-omni)\n- [15.12.0](/alloydb/omni/15.12.0/docs/configure-omni)\n- [15.7.1](/alloydb/omni/15.7.1/docs/configure-omni)\n- [15.7.0](/alloydb/omni/15.7.0/docs/configure-omni)\n- [15.5.5](/alloydb/omni/15.5.5/docs/configure-omni)\n- [15.5.4](/alloydb/omni/15.5.4/docs/configure-omni)\n- [15.5.2](/alloydb/omni/15.5.2/docs/configure-omni)\n\n\u003cbr /\u003e\n\nThis page shows common settings when using AlloyDB Omni for production workloads.\n\n\u003cbr /\u003e\n\nEnable huge pages\n-----------------\n\nAlloyDB Omni, just like PostgreSQL, supports the use of huge pages. This requires your machine to have huge pages enabled, and you also need to enable a database setting `huge_pages`.\n\n1. Run the provided script to enable huge pages on your machine:\n\n ### Docker\n\n ```\n docker run --rm --privileged google/alloydbomni setup-host\n ```\n\n ### Docker\n\n ```\n docker run --rm --privileged google/alloydbomni setup-host\n ```\n\n ### Podman\n\n ```\n podman run --rm --privileged google/alloydbomni setup-host\n ```\n\n ### Podman\n\n ```\n podman run --rm --privileged google/alloydbomni setup-host\n ```\n2. Add the following line to your `postgresql.conf` to enable huge pages:\n\n huge_pages=on\n\nEnable swapping\n---------------\n\nSwapping in the operating system allows to extend available physical memory by moving inactive memory pages between random access memory (RAM) and the hard disk to free up RAM space for active processes. AlloyDB Omni uses swapping when it is under high load and requires extra memory.\n\nTo check how much swapping space is enabled on your system, run the following: \n\n cat /proc/meminfo | grep SwapTotal\n\nThe output looks similar to the following: \n\n SwapTotal: 165748732 kB\n\nTo enable swapping on your operating system if the output value is `0`, see the following:\n\n- [Debian](https://wiki.debian.org/Swap)\n- [Ubuntu](https://help.ubuntu.com/community/SwapFaq)\n- [Red Hat Enterprise Linux 9](https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html/managing_storage_devices/getting-started-with-swap_managing-storage-devices#creating-an-lvm2-logical-volume-for-swap_getting-started-with-swap)\n\nEnable core dumps\n-----------------\n\nIf AlloyDB Omni encounters an unrecoverable error and crashes, it is helpful to have a core dump for analysis. A core dump is a snapshot of the memory of the AlloyDB Omni process at the point of its crash.\n\nTo set up core dumps, set up `kernel.core_pattern` as follows:\n\n1. Use the `sysctl` command to configure run time kernel parameters.\n2. To set the `kernel.core_pattern` immediately, use:\n\n sysctl -w kernel.core_pattern=\"\u003cvar translate=\"no\"\u003eCORE_PATTERN\u003c/var\u003e\"\n\n Replace \u003cvar translate=\"no\"\u003eCORE_PATTERN\u003c/var\u003e with a core filename pattern such as \"%e-%t.core\".\n\n For more information on core filename patterns, see [How to set process core file names](https://access.redhat.com/solutions/901293#:%7E:text=an%20unknown%20key-,Resolution,-In%20current%20linux%22) for details.\n\n The [systemd-coredump handler](https://systemd.io/COREDUMP/) allows further configuration of your coredump settings. The tool is installed by default in RHEL. On Debian and Ubuntu systems, run `sudo apt install coredumpctl` to install the tool.\n\n When you start AlloyDB Omni, ensure that you pass the `--ulimit=core:-1:-1` argument in the `docker run` command: \n\n ### Docker\n\n ```\n docker run --name CONTAINER_NAME \\\n -e POSTGRES_PASSWORD=NEW_PASSWORD \\\n --ulimit=core:-1:-1 \\\n -p HOST_PORT:5432 -d google/alloydbomni\n ```\n\n ### Docker\n\n ```\n docker run --name CONTAINER_NAME \\\n -e POSTGRES_PASSWORD=NEW_PASSWORD \\\n --ulimit=core:-1:-1 \\\n -p HOST_PORT:5432 -d google/alloydbomni\n ```\n\n ### Podman\n\n ```\n podman run --name CONTAINER_NAME \\\n -e POSTGRES_PASSWORD=NEW_PASSWORD \\\n --ulimit=core:-1:-1 \\\n -p HOST_PORT:5432 -d google/alloydbomni\n ```\n\n ### Podman\n\n ```\n podman run --name CONTAINER_NAME \\\n -e POSTGRES_PASSWORD=NEW_PASSWORD \\\n --ulimit=core:-1:-1 \\\n -p HOST_PORT:5432 -d google/alloydbomni\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eCONTAINER_NAME\u003c/var\u003e: the name of a new AlloyDB Omni container---for example, `my-omni-1`.\n - \u003cvar translate=\"no\"\u003eNEW_PASSWORD\u003c/var\u003e: the password assigned to the new container's `postgres` user after the password creation.\n\nEnable internal logging\n-----------------------\n\nAlloyDB Omni provides more messages in addition to regular [PostgreSQL logs](https://www.postgresql.org/docs/current/runtime-config-logging.html). These messages are intended for AlloyDB for PostgreSQL support because of their technical nature. However, additional information can assist in the debugging of database issues.\n\nTo enable internal logging, complete these steps:\n\n1. Set the database parameter `enable_alloydb_internal_log` to `on`:\n\n ALTER SYSTEM SET enable_alloydb_internal_log=on;\n\n For more information about modifying AlloyDB Omni settings, see [Configure AlloyDB Omni database parameters](/alloydb/omni/16.8.0/docs/configure-database-flags).\n2. Restart to apply changes:\n\n ### Docker\n\n ```\n docker restart CONTAINER_NAME\n ```\n\n ### Docker\n\n ```\n docker restart CONTAINER_NAME\n ```\n\n ### Podman\n\n ```\n podman restart CONTAINER_NAME\n ```\n\n ### Podman\n\n ```\n podman restart CONTAINER_NAME\n ```\n\nTo customize internal logging such as configuring log file names and rotation policies further, use [PostgreSQL parameters](https://www.postgresql.org/docs/current/runtime-config-logging.html).\n\nFor example, the `log_directory` parameter specifies the directory where to save a log file and the `log_filename` parameter defines the name of the individual log file.\n\nAlloyDB Omni combines the `log_directory` and `log_filename` parameters and saves internal logs as follows: \n\n \u003cvar translate=\"no\"\u003eLOG_DIRECTORY\u003c/var\u003e/\u003cvar translate=\"no\"\u003eLOG_FILENAME\u003c/var\u003e.internal\n\nSet up systemd units to run operations automatically\n----------------------------------------------------\n\nIf you run AlloyDB Omni on a dedicated server, then you may want to configure certain operations to start automatically when the server boots up. One way to do this is through `systemd` units.\n\nFor example, the following steps configure `systemd` so that huge pages are enabled automatically whenever the server boots up.\n\n1. Create a file in `/etc/systemd/system/alloydb-setup-env.service`:\n\n [Unit]\n Description=Setup huge pages for AlloyDB Omni\n\n [Service]\n Type=oneshot\n\n ExecStart=/usr/bin/docker run --rm --privileged google/alloydbomni setup-host\n\n [Install]\n WantedBy=multi-user.target\n\n2. Enable the service as follows:\n\n sudo systemctl enable alloydb-setup-env.service\n\nWhat's next\n-----------\n\n- [Run and connect to AlloyDB Omni](/alloydb/omni/16.8.0/docs/run-connect)\n\n- [Manage AlloyDB Omni](/alloydb/omni/16.8.0/docs/manage)\n\n- [Create a read-only replica](/alloydb/omni/16.8.0/docs/set-up-read-replica)\n\n- [Manage backup and restore](/alloydb/omni/16.8.0/docs/backup-kubernetes)\n\n- [Create read pool instance in Kubernetes](/alloydb/omni/16.8.0/docs/kubernetes-read-pool)\n\n- [Use a sidecar container in Kubernetes](/alloydb/omni/16.8.0/docs/kubernetes-sidecar-container)"]]