In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the "postgresql installation process kernel resource configuration details", in daily operation, I believe many people in the postgresql installation process kernel resource configuration details on the question of doubt, small editor consulted all kinds of information, sorted out simple and easy to use operation method, hope to answer the "postgresql installation process kernel resource configuration details" doubts helpful! Next, please follow the small series to learn together!
Shared Memory and Semaphores
Modify the/etc/sysctl.conf file. Linux generally only needs to modify the following two parameters. The kernel.shmmax value is the same as shared_buffers, which is generally set to 40% of physical memory. The default values of other parameters are very large and usually do not need to be changed.
kernel.shmmax=XXX
kernel.shmall=XX
SHMMAX: Maximum size of shared memory segment in bytes
SHMALL: The total number of available shared memory, if the unit is bytes, the value is the same as SHMMAX, if the unit is pages, the value is equal to SHMMAX/PAGE_SIZE.
Linux How to view Block size
tune2fs -l /dev/sda1 |grep 'Block size'
How to view Page size in linux
getconf PAGESIZE
2、systemd RemoveIPC
Modify the/etc/systemd/logind.conf file and add RemoveIPC=no
In RHEL 7.2, the systemd-logind service introduced a new feature: remove all IPC objects for a user after the user has completely exited OS. Except for system users. The System User is determined by the SYS_UID_MAX setting in/etc/login.defs. This feature is controlled by the RemoveIPC option in the/etc/systemd/logind.conf parameter file.
3. Resource Limits
Modify the/etc/security/limits.conf file, mainly to limit the number of processes per user and the number of files opened by each process, as follows
postgres soft nproc 2047
postgres hard nproc 16384
postgres soft nofile 1024
postgres hard nofile 65536
Linux Memory Overcommit
Modify the/etc/sysctl.conf file and add vm.overcommit_memory=2
Linux responds "yes" to most requests for memory so that it can run more and larger programs. Because after applying for memory, it will not use memory immediately. This technique is called Overcommit. OOM killer(OOM=out-of-memory) occurs when Linux finds that it is out of memory. It chooses to kill some processes (user-mode processes, not kernel threads) in order to free up memory.
In Linux 2.4 and later, the default virtual memory behavior is not optimal for PostgreSQL. Because of the way the kernel implements memory overcommit, if the memory requirements of PostgreSQL or other processes cause the system to run out of virtual memory, the kernel may terminate the PostgreSQL postmaster(master server process). If memory is tight, increasing the swap space of the operating system can help avoid this problem, because the out-of- memory (OOM) killer is only invoked when physical memory and swap space are exhausted. If PostgreSQL itself is causing the system to run out of memory, you can avoid this problem by changing the configuration. It is best to reduce max_connections and use external connection pooling software instead. On Linux 2.6 and later, you can modify the kernel behavior sysctl -w vm.overcommit_memory=2.
Overcommit_memory Optional values: 0, 1, 2.
0, indicates that the kernel will check whether there is enough memory available for the application process to use; if there is enough memory available, the memory request is allowed; otherwise, the memory request fails and an error is returned to the application process.
1 indicates that the kernel allows all physical memory to be allocated regardless of the current memory state.
2, indicates that the kernel allows more memory allocation than the sum of all physical memory and swap space
5. Large Pages of Memory Linux
If the system supports large page memory, modify the/etc/sysctl.conf file and add vm.nr_hugepages=XX to enable large page memory.
The default behavior of PostgreSQL's large pages of memory is to use them as much as possible and fall back to normal pages on failure. To force large pages of memory, set huge_pages to on in postgresql. conf.
Check if memory supports large page memory, cat /proc/meminfo Check if PageTables, HugePages_Total, HugePagesize, HugePages_Free, HugePages_Rsvd, etc. If not, you need kernel configuration CONFIG_HUGETLBFS=y, CONFIG_HUGETLB_PAGE=y Support large memory pages
How to determine the vm.nr_hugepages value
$ head -1 $PGDATA/postmaster.pid
4170
$ pmap 4170 | awk '/rw-s/ && /zero/ {print $2}'
6490428K
$ grep ^Hugepagesize /proc/meminfo
Hugepagesize: 2048 kB
Above 6490428/2048=3170, so edit/etc/sysctl.conf file to modify vm.nr_hugepages=3170
Oracle's algorithm
# grep Hugepagesize /proc/meminfo
For example, if /proc/meminfo lists the large page size as 2 MB, and the total SGA size for the instance is 1.6 GB, then set the value for the vm.nr_hugepages kernel parameter to 820 (1.6 GB / 2 MB = 819.2).
At this point, about "postgresql installation process kernel resource configuration details" learning is over, I hope to solve everyone's doubts. Theory and practice can better match to help everyone learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.