ulimit 参数用于指定 Docker 容器可以使用的各种进程限制。为了实现最佳性能,AlloyDB Omni 会调整进程优先级,以便关键 PostgreSQL 进程能够以更高的优先级运行,也就是说,可分配给进程的可用 CPU 更多。如需允许这种情况,请指定 -20:-20,这会去除对 AlloyDB Omni 容器的限制。
[[["易于理解","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-04。"],[[["\u003cp\u003eAlloyDB Omni is deployed via a Docker image and requires a container runtime like Docker or Podman to be installed on your machine.\u003c/p\u003e\n"],["\u003cp\u003eRecommended configurations for AlloyDB Omni include having an x86-64 or Arm CPU with AVX2 support, 8GB of RAM per allocated CPU, and at least 20GB of disk space, with specific OS and software version recommendations for Linux and macOS.\u003c/p\u003e\n"],["\u003cp\u003eFor better data management, mount an external data directory using the \u003ccode\u003e-v\u003c/code\u003e flag in the \u003ccode\u003edocker run\u003c/code\u003e command, mapping the host's file system path to the container's data directory.\u003c/p\u003e\n"],["\u003cp\u003eTo ensure optimal performance, configure the Docker container to allow higher process priorities for PostgreSQL by specifying \u003ccode\u003e--ulimit=nice=-20:-20\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eWhen utilizing the columnar engine, it is recommended to make shared memory available to the container by mounting \u003ccode\u003e/dev/shm\u003c/code\u003e in Linux or using the \u003ccode\u003e--shm-size\u003c/code\u003e flag in macOS, adjusting the shared memory size based on the \u003ccode\u003egoogle_job_scheduler.max_parallel_workers_per_job\u003c/code\u003e flag.\u003c/p\u003e\n"]]],[],null,["# Customize your AlloyDB Omni installation\n\nSelect a documentation version: 15.5.4keyboard_arrow_down\n\n- [Current (16.8.0)](/alloydb/omni/current/docs/install)\n- [16.8.0](/alloydb/omni/16.8.0/docs/install)\n- [16.3.0](/alloydb/omni/16.3.0/docs/install)\n- [15.12.0](/alloydb/omni/15.12.0/docs/install)\n- [15.7.1](/alloydb/omni/15.7.1/docs/install)\n- [15.7.0](/alloydb/omni/15.7.0/docs/install)\n- [15.5.5](/alloydb/omni/15.5.5/docs/install)\n- [15.5.4](/alloydb/omni/15.5.4/docs/install)\n- [15.5.2](/alloydb/omni/15.5.2/docs/install)\n\n\u003cbr /\u003e\n\n| **Note:** Your use of AlloyDB Omni is subject to the agreement between you and Google that governs Google Cloud offerings. If you do not have a Google Cloud account, or have not otherwise entered into an agreement with Google that governs Google Cloud offerings, please do not proceed or download this software until you have done so. To create a Google Cloud account, see [the Google Cloud homepage](/docs/get-started).\n\n\u003cbr /\u003e\n\nAlloyDB Omni is deployed through a Docker image, which allows different forms of customization.\nThis page shows some of the common customizations that are used.\n\nTo get started quickly\nwith AlloyDB Omni using the default configuration, see\n[Quickstart: AlloyDB Omni](/alloydb/omni/15.5.4/docs/quickstart).\n\nBefore you begin\n----------------\n\nThe following table lists recommended hardware and software configuration for AlloyDB Omni.\n\nAlloyDB Omni runs in a container. Install a container runtime like [Docker](https://docs.docker.com/engine/install/) or [Podman](https://podman.io/docs/installation) on your machine before installing AlloyDB Omni. \n\n### Single-server\n\nMount an external data directory\n--------------------------------\n\nBy default, the command in the [Quickstart: Install AlloyDB Omni](/alloydb/omni/15.5.4/docs/quickstart) stores the database data in an area managed by Docker. This is convenient for getting started but makes it difficult to find and use the data directory. Instead, you can set up a bind mount to map the data directory to a known location on your disk. \n\n docker run --name \u003cvar translate=\"no\"\u003eCONTAINER_NAME\u003c/var\u003e \\\n -e POSTGRES_PASSWORD=\u003cvar translate=\"no\"\u003eNEW_PASSWORD\u003c/var\u003e \\\n -v \u003cvar translate=\"no\"\u003eDATA_DIR\u003c/var\u003e:/var/lib/postgresql/data \\\n -p \u003cvar translate=\"no\"\u003eHOST_PORT\u003c/var\u003e:5432 -d google/alloydbomni:15.5.4\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eCONTAINER_NAME\u003c/var\u003e: The name to assign this new AlloyDB Omni container in your host machine's container registry---for example, `my-omni`.\n\n- \u003cvar translate=\"no\"\u003eNEW_PASSWORD\u003c/var\u003e: The password assigned the new container's `postgres` user after its creation.\n\n- \u003cvar translate=\"no\"\u003eDATA_DIR\u003c/var\u003e: The file system path that you want AlloyDB Omni to use for its data directory.\n\n- \u003cvar translate=\"no\"\u003eHOST_PORT\u003c/var\u003e: The TCP port on the host machine that the container should publish its own port 5432 to. To use the PostgreSQL default port on the host machine as well, specify `5432`.\n\nEnable ulimits\n--------------\n\nThe [ulimit](https://tldp.org/LDP/solrhe/Securing-Optimizing-Linux-RH-Edition-v1.3/x4733.html) parameters specify various process limits that the Docker container is allowed to use. For optimal performance, AlloyDB Omni adjusts process priorities to allow critical PostgreSQL processes to run with higher priority, that is they get a bigger allocation of available CPUs. To allow this, specify `-20:-20`, which removes limitations for the AlloyDB Omni container. \n\n docker run --name \u003cvar translate=\"no\"\u003eCONTAINER_NAME\u003c/var\u003e \\\n -e POSTGRES_PASSWORD=\u003cvar translate=\"no\"\u003eNEW_PASSWORD\u003c/var\u003e \\\n --ulimit=nice=-20:-20 \\\n -p \u003cvar translate=\"no\"\u003eHOST_PORT\u003c/var\u003e:5432 -d google/alloydbomni:15.5.4\n\nSpecify a logging driver\n------------------------\n\nBy default, Docker does not perform log rotations. This can use up a lot of disk space, and eventually lead to disk space exhaustion. You can configure Docker to use a different logging driver. For example, to log to journald: \n\n docker run --name \u003cvar translate=\"no\"\u003eCONTAINER_NAME\u003c/var\u003e \\\n -e POSTGRES_PASSWORD=\u003cvar translate=\"no\"\u003eNEW_PASSWORD\u003c/var\u003e \\\n --log-driver=journald \\\n -p \u003cvar translate=\"no\"\u003eHOST_PORT\u003c/var\u003e:5432 -d google/alloydbomni:15.5.4\n\nFor more information about Docker and logging drivers, refer to Docker's documentation [Configure logging drivers](https://docs.docker.com/config/containers/logging/configure/).\n\nYou can also configure logging using PostgreSQL. For more information, refer to PostgreSQL documentation [Error reporting and logging](https://www.postgresql.org/docs/15/runtime-config-logging.html).\n\nMount a shared memory volume\n----------------------------\n\nIf you plan to use the AlloyDB [columnar engine](/alloydb/omni/15.5.4/docs/columnar-engine/configure)\nwith AlloyDB Omni, we recommend making shared memory\navailable to the AlloyDB Omni container. The method for doing\nthis differs depending upon your host operating system, as shown in the\nfollowing examples. \n\n### Linux\n\nTo make shared memory available to the container, mount `/dev/shm`: \n\n docker run --name \u003cvar translate=\"no\"\u003eCONTAINER_NAME\u003c/var\u003e \\\n -e POSTGRES_PASSWORD=\u003cvar translate=\"no\"\u003eNEW_PASSWORD\u003c/var\u003e \\\n -p \u003cvar translate=\"no\"\u003eHOST_PORT\u003c/var\u003e:5432 \\\n -v /dev/shm:/dev/shm \\\n -d google/alloydbomni:15.5.4\n\n### macOS\n\nTo make shared memory available to the container, include the `--shm-size` flag: \n\n docker run --name \u003cvar translate=\"no\"\u003eCONTAINER_NAME\u003c/var\u003e \\\n -e POSTGRES_PASSWORD=\u003cvar translate=\"no\"\u003eNEW_PASSWORD\u003c/var\u003e \\\n -p \u003cvar translate=\"no\"\u003eHOST_PORT\u003c/var\u003e:5432 \\\n --shm-size=\u003cvar translate=\"no\"\u003eSHARED_MEMORY_SIZE\u003c/var\u003e \\\n -d google/alloydbomni:15.5.4\n\nReplace \u003cvar translate=\"no\"\u003eSHARED_MEMORY_SIZE\u003c/var\u003e with the size to set for `/dev/shm` on the\ncontainer, in the format described on [Running containers](https://docs.docker.com/engine/reference/run/).\nFor example, to specify one gigabyte, use the value `1g`.\n\nWe recommend setting the shared memory size to a number of megabytes equal to\nat least your database's value of [the `google_job_scheduler.max_parallel_workers_per_job`\nflag](/alloydb/docs/reference/columnar-engine-flags#max-parallel-workers-per-job), times 250. For more information\nabout the columnar engine, see [Configure the columnar engine in AlloyDB Omni](/alloydb/omni/15.5.4/docs/columnar-engine/configure).\n\nFor example, if the `google_job_scheduler.max_parallel_workers_per_job` database\nflag is set to its default value of `2`, consider adding a flag of `--shm-size=500m` or greater when starting your database server.\n\nFor more information about the `--shm-size` flag, see [Running containers](https://docs.docker.com/engine/reference/run/)."]]