Re:Re:Re: PostgreSQL14.2 can not start because of huge_page_size is equal to 1048576

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



on RHEL8.5 PostgreSQL 14.2 can enable non-default Hugepage size
the detail  result is : 

in the RHEL 8.X, PostgreSQL can use non-default hugepagesize, and in the RHEL 7.X, PostgreSQL can not use non-default hugepagesize!


so ,please modify pg documents(https://www.postgresql.org/docs/current/kernel-resources.html#LINUX-HUGE-PAGES),


the following is the  detail. 

[pg142@rhel85 data]$ cat /etc/redhat-release 

Red Hat Enterprise Linux release 8.5 (Ootpa)

[pg142@rhel85 data]$ uname -r

4.18.0-348.el8.x86_64

[pg142@rhel85 data]$ 


[pg142@rhel85 ~]$ grep ^Huge /proc/meminfo 

HugePages_Total:       0

HugePages_Free:        0

HugePages_Rsvd:        0

HugePages_Surp:        0

Hugepagesize:    1048576 kB    ----->>> OS default hugepagesize is 1GB

Hugetlb:               0 kB

[pg142@rhel85 ~]$ 


[pg142@rhel85 ~]$ head -1 $PGDATA/postmaster.pid

1679

[pg142@rhel85 ~]$ pmap 1679| awk '/rw-s/ && /zero/ {print $2}'

828480K

[pg142@rhel85 ~]$ 



(828480K+256*1024)/2048=533  ----->>>PostgreSQL uses 533 hugepages which size is 2MB


in the  /boot/grub2/grubenv file ,add: hugepagesz=2M hugepages=533


[root@rhel85 ~]# grub2-editenv - list | grep kernelopts

kernelopts=root=/dev/mapper/rhel-root ro crashkernel=auto resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet default_hugepagesz=1G

[root@rhel85 ~]# 


grub2-editenv - set "kernelopts=root=/dev/mapper/rhel-root ro crashkernel=auto resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet default_hugepagesz=1G hugepagesz=2M hugepages=533"


grub2-editenv - list | grep kernelopts


systemctl reboot


after OS reboot, we can see :


root@rhel85 ~]# hugeadm --pool-list

      Size  Minimum  Current  Maximum  Default

   2097152      533      533      533         

1073741824        0        0        0        *

[root@rhel85 ~]# 

[root@rhel85 ~]# cat /proc/meminfo |grep -i huge

AnonHugePages:     16384 kB

ShmemHugePages:        0 kB

FileHugePages:         0 kB

HugePages_Total:       0

HugePages_Free:        0

HugePages_Rsvd:        0

HugePages_Surp:        0

Hugepagesize:    1048576 kB

Hugetlb:         1091584 kB

[root@rhel85 ~]# 



then modify parameter  huge_page_size=2048 in the postgreSQL 14.2 postgresql.conf


[pg142@rhel85 data]$ grep huge_page_size postgresql.conf 

huge_page_size = 2048 # zero for system default

[pg142@rhel85 data]$ 

[pg142@rhel85 data]$ pg_ctl start

waiting for server to start....2022-05-13 21:26:24.051 CST [1694] LOG:  starting PostgreSQL 14.2 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-3), 64-bit

2022-05-13 21:26:24.051 CST [1694] LOG:  listening on IPv6 address "::1", port 5432

2022-05-13 21:26:24.051 CST [1694] LOG:  listening on IPv4 address "127.0.0.1", port 5432

2022-05-13 21:26:24.053 CST [1694] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"

2022-05-13 21:26:24.058 CST [1695] LOG:  database system was shut down at 2022-05-13 21:22:22 CST

2022-05-13 21:26:24.063 CST [1694] LOG:  database system is ready to accept connections

 done

server started

[pg142@rhel85 data]$ pg_ctl status

pg_ctl: server is running (PID: 1694)

/home/pg142/soft/bin/postgres

[pg142@rhel85 data]$ 

[pg142@rhel85 data]$ psql -d postgres

psql (14.2)

Type "help" for help.


postgres=# show huge_page_size;

 huge_page_size 

----------------

 2MB

(1 row)


postgres=# show huge_pages;

 huge_pages 

------------

 try

(1 row)


postgres=# 










At 2022-05-10 00:58:31, "yanliang lei" <msdnchina@xxxxxxx> wrote:

Thanks a lot for your reply!
Oh,I see!
I will test this case in the rhel8.5( RHEL 8.5  is the latest version of RHEL so far)
I will post my test result  through this email。




At 2022-05-10 00:27:14, "Tom Lane" <tgl@xxxxxxxxxxxxx> wrote: >"yanliang lei" <msdnchina@xxxxxxx> writes: >> The DETAIL message says " huge_page_size must be 0", but you did not set huge_page_size to 0. >> ---huge_page_size is the pg14 new parameter£¬The default value of this parameter is zero (0). When set to 0, the default huge page size on the system will be used. >> in the pg 14 documents---¡®Non-default settings are currently supported only on Linux.¡¯ so £¬ I want to try to find a method to let PostgreSQL 14 to use non-default hugepagesize£¬ > >The code that's throwing the error says > > /* Recent enough Linux only, for now. See GetHugePageSize(). */ > >I don't know what "recent enough" is in this context, but evidently >RHEL7 isn't it (no surprise considering that's a trailing-edge distro >at this point). > >I don't find it surprising that the authors of this feature didn't >try to document exactly which Linux versions it can be used on. >Keeping such documentation accurate would be a nightmare. > > regards, tom lane >


 



 


[Index of Archives]     [Postgresql Home]     [Postgresql General]     [Postgresql Performance]     [Postgresql PHP]     [Postgresql Jobs]     [PHP Users]     [PHP Databases]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Forum]

  Powered by Linux