{"id":352,"date":"2024-09-27T10:07:49","date_gmt":"2024-09-27T10:07:49","guid":{"rendered":"https:\/\/stradata.com.tr\/?p=352"},"modified":"2024-09-30T06:52:05","modified_gmt":"2024-09-30T06:52:05","slug":"postgresql-major-upgrade-yontemleri","status":"publish","type":"post","link":"https:\/\/stradata.com.tr\/?p=352","title":{"rendered":"PostgreSQL Maj\u00f6r Upgrade Y\u00f6ntemleri"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">PostgreSQL veri tabanlar\u0131n\u0131zda maj\u00f6r versiyon y\u00fckseltmesi yapman\u0131z i\u00e7in 3 farkl\u0131 y\u00f6ntem mevcut. Bunlar :<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>pg_dumpall <\/strong>ile t\u00fcm verinin hedef versiyonda yarat\u0131lm\u0131\u015f bir veritaban\u0131 cluster&#8217;\u0131na ta\u015f\u0131nmas\u0131<\/li>\n\n\n\n<li><strong>pg_upgrade <\/strong>ile system tablolar\u0131n\u0131n yenilenmesi ve kullan\u0131c\u0131 verilerinin oldu\u011fu gibi kullan\u0131lmas\u0131<\/li>\n\n\n\n<li><strong>Logical replication<\/strong> ile t\u00fcm verinin standby ortamda yeni versiyona ta\u015f\u0131nmas\u0131 ve switch-over ile rol de\u011fi\u015fimi yap\u0131lmas\u0131.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Bu y\u00f6ntemlerin avantaj\/dezavantajlar\u0131 anlam\u0131nda h\u0131zl\u0131ca \u00fczerlerinden ge\u00e7elim. <strong>pg_dumpall <\/strong>ile upgrade yapmak t\u00fcm veriyi kopyalamak anlam\u0131na geldi\u011fi i\u00e7in veri taban\u0131 boyutu b\u00fcy\u00fcd\u00fck\u00e7e uygulanabilirli\u011fi azal\u0131r. Boyut b\u00fcy\u00fcd\u00fck\u00e7e kesinti s\u00fcresi ve veri aktar\u0131m\u0131nda hata ihtimali artacakt\u0131r. Ayr\u0131ca upgrade i\u015flemi i\u00e7in ihtiyac\u0131m\u0131z olacak disk alan\u0131 da bir sorun haline gelebilir. Avantaj olarak ise eski versiyondaki cluster verilerinin \u00fczerine yaz\u0131lmamas\u0131ndan dolay\u0131 i\u015flemin tehlikesiz olmas\u0131ndan, ayr\u0131ca veri tabanlar\u0131ndaki t\u00fcm objelerin yeniden yarat\u0131lmas\u0131 ile <strong>fragmantasyon <\/strong>ve <strong>&#8220;index bloat&#8221;<\/strong> gibi sorunlar\u0131n giderilmesinden bahsedebiliriz. Ayr\u0131ca data export ve import i\u015flemlerini a\u015fa\u011f\u0131daki \u00f6rnekteki gibi tek bir komutla yaparak upgrade i\u015flemimizi h\u0131zland\u0131rma opsiyonumuz da bulunmaktad\u0131r.<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>$ pg_dumpall -p 5432 | psql -d postgres -p 5433<\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Bu y\u00f6ntem ile upgrade ad\u0131mlar\u0131n\u0131 <a href=\"https:\/\/www.postgresql.org\/docs\/current\/upgrading.html#UPGRADING-VIA-PGDUMPALL\">PostgreSQL d\u00f6k\u00fcmantasyonundan<\/a> inceleyebilirsiniz: <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>pg_upgrade <\/strong>ise b\u00fcy\u00fck boyutlarda i\u015fimizi kolayla\u015ft\u0131racak bir y\u00f6ntemdir. pg_upgrade&#8217;in sundu\u011fu<strong> &#8220;&#8211;link&#8221; <\/strong>se\u00e7ene\u011fi ile verinin ta\u015f\u0131nmas\u0131na gerek kalmadan mevcut data file&#8217;lar, \u00fczerinde <strong>&#8220;hard link&#8221; <\/strong>olu\u015fturarak kullan\u0131labilir. (Bu arada, varsay\u0131lan ayarlarda \u00e7al\u0131\u015ft\u0131r\u0131l\u0131rsa pg_upgrade veri taban\u0131 dosyalar\u0131n\u0131 eski versiyondaki data dizininden yeni versiyondaki data dizinine kopyalar) Link y\u00f6nteminde eski versiyon cluster, upgrade i\u015fleminden sonra yeniden sa\u011fl\u0131kl\u0131 bir \u015fekilde a\u00e7\u0131lamayacakt\u0131r, bunun i\u00e7in upgrade \u00f6ncesinde veri tabanlar\u0131n\u0131n yede\u011finin al\u0131nmas\u0131 \u00f6nemlidir. Bir di\u011fer \u00f6nemli nokta link modunda upgrade yapabilmemiz i\u00e7in eski ve yeni cluster&#8217;\u0131n data dizinlerinin <strong>ayn\u0131 filesystem \u00fczerinde<\/strong> olmas\u0131 gerekti\u011fidir. pg_upgrade&#8217;in<strong> &#8220;&#8211;check&#8221;<\/strong> opsiyonu ile upgrade i\u015flemini yapmadan \u00f6nce kontrolleri ger\u00e7ekle\u015ftirmek de m\u00fcmk\u00fcnd\u00fcr. Yine<a href=\"https:\/\/www.postgresql.org\/docs\/current\/pgupgrade.html\"> PostgreSQL resmi d\u00f6k\u00fcmantasyonunda<\/a> daha detayl\u0131 bilgi bulabilirsiniz.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00dc\u00e7\u00fcnc\u00fc y\u00f6ntem ise<strong> &#8220;logical replication&#8221; <\/strong>konfig\u00fcresyonunun farkl\u0131 versiyonlarda (primary\/standby) \u00e7al\u0131\u015fabilme avantaj\u0131n\u0131 kullanarak, yine b\u00fcy\u00fck boyuttaki veri tabanlar\u0131n\u0131n upgrade s\u00fcresini minimalde tutmak i\u00e7in tercih edebilece\u011fimiz bir se\u00e7enektir. Standby veri taban\u0131m\u0131z\u0131 ister primary ile ayn\u0131 sunucuda ister farkl\u0131 bir sunucuda ve hedef PostgreSQL versiyonunda kurup replikasyon konfig\u00fcrasyonunu tamamlad\u0131ktan sonra, veri tabanlar\u0131 senkron iken <strong>switch-over<\/strong> i\u015flemini yaparak k\u0131sa s\u00fcrede upgrade i\u015flemini tamamlam\u0131\u015f olabiliriz. <a href=\"https:\/\/www.postgresql.org\/docs\/current\/logical-replication.html\">Detaylar i\u00e7in<\/a> <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">PostgreSQL major upgrade kapsam\u0131nda bu \u00fc\u00e7 y\u00f6ntemi inceledikten sonra, <strong>Ubuntu\/Debian<\/strong> ortamlarda i\u015fimizi kolayla\u015ft\u0131ran <strong>&#8220;pg_upgradecluster&#8221;<\/strong> dan da bahsedece\u011fiz.<strong> &#8220;postgresql-common&#8221; <\/strong>paketi ile birlikte gelen bu program PostrgeSQL cluster&#8217;\u0131n yeni versiyona upgrade i\u015flemini tek komut ile yaparken, eski versiyonun konfig\u00fcrasyon dosyalar\u0131 da yeni versiyon cluster&#8217;a uygun \u015fekilde ayarlanarak kopyalan\u0131r. &#8220;pg_upgradecluster&#8221; kullan\u0131rken, upgrade y\u00f6ntemi i\u00e7in pg_dump&#8217;\u0131 ya da pg_upgrade&#8217;i se\u00e7ebiliyoruz.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">-m, &#8211;method=dump|upgrade|link|clone<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>&#8220;dump&#8221;<\/strong> se\u00e7ene\u011fi pg_dump ve pg_restore kullan\u0131rken,<strong> &#8220;upgrade&#8221;<\/strong> se\u00e7ene\u011fi pg_upgrade kullan\u0131r, varsay\u0131lan de\u011fer &#8220;dump&#8221;t\u0131r.<br><strong>&#8220;link&#8221;<\/strong> se\u00e7ene\u011fi &#8220;upgrade &#8211;link&#8221; i\u00e7in k\u0131sayoldur ve pg_upgrade &#8216;i link opsiyonu ile birlikte kullan\u0131r.<br><strong>&#8220;clone&#8221;<\/strong> ise yine &#8220;upgrade &#8211;clone&#8221; i\u00e7in k\u0131sayoldur ve pg_upgrade &#8216;i clone opsiyonu ile birlikte kullan\u0131r.<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">Daha \u00f6nce bahsetmedi\u011fimiz <strong>&#8220;pg_upgrade &#8211;clone&#8221; <\/strong>se\u00e7ene\u011fi sadece belirli filesystem&#8217;lerin destekledi\u011fi bir opsiyondur ve upgade s\u0131ras\u0131nda eski cluster&#8217;daki dosyalar\u0131n bir klonunu yeni cluster&#8217;da hard link y\u00f6ntemindeki gibi h\u0131zl\u0131 bir \u015fekilde olu\u015ftururken, hard link&#8217;ten farkl\u0131 olarak eski dosyalar\u0131n orjinal bloklar\u0131n\u0131 saklayarak eski cluster&#8217;\u0131 a\u00e7\u0131labilir k\u0131lar. <strong>&#8220;reflink&#8221;<\/strong> olarak da bilinen bu y\u00f6ntem asl\u0131nda iki farkl\u0131 dosyan\u0131n ortak veri bloklar\u0131n\u0131 kullanmas\u0131n\u0131 sa\u011flayan bir filesystem \u00f6zelli\u011fidir.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">pg_upgradecluster &#8216;\u0131n <a href=\"https:\/\/manpages.debian.org\/testing\/postgresql-common\/pg_upgradecluster.1.en.html\">man sayfas\u0131nda<\/a> daha fazla bilgi bulabilir ve komut opsiyonlar\u0131n\u0131 inceleyebilirsiniz.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u015eimdi PostgreSQL 16 versiyonundaki cluster&#8217;\u0131m\u0131z\u0131 17 versiyonuna pg_upgradecluster ile upgrade etme ad\u0131mlar\u0131n\u0131n \u00fczerinden ge\u00e7elim. \u00d6rne\u011fimizde iki tane 16 versiyonunda cluster \u00e7al\u0131\u015fmakta ve bunlardan birini 17 versiyonuna upgrade edece\u011fiz.<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code># pg_lsclusters\nVer Cluster Port Status Owner    Data directory              Log file\n16  main    5432 online postgres \/var\/lib\/postgresql\/16\/main \/var\/log\/postgresql\/postgresql-16-main.log\n16  test    5433 online postgres \/var\/lib\/postgresql\/16\/test \/var\/log\/postgresql\/postgresql-16-test.log<\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">\u00d6ncelikle sunucumuza yeni versiyon PostgreSQL kurulumunu yap\u0131yoruz.<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code># sudo apt-get upgrade\n# wget --quiet -O - https:\/\/www.postgresql.org\/media\/keys\/ACCC4CF8.asc | sudo apt-key add -\n# sudo sh -c &#39;echo &quot;deb http:\/\/apt.postgresql.org\/pub\/repos\/apt\/ `lsb_release -cs`-pgdg main&quot; &gt;&gt; \/etc\/apt\/sources.list.d\/pgdg.list&#39;\n# sudo apt-get  install postgresql-17 postgresql-client-17<\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Yeni versiyonun kurulumu ile birlikte &#8220;main&#8221; isminde yeni bir cluster da otomatik olarak ba\u015flat\u0131ld\u0131. Bu cluster&#8217;\u0131 kullanmayaca\u011f\u0131m\u0131z i\u00e7in siliyoruz.<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code># pg_lsclusters\nVer Cluster Port Status Owner    Data directory              Log file\n16  main    5432 online postgres \/var\/lib\/postgresql\/16\/main \/var\/log\/postgresql\/postgresql-16-main.log\n16  test    5433 online postgres \/var\/lib\/postgresql\/16\/test \/var\/log\/postgresql\/postgresql-16-test.log\n17  main    5434 online postgres \/var\/lib\/postgresql\/17\/main \/var\/log\/postgresql\/postgresql-17-main.log\n\n# pg_dropcluster --stop 17 main\n\n# pg_lsclusters\nVer Cluster Port Status Owner    Data directory              Log file\n16  main    5432 online postgres \/var\/lib\/postgresql\/16\/main \/var\/log\/postgresql\/postgresql-16-main.log\n16  test    5433 online postgres \/var\/lib\/postgresql\/16\/test \/var\/log\/postgresql\/postgresql-16-test.log\n<\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">\u015eimdi pg_upgradecluster komutunu varsay\u0131lan ayarlar\u0131 ile kullanarak &#8220;test&#8221; ismindeki cluster&#8217;\u0131 17 versiyonuna g\u00fcncelliyoruz. Bu i\u015flem 17 versiyonunda &#8220;test&#8221; isimli bir cluster yaratacak ve pg_dump kullanarak verileri yeni cluster&#8217;a ta\u015f\u0131yacak. Ayn\u0131 zamanda konfig\u00fcrasyon dosyalar\u0131n\u0131 ta\u015f\u0131yacak ve 16 versiyonundaki eski cluster&#8217;\u0131n port numaras\u0131n\u0131 da de\u011fi\u015ftirecektir.<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code># pg_upgradecluster 16 test\n\n\tStopping old cluster...\n\tRestarting old cluster with restricted connections...\n\tNotice: extra pg_ctl\/postgres options given, bypassing systemctl for start operation\n\tCreating new PostgreSQL cluster 17\/test ...\n\t\/usr\/lib\/postgresql\/17\/bin\/initdb -D \/var\/lib\/postgresql\/17\/test --auth-local peer --auth-host scram-sha-256 --no-instructions --encoding UTF8 --lc-collate en_US.UTF-8 --lc-ctype en_US.UTF-8 --locale-provider libc\n\tThe files belonging to this database system will be owned by user &quot;postgres&quot;.\n\tThis user must also own the server process.\n\n\tThe database cluster will be initialized with locale &quot;en_US.UTF-8&quot;.\n\tThe default text search configuration will be set to &quot;english&quot;.\n\n\tData page checksums are disabled.\n\n\tfixing permissions on existing directory \/var\/lib\/postgresql\/17\/test ... ok\n\tcreating subdirectories ... ok\n\tselecting dynamic shared memory implementation ... posix\n\tselecting default &quot;max_connections&quot; ... 100\n\tselecting default &quot;shared_buffers&quot; ... 128MB\n\tselecting default time zone ... Etc\/UTC\n\tcreating configuration files ... ok\n\trunning bootstrap script ... ok\n\tperforming post-bootstrap initialization ... ok\n\tsyncing data to disk ... ok\n\n\tCopying old configuration files...\n\tCopying old start.conf...\n\tCopying old pg_ctl.conf...\n\tStarting new cluster...\n\tNotice: extra pg_ctl\/postgres options given, bypassing systemctl for start operation\n\tRunning init phase upgrade hook scripts ...\n\n\tRoles, databases, schemas, ACLs...\n\t set_config\n\t------------\n\n\t(1 row)\n\n\t set_config\n\t------------\n\n\t(1 row)\n\n\tFixing hardcoded library paths for stored procedures...\n\tUpgrading database postgres...\n\tFixing hardcoded library paths for stored procedures...\n\tUpgrading database template1...\n\tStopping target cluster...\n\tStopping old cluster...\n\tDisabling automatic startup of old cluster...\n\tStarting upgraded cluster on port 5433...\n\tRunning finish phase upgrade hook scripts ...\n\tvacuumdb: processing database &quot;postgres&quot;: Generating minimal optimizer statistics (1 target)\n\tvacuumdb: processing database &quot;template1&quot;: Generating minimal optimizer statistics (1 target)\n\tvacuumdb: processing database &quot;postgres&quot;: Generating medium optimizer statistics (10 targets)\n\tvacuumdb: processing database &quot;template1&quot;: Generating medium optimizer statistics (10 targets)\n\tvacuumdb: processing database &quot;postgres&quot;: Generating default (full) optimizer statistics\n\tvacuumdb: processing database &quot;template1&quot;: Generating default (full) optimizer statistics\n\n\tSuccess. Please check that the upgraded cluster works. If it does,\n\tyou can remove the old cluster with\n\t\tpg_dropcluster 16 test\n\n\tVer Cluster Port Status Owner    Data directory              Log file\n\t16  test    5434 down   postgres \/var\/lib\/postgresql\/16\/test \/var\/log\/postgresql\/postgresql-16-test.log\n\tVer Cluster Port Status Owner    Data directory              Log file\n\t17  test    5433 online postgres \/var\/lib\/postgresql\/17\/test \/var\/log\/postgresql\/postgresql-17-test.log\n\n\n# pg_lsclusters\nVer Cluster Port Status Owner    Data directory              Log file\n16  main    5432 online postgres \/var\/lib\/postgresql\/16\/main \/var\/log\/postgresql\/postgresql-16-main.log\n16  test    5434 down   postgres \/var\/lib\/postgresql\/16\/test \/var\/log\/postgresql\/postgresql-16-test.log\n17  test    5433 online postgres \/var\/lib\/postgresql\/17\/test \/var\/log\/postgresql\/postgresql-17-test.log<\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">\u015eimdi ise pg_upgradecluster \u00e7al\u0131\u015ft\u0131r\u0131rken &#8220;pg_upgrade &#8211;link&#8221; y\u00f6ntemini kullanal\u0131m. G\u00fcncelledi\u011fimiz cluster&#8217;\u0131 silerek, eski test cluster&#8217;\u0131m\u0131z\u0131 yeniden a\u00e7al\u0131m ve sonras\u0131nda pg_upgradecluster komutunu &#8220;link&#8221; y\u00f6ntemi ile ve &#8220;parallel&#8221;, &#8220;rename&#8221; opsiyonlar\u0131n\u0131 da deneyerek \u00e7al\u0131\u015ft\u0131ral\u0131m.<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code># pg_dropcluster 17 test --stop\n# pg_ctlcluster start 16 test\n# pg_lsclusters\nVer Cluster Port Status Owner    Data directory              Log file\n16  main    5432 online postgres \/var\/lib\/postgresql\/16\/main \/var\/log\/postgresql\/postgresql-16-main.log\n16  test    5434 online postgres \/var\/lib\/postgresql\/16\/test \/var\/log\/postgresql\/postgresql-16-test.log\n\n\n# pg_upgradecluster 16 test --method link --jobs 2 --rename test17\n\n\tStopping old cluster...\n\tCreating new PostgreSQL cluster 17\/test17 ...\n\t\/usr\/lib\/postgresql\/17\/bin\/initdb -D \/var\/lib\/postgresql\/17\/test17 --auth-local peer --auth-host scram-sha-256 --no-instructions --encoding UTF8 --lc-collate en_US.UTF-8 --lc-ctype en_US.UTF-8 --locale-provider libc\n\tThe files belonging to this database system will be owned by user &quot;postgres&quot;.\n\tThis user must also own the server process.\n\n\tThe database cluster will be initialized with locale &quot;en_US.UTF-8&quot;.\n\tThe default text search configuration will be set to &quot;english&quot;.\n\n\tData page checksums are disabled.\n\n\tfixing permissions on existing directory \/var\/lib\/postgresql\/17\/test17 ... ok\n\tcreating subdirectories ... ok\n\tselecting dynamic shared memory implementation ... posix\n\tselecting default &quot;max_connections&quot; ... 100\n\tselecting default &quot;shared_buffers&quot; ... 128MB\n\tselecting default time zone ... Etc\/UTC\n\tcreating configuration files ... ok\n\trunning bootstrap script ... ok\n\tperforming post-bootstrap initialization ... ok\n\tsyncing data to disk ... ok\n\n\tCopying old configuration files...\n\tCopying old start.conf...\n\tCopying old pg_ctl.conf...\n\tRunning init phase upgrade hook scripts ...\n\n\t\/usr\/lib\/postgresql\/17\/bin\/pg_upgrade -b \/usr\/lib\/postgresql\/16\/bin -B \/usr\/lib\/postgresql\/17\/bin -p 5434 -P 5433 -d \/etc\/postgresql\/16\/test -D \/etc\/postgresql\/17\/test17 --link -j 2\n\tFinding the real data directory for the source cluster        ok\n\tFinding the real data directory for the target cluster        ok\n\tPerforming Consistency Checks\n\t-----------------------------\n\tChecking cluster versions                                     ok\n\tChecking database user is the install user                    ok\n\tChecking database connection settings                         ok\n\tChecking for prepared transactions                            ok\n\tChecking for contrib\/isn with bigint-passing mismatch         ok\n\tChecking data type usage                                      ok\n\tCreating dump of global objects                               ok\n\tCreating dump of database schemas\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ok\n\tChecking for presence of required libraries                   ok\n\tChecking database user is the install user                    ok\n\tChecking for prepared transactions                            ok\n\tChecking for new cluster tablespace directories               ok\n\n\tIf pg_upgrade fails after this point, you must re-initdb the\n\tnew cluster before continuing.\n\n\tPerforming Upgrade\n\t------------------\n\tSetting locale and encoding for new cluster                   ok\n\tAnalyzing all rows in the new cluster                         ok\n\tFreezing all rows in the new cluster                          ok\n\tDeleting files from new pg_xact                               ok\n\tCopying old pg_xact to new server                             ok\n\tSetting oldest XID for new cluster                            ok\n\tSetting next transaction ID and epoch for new cluster         ok\n\tDeleting files from new pg_multixact\/offsets                  ok\n\tCopying old pg_multixact\/offsets to new server                ok\n\tDeleting files from new pg_multixact\/members                  ok\n\tCopying old pg_multixact\/members to new server                ok\n\tSetting next multixact ID and offset for new cluster          ok\n\tResetting WAL archives                                        ok\n\tSetting frozenxid and minmxid counters in new cluster         ok\n\tRestoring global objects in the new cluster                   ok\n\tRestoring database schemas in the new cluster\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ok\n\tAdding &quot;.old&quot; suffix to old global\/pg_control                 ok\n\n\tIf you want to start the old cluster, you will need to remove\n\tthe &quot;.old&quot; suffix from \/var\/lib\/postgresql\/16\/test\/global\/pg_control.old.\n\tBecause &quot;link&quot; mode was used, the old cluster cannot be safely\n\tstarted once the new cluster has been started.\n\tLinking user relation files\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ok\n\tSetting next OID for new cluster                              ok\n\tSync data directory to disk                                   ok\n\tCreating script to delete old cluster                         ok\n\tChecking for extension updates                                ok\n\n\tUpgrade Complete\n\t----------------\n\tOptimizer statistics are not transferred by pg_upgrade.\n\tOnce you start the new server, consider running:\n\t\t\/usr\/lib\/postgresql\/17\/bin\/vacuumdb --all --analyze-in-stages\n\tRunning this script will delete the old cluster&#39;s data files:\n\t\t.\/delete_old_cluster.sh\n\tpg_upgradecluster: pg_upgrade output scripts are in \/var\/log\/postgresql\/pg_upgradecluster-16-17-test17.WyLf\n\tDisabling automatic startup of old cluster...\n\tStarting upgraded cluster on port 5434...\n\tRunning finish phase upgrade hook scripts ...\n\tvacuumdb: processing database &quot;postgres&quot;: Generating minimal optimizer statistics (1 target)\n\tvacuumdb: processing database &quot;template1&quot;: Generating minimal optimizer statistics (1 target)\n\tvacuumdb: processing database &quot;postgres&quot;: Generating medium optimizer statistics (10 targets)\n\tvacuumdb: processing database &quot;template1&quot;: Generating medium optimizer statistics (10 targets)\n\tvacuumdb: processing database &quot;postgres&quot;: Generating default (full) optimizer statistics\n\tvacuumdb: processing database &quot;template1&quot;: Generating default (full) optimizer statistics\n\n\tSuccess. Please check that the upgraded cluster works. If it does,\n\tyou can remove the old cluster with\n\t\tpg_dropcluster 16 test\n\n\tVer Cluster Port Status Owner    Data directory              Log file\n\t16  test    5433 down   postgres \/var\/lib\/postgresql\/16\/test \/var\/log\/postgresql\/postgresql-16-test.log\n\tVer Cluster Port Status Owner    Data directory                Log file\n\t17  test17  5434 online postgres \/var\/lib\/postgresql\/17\/test17 \/var\/log\/postgresql\/postgresql-17-test17.log\n\n\n\n# pg_lsclusters\nVer Cluster Port Status Owner    Data directory                Log file\n16  main    5432 online postgres \/var\/lib\/postgresql\/16\/main   \/var\/log\/postgresql\/postgresql-16-main.log\n16  test    5433 down   postgres \/var\/lib\/postgresql\/16\/test   \/var\/log\/postgresql\/postgresql-16-test.log\n17  test17  5434 online postgres \/var\/lib\/postgresql\/17\/test17 \/var\/log\/postgresql\/postgresql-17-test17.log\n<\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Upgrade i\u015flemi ile birlikte pg_upgradecluster&#8217;\u0131n ger\u00e7ekle\u015ftirdi\u011fi pre ve post i\u015flemleri de komut \u00e7\u0131kt\u0131s\u0131nda g\u00f6rebilirsiniz. \u00c7\u0131kt\u0131daki \u015fu uyar\u0131 link modu kullan\u0131ld\u0131\u011f\u0131n\u0131 ve yeni versiyon cluster a\u00e7\u0131ld\u0131ktan sonra eski cluster&#8217;\u0131n sa\u011fl\u0131kl\u0131 bir \u015fekilde a\u00e7\u0131lamayaca\u011f\u0131n\u0131 belirtiyor: <em>Because &#8220;link&#8221; mode was used, the old cluster cannot be safely started once the new cluster has been started.<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Y\u00f6ntemden ba\u011f\u0131ms\u0131z olarak upgrade i\u015flemlerindeki en \u00f6nemli iki nokta, <strong>do\u011fru haz\u0131rl\u0131k<\/strong> ve <strong>geri d\u00f6n\u00fc\u015f plan\u0131 <\/strong>olu\u015fturmad\u0131r. Do\u011fru haz\u0131rl\u0131k a\u015famas\u0131nda veri taban\u0131nda \u00e7al\u0131\u015fan t\u00fcm uygulamalar\u0131n veri taban\u0131n\u0131n hedef versiyonunda test edilmeleri, ayr\u0131ca upgrade ad\u0131mlar\u0131n\u0131n da test ve d\u00f6k\u00fcmante edilmesi \u00e7ok \u00f6nemlidir. Geri d\u00f6n\u00fc\u015f plan\u0131 ise upgade i\u015flemi s\u0131ras\u0131nda ya da sonras\u0131nda ya\u015fanabilecek ciddi sorunlara kar\u015f\u0131 bir haz\u0131rl\u0131kt\u0131r. Veri taban\u0131n\u0131n yeni versiyona sa\u011fl\u0131kl\u0131 ge\u00e7ememesi ya da yeni versiyonda uygulama fonksiyonlar\u0131n\u0131n do\u011fru \u00e7al\u0131\u015fmamas\u0131 ile birlikte k\u0131sa s\u00fcre i\u00e7inde d\u00fczeltme \u015fans\u0131n\u0131n da olmamas\u0131 durumlar\u0131nda, eski versiyona veri kayb\u0131 olmadan ge\u00e7ebilmek gereklidir. Bunun i\u00e7in geri d\u00f6n\u00fc\u015f plan\u0131m\u0131z\u0131 upgrade \u00f6ncesinde olu\u015fturmal\u0131 ve test etmeliyiz.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"664\" src=\"https:\/\/stradata.com.tr\/wp-content\/uploads\/2024\/09\/elephant1-1-1024x664.png\" alt=\"\" class=\"wp-image-363\" srcset=\"https:\/\/stradata.com.tr\/wp-content\/uploads\/2024\/09\/elephant1-1-1024x664.png 1024w, https:\/\/stradata.com.tr\/wp-content\/uploads\/2024\/09\/elephant1-1-300x195.png 300w, https:\/\/stradata.com.tr\/wp-content\/uploads\/2024\/09\/elephant1-1-768x498.png 768w, https:\/\/stradata.com.tr\/wp-content\/uploads\/2024\/09\/elephant1-1.png 1186w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>PostgreSQL veri tabanlar\u0131n\u0131zda maj\u00f6r versiyon y\u00fckseltmesi yapman\u0131z i\u00e7in 3 farkl\u0131 y\u00f6ntem mevcut. Bunlar : Bu y\u00f6ntemlerin avantaj\/dezavantajlar\u0131 anlam\u0131nda h\u0131zl\u0131ca \u00fczerlerinden ge\u00e7elim. pg_dumpall ile upgrade yapmak t\u00fcm veriyi kopyalamak anlam\u0131na geldi\u011fi i\u00e7in veri taban\u0131 boyutu b\u00fcy\u00fcd\u00fck\u00e7e uygulanabilirli\u011fi azal\u0131r. Boyut b\u00fcy\u00fcd\u00fck\u00e7e kesinti s\u00fcresi ve veri aktar\u0131m\u0131nda hata ihtimali artacakt\u0131r. Ayr\u0131ca upgrade i\u015flemi i\u00e7in ihtiyac\u0131m\u0131z olacak disk alan\u0131 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-352","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/stradata.com.tr\/index.php?rest_route=\/wp\/v2\/posts\/352","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/stradata.com.tr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/stradata.com.tr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/stradata.com.tr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/stradata.com.tr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=352"}],"version-history":[{"count":7,"href":"https:\/\/stradata.com.tr\/index.php?rest_route=\/wp\/v2\/posts\/352\/revisions"}],"predecessor-version":[{"id":367,"href":"https:\/\/stradata.com.tr\/index.php?rest_route=\/wp\/v2\/posts\/352\/revisions\/367"}],"wp:attachment":[{"href":"https:\/\/stradata.com.tr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=352"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/stradata.com.tr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=352"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/stradata.com.tr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=352"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}