{"id":32054,"date":"2025-10-17T05:41:03","date_gmt":"2025-10-17T02:41:03","guid":{"rendered":"https:\/\/fatihsoysal.com\/blog\/?p=32054"},"modified":"2025-10-17T05:41:03","modified_gmt":"2025-10-17T02:41:03","slug":"barman-kullanarak-centos-7-uzerinde-postgresql-veritabanlarini-yedekleme-geri-yukleme-ve-tasima","status":"publish","type":"post","link":"https:\/\/fatihsoysal.com\/blog\/barman-kullanarak-centos-7-uzerinde-postgresql-veritabanlarini-yedekleme-geri-yukleme-ve-tasima\/","title":{"rendered":"Barman Kullanarak CentOS 7 \u00dczerinde PostgreSQL Veritabanlar\u0131n\u0131 Yedekleme, Geri Y\u00fckleme ve Ta\u015f\u0131ma"},"content":{"rendered":"<p><body><\/p>\n<h2>Barman Kullanarak CentOS 7 \u00dczerinde PostgreSQL Veritabanlar\u0131n\u0131 Yedekleme, Geri Y\u00fckleme ve Ta\u015f\u0131ma<\/h2>\n<p>PostgreSQL, g\u00fcvenilirli\u011fi, g\u00fc\u00e7l\u00fc \u00f6zellikleri ve a\u00e7\u0131k kaynak yap\u0131s\u0131yla d\u00fcnya genelinde en pop\u00fcler ili\u015fkisel veritaban\u0131 sistemlerinden biridir. Kurumsal uygulamalardan k\u00fc\u00e7\u00fck projelere kadar geni\u015f bir yelpazede kullan\u0131lmaktad\u0131r. Ancak, herhangi bir kritik veri sisteminde oldu\u011fu gibi, PostgreSQL veritabanlar\u0131n\u0131n da d\u00fczenli ve g\u00fcvenilir bir \u015fekilde yedeklenmesi, olas\u0131 veri kayb\u0131 durumlar\u0131nda geri y\u00fcklenebilmesi ve gerekti\u011finde farkl\u0131 ortamlara ta\u015f\u0131nabilmesi hayati \u00f6neme sahiptir. Geleneksel yedekleme y\u00f6ntemleri (\u00f6rne\u011fin, <code>pg_dump<\/code> veya dosya sistemi seviyesinde yedeklemeler) belirli senaryolar i\u00e7in yeterli olsa da, b\u00fcy\u00fck \u00f6l\u00e7ekli veritabanlar\u0131 veya felaket kurtarma senaryolar\u0131 i\u00e7in yetersiz kalabilir. \u00d6zellikle &#8220;Point-in-Time Recovery&#8221; (PITR) olarak bilinen belirli bir zamana geri d\u00f6nme yetene\u011fi, bu y\u00f6ntemlerle genellikle zor veya imkans\u0131zd\u0131r.<\/p>\n<p>\u0130\u015fte tam bu noktada Barman (Backup and Recovery Manager) devreye girer. Barman, PostgreSQL i\u00e7in \u00f6zel olarak tasarlanm\u0131\u015f, felaket kurtarma ve s\u00fcrekli ar\u015fivleme \u00f6zelliklerini destekleyen a\u00e7\u0131k kaynakl\u0131 bir yedekleme ve kurtarma arac\u0131d\u0131r. Barman, <code>pg_basebackup<\/code> ve WAL (Write-Ahead Log) dosyalar\u0131n\u0131n s\u00fcrekli ar\u015fivlenmesi prensibine dayanarak tam yedeklemeler, art\u0131ml\u0131 yedeklemeler ve PITR yetenekleri sunar. Bu makalede, CentOS 7 i\u015fletim sistemi \u00fczerinde Barman kullanarak PostgreSQL veritabanlar\u0131n\u0131n nas\u0131l yedeklenece\u011fini, geri y\u00fcklenece\u011fini ve farkl\u0131 bir sunucuya nas\u0131l ta\u015f\u0131naca\u011f\u0131n\u0131 ad\u0131m ad\u0131m detayl\u0131 bir \u015fekilde inceleyece\u011fiz. Bu rehber, veritaban\u0131 y\u00f6neticileri ve sistem m\u00fchendisleri i\u00e7in PostgreSQL yedekleme stratejilerini g\u00fc\u00e7lendirmek ad\u0131na kapsaml\u0131 bir kaynak olmay\u0131 hedeflemektedir.<\/p>\n<h3>\u00d6n Gereksinimler ve Sistem Kurulumu<\/h3>\n<p>Barman ile ba\u015far\u0131l\u0131 bir yedekleme ve kurtarma ortam\u0131 kurmak i\u00e7in belirli \u00f6n gereksinimleri kar\u015f\u0131lamam\u0131z gerekmektedir. Bu rehberde, en az iki adet CentOS 7 sunucusu kullanaca\u011f\u0131z: biri PostgreSQL veritaban\u0131 sunucusu (birincil sunucu), di\u011feri ise Barman yedekleme sunucusu. \u0130ste\u011fe ba\u011fl\u0131 olarak, geri y\u00fckleme ve ta\u015f\u0131ma i\u015flemlerini test etmek i\u00e7in \u00fc\u00e7\u00fcnc\u00fc bir sunucu da kullanabilirsiniz.<\/p>\n<h4>Gerekli Sunucular ve Rolleri:<\/h4>\n<p>*   <strong>PostgreSQL Sunucusu (PG_SERVER):<\/strong> PostgreSQL veritaban\u0131n\u0131n \u00e7al\u0131\u015ft\u0131\u011f\u0131 sunucu. IP adresi: <code>192.168.1.10<\/code> (\u00f6rnek).<br \/>\n*   <strong>Barman Sunucusu (BARMAN_SERVER):<\/strong> Barman uygulamas\u0131n\u0131n ve yedeklerin depoland\u0131\u011f\u0131 sunucu. IP adresi: <code>192.168.1.20<\/code> (\u00f6rnek).<\/p>\n<h4>Ortak \u00d6n Gereksinimler:<\/h4>\n<p>1.  <strong>A\u011f Ba\u011flant\u0131s\u0131:<\/strong> Her iki sunucu aras\u0131nda a\u011f ba\u011flant\u0131s\u0131 olmal\u0131 ve SSH (Port 22) ile PostgreSQL (Port 5432) portlar\u0131 aras\u0131nda eri\u015fim sa\u011flanmal\u0131d\u0131r.<br \/>\n2.  <strong>Kullan\u0131c\u0131 Hesaplar\u0131:<\/strong><br \/>\n    *   PostgreSQL sunucusunda: <code>postgres<\/code> i\u015fletim sistemi kullan\u0131c\u0131s\u0131 ve PostgreSQL veritaban\u0131 s\u00fcper kullan\u0131c\u0131s\u0131 (veya \u00f6zel bir replikasyon kullan\u0131c\u0131s\u0131).<br \/>\n    *   Barman sunucusunda: <code>barman<\/code> ad\u0131nda \u00f6zel bir i\u015fletim sistemi kullan\u0131c\u0131s\u0131.<br \/>\n3.  <strong>SSH Anahtar Tabanl\u0131 Kimlik Do\u011frulama:<\/strong> Barman sunucusundan PostgreSQL sunucusuna ve PostgreSQL sunucusundan Barman sunucusuna parolas\u0131z SSH eri\u015fimi kurulmal\u0131d\u0131r. Bu, g\u00fcvenli ve otomatik yedekleme i\u015flemleri i\u00e7in kritiktir.<br \/>\n4.  <strong>SELinux ve G\u00fcvenlik Duvar\u0131:<\/strong><br \/>\n    *   <strong>SELinux:<\/strong> Test ortamlar\u0131nda devre d\u0131\u015f\u0131 b\u0131rak\u0131labilir (<code>setenforce 0<\/code> ve <code>\/etc\/selinux\/config<\/code> dosyas\u0131nda <code>SELINUX=disabled<\/code>). \u00dcretim ortamlar\u0131nda ise Barman ve PostgreSQL i\u00e7in gerekli kurallar\u0131n yap\u0131land\u0131r\u0131lmas\u0131 \u00f6nerilir.<br \/>\n    *   <strong>G\u00fcvenlik Duvar\u0131 (FirewallD):<\/strong> Gerekli portlar\u0131n a\u00e7\u0131ld\u0131\u011f\u0131ndan emin olun.<br \/>\n        *   Barman sunucusunda: PostgreSQL sunucusundan gelen SSH trafi\u011fi i\u00e7in port 22.<br \/>\n        *   PostgreSQL sunucusunda: Barman sunucusundan gelen SSH trafi\u011fi i\u00e7in port 22 ve PostgreSQL ba\u011flant\u0131lar\u0131 i\u00e7in port 5432.<\/p>\n<pre><code class=\"language-bash\"># PostgreSQL Sunucusunda\n        sudo firewall-cmd --permanent --add-source=192.168.1.20 --add-port=5432\/tcp\n        sudo firewall-cmd --permanent --add-source=192.168.1.20 --add-port=22\/tcp # Barman'\u0131n SSH eri\u015fimi i\u00e7in\n        sudo firewall-cmd --reload\n\n        # Barman Sunucusunda\n        sudo firewall-cmd --permanent --add-source=192.168.1.10 --add-port=22\/tcp # PostgreSQL'in SSH eri\u015fimi i\u00e7in (WAL ar\u015fivleme)\n        sudo firewall-cmd --reload<\/code><\/pre>\n<h4>PostgreSQL Sunucusu Kurulumu (PG_SERVER):<\/h4>\n<p>PostgreSQL sunucusunda, PostgreSQL veritaban\u0131 kurulu ve \u00e7al\u0131\u015f\u0131r durumda olmal\u0131d\u0131r. E\u011fer kurulu de\u011filse, a\u015fa\u011f\u0131daki ad\u0131mlar\u0131 izleyebilirsiniz:<\/p>\n<pre><code class=\"language-bash\">sudo yum install -y https:\/\/download.postgresql.org\/pub\/repos\/yum\/reporpms\/EL-7-x86_64\/pgdg-redhat-repo-latest.noarch.rpm\nsudo yum install -y postgresql12-server postgresql12-contrib\nsudo \/usr\/pgsql-12\/bin\/postgresql-12-setup initdb\nsudo systemctl enable postgresql-12\nsudo systemctl start postgresql-12<\/code><\/pre>\n<h3>Barman Sunucusu Kurulumu ve Yap\u0131land\u0131rmas\u0131<\/h3>\n<p>Barman sunucusunda, Barman yaz\u0131l\u0131m\u0131n\u0131 kuracak ve PostgreSQL sunucusu ile ileti\u015fim kurmas\u0131 i\u00e7in gerekli yap\u0131land\u0131rmalar\u0131 yapaca\u011f\u0131z.<\/p>\n<h4>Barman Kullan\u0131c\u0131s\u0131 Olu\u015fturma:<\/h4>\n<p>Barman i\u015flemlerini y\u00f6netmek i\u00e7in <code>barman<\/code> ad\u0131nda \u00f6zel bir sistem kullan\u0131c\u0131s\u0131 olu\u015ftural\u0131m.<\/p>\n<pre><code class=\"language-bash\">sudo useradd -m barman\nsudo passwd barman # G\u00fcvenli bir parola belirleyin<\/code><\/pre>\n<h4>EPEL ve Barman Kurulumu:<\/h4>\n<p>Barman, EPEL (Extra Packages for Enterprise Linux) deposunda bulunur. \u00d6nce EPEL&#8217;i, ard\u0131ndan Barman&#8217;\u0131 ve PostgreSQL istemci ara\u00e7lar\u0131n\u0131 kural\u0131m.<\/p>\n<pre><code class=\"language-bash\">sudo yum install -y epel-release\nsudo yum install -y barman postgresql12<\/code><\/pre>\n<p><code>postgresql12<\/code> paketi, Barman&#8217;\u0131n <code>pg_basebackup<\/code> gibi PostgreSQL ara\u00e7lar\u0131n\u0131 kullanabilmesi i\u00e7in gereklidir.<\/p>\n<h4>SSH Anahtar Tabanl\u0131 Kimlik Do\u011frulama Yap\u0131land\u0131rmas\u0131:<\/h4>\n<p>Bu ad\u0131m, Barman ve PostgreSQL sunucular\u0131 aras\u0131nda g\u00fcvenli ve parolas\u0131z ileti\u015fimi sa\u011flamak i\u00e7in hayati \u00f6neme sahiptir.<\/p>\n<p>1.  <strong>Barman&#8217;dan PostgreSQL&#8217;e SSH Eri\u015fimi:<\/strong><br \/>\n    *   Barman sunucusunda <code>barman<\/code> kullan\u0131c\u0131s\u0131 olarak SSH anahtar\u0131 olu\u015fturun:<\/p>\n<pre><code class=\"language-bash\">sudo su - barman\n        ssh-keygen -t rsa -b 4096 -C \"barman@BARMAN_SERVER\"\n        # Parola istemedi\u011finde Enter'a bas\u0131n<\/code><\/pre>\n<p>    *   Olu\u015fturulan genel anahtar\u0131 (<code>~\/.ssh\/id_rsa.pub<\/code>) PostgreSQL sunucusundaki <code>postgres<\/code> kullan\u0131c\u0131s\u0131n\u0131n <code>~\/.ssh\/authorized_keys<\/code> dosyas\u0131na kopyalay\u0131n.<\/p>\n<pre><code class=\"language-bash\">ssh-copy-id -i ~\/.ssh\/id_rsa.pub postgres@192.168.1.10\n        # \u0130lk ba\u011flant\u0131da postgres kullan\u0131c\u0131s\u0131n\u0131n parolas\u0131n\u0131 girmeniz gerekecek.<\/code><\/pre>\n<p>    *   Test edin:<\/p>\n<pre><code class=\"language-bash\">ssh postgres@192.168.1.10 \"hostname\"\n        # PostgreSQL sunucusunun hostname'ini g\u00f6rmelisiniz.<\/code><\/pre>\n<p>2.  <strong>PostgreSQL&#8217;den Barman&#8217;a SSH Eri\u015fimi (WAL Ar\u015fivleme i\u00e7in):<\/strong><br \/>\n    *   PostgreSQL sunucusunda <code>postgres<\/code> kullan\u0131c\u0131s\u0131 olarak SSH anahtar\u0131 olu\u015fturun:<\/p>\n<pre><code class=\"language-bash\">sudo su - postgres\n        ssh-keygen -t rsa -b 4096 -C \"postgres@PG_SERVER\"\n        # Parola istemedi\u011finde Enter'a bas\u0131n<\/code><\/pre>\n<p>    *   Olu\u015fturulan genel anahtar\u0131 (<code>~\/.ssh\/id_rsa.pub<\/code>) Barman sunucusundaki <code>barman<\/code> kullan\u0131c\u0131s\u0131n\u0131n <code>~\/.ssh\/authorized_keys<\/code> dosyas\u0131na kopyalay\u0131n.<\/p>\n<pre><code class=\"language-bash\">ssh-copy-id -i ~\/.ssh\/id_rsa.pub barman@192.168.1.20\n        # \u0130lk ba\u011flant\u0131da barman kullan\u0131c\u0131s\u0131n\u0131n parolas\u0131n\u0131 girmeniz gerekecek.<\/code><\/pre>\n<p>    *   Test edin:<\/p>\n<pre><code class=\"language-bash\">ssh barman@192.168.1.20 \"hostname\"\n        # Barman sunucusunun hostname'ini g\u00f6rmelisiniz.<\/code><\/pre>\n<p>Bu SSH yap\u0131land\u0131rmalar\u0131, Barman&#8217;\u0131n PostgreSQL sunucusundan temel yedeklemeleri almas\u0131 ve PostgreSQL&#8217;in WAL dosyalar\u0131n\u0131 Barman sunucusuna ar\u015fivlemesi i\u00e7in gereklidir.<\/p>\n<h4>Barman Yedekleme Dizini Olu\u015fturma:<\/h4>\n<p>Barman, yedekleri ve WAL dosyalar\u0131n\u0131 depolamak i\u00e7in belirli bir dizine ihtiya\u00e7 duyar. Bu dizini <code>barman<\/code> kullan\u0131c\u0131s\u0131 i\u00e7in olu\u015ftural\u0131m ve gerekli izinleri verelim.<\/p>\n<pre><code class=\"language-bash\">sudo mkdir -p \/var\/lib\/barman\/main_pg\nsudo chown -R barman:barman \/var\/lib\/barman\/main_pg<\/code><\/pre>\n<p>Burada <code>main_pg<\/code>, yedeklenecek PostgreSQL sunucusu i\u00e7in bir sunucu ad\u0131 olarak kullan\u0131lacakt\u0131r.<\/p>\n<h3>PostgreSQL Sunucusunun Barman \u0130\u00e7in Yap\u0131land\u0131r\u0131lmas\u0131<\/h3>\n<p>PostgreSQL veritaban\u0131n\u0131n Barman ile uyumlu \u00e7al\u0131\u015fabilmesi i\u00e7in baz\u0131 yap\u0131land\u0131rma de\u011fi\u015fiklikleri yap\u0131lmas\u0131 gerekmektedir. Bu de\u011fi\u015fiklikler, veritaban\u0131n\u0131n WAL dosyalar\u0131n\u0131 ar\u015fivlemesini ve Barman&#8217;\u0131n <code>pg_basebackup<\/code> ile temel yedeklemeler almas\u0131n\u0131 sa\u011flar.<\/p>\n<h4><code>postgresql.conf<\/code> Dosyas\u0131n\u0131 D\u00fczenleme:<\/h4>\n<p>PostgreSQL veri dizininizdeki (<code>\/var\/lib\/pgsql\/12\/data\/<\/code> gibi) <code>postgresql.conf<\/code> dosyas\u0131n\u0131 d\u00fczenleyin.<\/p>\n<pre><code class=\"language-bash\">sudo vi \/var\/lib\/pgsql\/12\/data\/postgresql.conf<\/code><\/pre>\n<p>A\u015fa\u011f\u0131daki parametreleri ayarlay\u0131n veya g\u00fcncelleyin:<\/p>\n<p>*   <strong><code>wal_level = replica<\/code>:<\/strong> Bu ayar, WAL dosyalar\u0131n\u0131n replikasyon ve yedekleme i\u00e7in yeterli bilgiyi i\u00e7ermesini sa\u011flar. PITR i\u00e7in gereklidir.<br \/>\n*   <strong><code>archive_mode = on<\/code>:<\/strong> Bu ayar, PostgreSQL&#8217;in WAL dosyalar\u0131n\u0131 ar\u015fivlemesini etkinle\u015ftirir.<br \/>\n*   <strong><code>archive_command = 'rsync -a %p barman@192.168.1.20:\/var\/lib\/barman\/main_pg\/wal\/%r'<\/code>:<\/strong> Bu komut, PostgreSQL&#8217;in tamamlanm\u0131\u015f WAL dosyalar\u0131n\u0131 Barman sunucusuna nas\u0131l g\u00f6nderece\u011fini belirtir.<br \/>\n    *   <code>%p<\/code>: Ar\u015fivlenecek WAL dosyas\u0131n\u0131n tam yolu.<br \/>\n    *   <code>%r<\/code>: Ge\u00e7ici olarak olu\u015fturulan WAL dosyas\u0131n\u0131n ad\u0131.<br \/>\n    *   <code>barman@192.168.1.20<\/code>: Barman sunucusundaki <code>barman<\/code> kullan\u0131c\u0131s\u0131 ve IP adresi.<br \/>\n    *   <code>\/var\/lib\/barman\/main_pg\/wal\/<\/code>: Barman sunucusunda WAL dosyalar\u0131n\u0131n depolanaca\u011f\u0131 dizin. Bu dizin Barman taraf\u0131ndan otomatik olarak olu\u015fturulacakt\u0131r, ancak \u00fcst dizinin (<code>\/var\/lib\/barman\/main_pg<\/code>) var oldu\u011fundan ve izinlerinin do\u011fru oldu\u011fundan emin olun.<br \/>\n    *   <code>rsync -a<\/code>: Dosyalar\u0131 ar\u015fiv modunda (\u00f6zyinelemeli, sembolik ba\u011flant\u0131lar\u0131 koru, izinleri koru vb.) kopyalamak i\u00e7in kullan\u0131l\u0131r.<br \/>\n*   <strong><code>max_wal_senders = 5<\/code>:<\/strong> Barman&#8217;\u0131n WAL ak\u0131\u015f\u0131 (<code>streaming_wal<\/code>) kullanmas\u0131 durumunda veya ba\u015fka replikasyon yuvalar\u0131 i\u00e7in ka\u00e7 adet WAL g\u00f6nderici s\u00fcrecinin \u00e7al\u0131\u015fabilece\u011fini belirtir. Barman i\u00e7in en az 1-2 adet yeterlidir.<br \/>\n*   <strong><code>wal_keep_segments = 0<\/code>:<\/strong> E\u011fer <code>streaming_wal<\/code> kullan\u0131l\u0131yorsa, bu de\u011feri 0 olarak b\u0131rakmak genellikle \u00f6nerilir, \u00e7\u00fcnk\u00fc WAL dosyalar\u0131 replikasyon yuvalar\u0131 taraf\u0131ndan y\u00f6netilir. Ancak, standby sunucular\u0131n\u0131z varsa veya belirli bir WAL ge\u00e7mi\u015fini korumak istiyorsan\u0131z bu de\u011feri art\u0131rabilirsiniz.<\/p>\n<h4><code>pg_hba.conf<\/code> Dosyas\u0131n\u0131 D\u00fczenleme:<\/h4>\n<p>Barman&#8217;\u0131n PostgreSQL sunucusuna ba\u011flanmas\u0131na izin vermek i\u00e7in <code>pg_hba.conf<\/code> dosyas\u0131n\u0131 d\u00fczenleyin.<\/p>\n<pre><code class=\"language-bash\">sudo vi \/var\/lib\/pgsql\/12\/data\/pg_hba.conf<\/code><\/pre>\n<p>Dosyan\u0131n sonuna a\u015fa\u011f\u0131daki sat\u0131rlar\u0131 ekleyin:<\/p>\n<pre><code class=\"language-\"># Barman Sunucusundan gelen ba\u011flant\u0131lara izin ver\nhost    all             barman_repl     192.168.1.20\/32         md5\nhost    replication     barman_repl     192.168.1.20\/32         md5<\/code><\/pre>\n<p>*   <code>barman_repl<\/code>: Barman&#8217;\u0131n PostgreSQL&#8217;e ba\u011flanmak i\u00e7in kullanaca\u011f\u0131 \u00f6zel bir replikasyon kullan\u0131c\u0131s\u0131.<br \/>\n*   <code>192.168.1.20\/32<\/code>: Barman sunucusunun IP adresi.<\/p>\n<h4>Replikasyon Kullan\u0131c\u0131s\u0131 Olu\u015fturma:<\/h4>\n<p>PostgreSQL veritaban\u0131nda <code>barman_repl<\/code> kullan\u0131c\u0131s\u0131n\u0131 olu\u015ftural\u0131m ve replikasyon yetkisi verelim.<\/p>\n<pre><code class=\"language-bash\">sudo -u postgres psql\nCREATE USER barman_repl WITH REPLICATION ENCRYPTED PASSWORD 'sifreniz';\n\\q<\/code><\/pre>\n<p><code>sifreniz<\/code> yerine g\u00fc\u00e7l\u00fc bir parola kullanmay\u0131 unutmay\u0131n.<\/p>\n<h4>PostgreSQL&#8217;i Yeniden Ba\u015flatma:<\/h4>\n<p>Yap\u0131land\u0131rma de\u011fi\u015fikliklerinin etkili olmas\u0131 i\u00e7in PostgreSQL hizmetini yeniden ba\u015flat\u0131n.<\/p>\n<pre><code class=\"language-bash\">sudo systemctl restart postgresql-12<\/code><\/pre>\n<h3>Barman&#8217;\u0131 PostgreSQL Sunucusu \u0130\u00e7in Yap\u0131land\u0131rma<\/h3>\n<p>\u015eimdi Barman sunucusunda, yedeklenecek PostgreSQL sunucusunu tan\u0131mlayan bir yap\u0131land\u0131rma dosyas\u0131 olu\u015fturaca\u011f\u0131z. Barman yap\u0131land\u0131rma dosyalar\u0131 genellikle <code>\/etc\/barman.d\/<\/code> dizininde bulunur.<\/p>\n<pre><code class=\"language-bash\">sudo su - barman\nvi \/etc\/barman.d\/main_pg.conf<\/code><\/pre>\n<p>A\u015fa\u011f\u0131daki i\u00e7eri\u011fi dosyaya ekleyin:<\/p>\n<pre><code class=\"language-ini\">[main_pg]\ndescription = \"Ana PostgreSQL Veritaban\u0131\"\nssh_command = ssh postgres@192.168.1.10\nconninfo = host=192.168.1.10 user=barman_repl dbname=postgres password=sifreniz\nstreaming_conninfo = host=192.168.1.10 user=barman_repl dbname=postgres password=sifreniz\nbackup_method = rsync\nstreaming_wal = on\nslot_name = barman_slot # PostgreSQL 10 ve sonras\u0131 i\u00e7in \u00f6nerilir\nretention_policy = REDUNDANCY 3\ncompression = gzip<\/code><\/pre>\n<p>Parametrelerin a\u00e7\u0131klamalar\u0131:<\/p>\n<p>*   <strong><code>[main_pg]<\/code><\/strong>: Yedeklenecek sunucu i\u00e7in benzersiz bir tan\u0131mlay\u0131c\u0131.<br \/>\n*   <strong><code>description<\/code><\/strong>: Sunucunun k\u0131sa a\u00e7\u0131klamas\u0131.<br \/>\n*   <strong><code>ssh_command<\/code><\/strong>: Barman&#8217;\u0131n PostgreSQL sunucusuna ba\u011flanmak i\u00e7in kullanaca\u011f\u0131 SSH komutu. <code>postgres<\/code> kullan\u0131c\u0131s\u0131 ve PostgreSQL sunucusunun IP adresi.<br \/>\n*   <strong><code>conninfo<\/code><\/strong>: Barman&#8217;\u0131n PostgreSQL veritaban\u0131na ba\u011flanmak i\u00e7in kullanaca\u011f\u0131 ba\u011flant\u0131 dizesi. <code>barman_repl<\/code> kullan\u0131c\u0131s\u0131 ve parolas\u0131 burada belirtilir.<br \/>\n*   <strong><code>streaming_conninfo<\/code><\/strong>: WAL ak\u0131\u015f\u0131 i\u00e7in kullan\u0131lan ba\u011flant\u0131 dizesi. Genellikle <code>conninfo<\/code> ile ayn\u0131d\u0131r.<br \/>\n*   <strong><code>backup_method = rsync<\/code><\/strong>: Temel yedeklemeler i\u00e7in <code>rsync<\/code> kullan\u0131r. Alternatif olarak <code>postgres<\/code> (yani <code>pg_basebackup<\/code>) da kullan\u0131labilir. <code>postgres<\/code> y\u00f6ntemi genellikle daha g\u00fcvenilirdir ve \u00f6nerilir. Bu durumda <code>backup_method = postgres<\/code> olarak ayarlan\u0131r ve <code>ssh_command<\/code> yerine <code>pg_basebackup<\/code> do\u011frudan kullan\u0131l\u0131r.<br \/>\n*   <strong><code>streaming_wal = on<\/code><\/strong>: WAL dosyalar\u0131n\u0131n s\u00fcrekli olarak ak\u0131\u015fla al\u0131nmas\u0131n\u0131 etkinle\u015ftirir. Bu, <code>archive_command<\/code> ile birlikte veya onun yerine kullan\u0131labilir ve genellikle daha g\u00fcncel kurtarma noktalar\u0131 sa\u011flar.<br \/>\n*   <strong><code>slot_name = barman_slot<\/code><\/strong>: PostgreSQL 9.4 ve sonras\u0131 i\u00e7in replikasyon yuvalar\u0131 (replication slots) kullanmak, WAL dosyalar\u0131n\u0131n Barman taraf\u0131ndan al\u0131nana kadar PostgreSQL sunucusunda tutulmas\u0131n\u0131 garanti eder. Bu, veri kayb\u0131n\u0131 \u00f6nlemek i\u00e7in \u00e7ok \u00f6nemlidir. Bu yuva Barman taraf\u0131ndan otomatik olarak olu\u015fturulur.<br \/>\n*   <strong><code>retention_policy = REDUNDANCY 3<\/code><\/strong>: En az 3 tam yedeklemenin her zaman saklanmas\u0131n\u0131 sa\u011flar. Eski yedeklemeler otomatik olarak silinir. Tarih bazl\u0131 (<code>RECOVERY WINDOW<\/code>) politikalar da kullan\u0131labilir.<br \/>\n*   <strong><code>compression = gzip<\/code><\/strong>: Yedeklerin <code>gzip<\/code> ile s\u0131k\u0131\u015ft\u0131r\u0131lmas\u0131n\u0131 sa\u011flar. Bu, disk alan\u0131ndan tasarruf sa\u011flar.<\/p>\n<p><strong>\u00d6nemli Not:<\/strong> <code>slot_name<\/code> kullan\u0131yorsan\u0131z, PostgreSQL sunucusunda <code>max_replication_slots<\/code> de\u011ferini en az 1 olarak ayarlad\u0131\u011f\u0131n\u0131zdan emin olun (<code>postgresql.conf<\/code> dosyas\u0131nda).<\/p>\n<pre><code class=\"language-bash\"># PostgreSQL sunucusunda\nsudo vi \/var\/lib\/pgsql\/12\/data\/postgresql.conf\n<h2>max_replication_slots = 1 # veya daha fazla<\/h2>\nsudo systemctl restart postgresql-12<\/code><\/pre>\n<h4>Barman Yap\u0131land\u0131rmas\u0131n\u0131 Test Etme:<\/h4>\n<p>Yap\u0131land\u0131rman\u0131n do\u011fru olup olmad\u0131\u011f\u0131n\u0131 kontrol etmek i\u00e7in <code>barman check<\/code> komutunu kullan\u0131n.<\/p>\n<pre><code class=\"language-bash\">barman check main_pg<\/code><\/pre>\n<p>T\u00fcm kontrollerin <code>OK<\/code> olarak d\u00f6nmesi gerekmektedir. E\u011fer herhangi bir hata varsa (\u00f6rne\u011fin SSH eri\u015fimi, <code>archive_command<\/code> kontrol\u00fc, ba\u011flant\u0131 bilgileri), bu hatalar\u0131 d\u00fczeltmeniz gerekir. \u00d6zellikle <code>WAL archiving is not active<\/code> hatas\u0131 al\u0131rsan\u0131z, <code>archive_command<\/code> ayar\u0131n\u0131z\u0131 ve SSH eri\u015fimini tekrar kontrol edin.<\/p>\n<h3>Yedekleme \u0130\u015flemleri<\/h3>\n<p>Barman yap\u0131land\u0131rmas\u0131 tamamland\u0131ktan sonra, veritaban\u0131n\u0131n ilk tam yedeklemesini alabiliriz.<\/p>\n<h4>Tam Temel Yedekleme Alma:<\/h4>\n<p>\u0130lk yedekleme, t\u00fcm veritaban\u0131n\u0131n bir anl\u0131k g\u00f6r\u00fcnt\u00fcs\u00fcn\u00fc i\u00e7erir.<\/p>\n<pre><code class=\"language-bash\">barman backup main_pg<\/code><\/pre>\n<p>Bu komut, PostgreSQL sunucusunda <code>pg_basebackup<\/code> (veya <code>rsync<\/code> e\u011fer <code>backup_method=rsync<\/code> ise) kullanarak veritaban\u0131n\u0131n temel yedeklemesini al\u0131r ve Barman sunucusuna kaydeder. Yedekleme s\u0131ras\u0131nda, PostgreSQL sunucusu WAL dosyalar\u0131n\u0131 Barman&#8217;a ar\u015fivlemeye devam edecektir.<\/p>\n<h4>Yedeklemeleri Do\u011frulama:<\/h4>\n<p>Al\u0131nan yedeklemeleri listelemek ve durumlar\u0131n\u0131 kontrol etmek i\u00e7in:<\/p>\n<pre><code class=\"language-bash\">barman list-backup main_pg<\/code><\/pre>\n<p>Bu komut, her bir yedeklemenin kimli\u011fini, ba\u015flang\u0131\u00e7\/biti\u015f zaman\u0131n\u0131, boyutunu ve durumunu g\u00f6sterir.<\/p>\n<h4>Yedeklemeleri Zamanlama (Cron ile):<\/h4>\n<p>D\u00fczenli yedeklemeler i\u00e7in <code>cron<\/code> i\u015fi kurman\u0131z \u00f6nerilir. <code>barman<\/code> kullan\u0131c\u0131s\u0131n\u0131n crontab&#8217;\u0131n\u0131 d\u00fczenleyin:<\/p>\n<pre><code class=\"language-bash\">crontab -e<\/code><\/pre>\n<p>A\u015fa\u011f\u0131daki sat\u0131r\u0131 ekleyerek her gece 01:00&#8217;de tam yedekleme almas\u0131n\u0131 sa\u011flayabilirsiniz:<\/p>\n<pre><code class=\"language-cron\">0 1 <em> <\/em> * \/usr\/bin\/barman backup main_pg<\/code><\/pre>\n<p>WAL dosyalar\u0131 <code>archive_command<\/code> veya <code>streaming_wal<\/code> sayesinde s\u00fcrekli olarak Barman sunucusuna g\u00f6nderildi\u011fi i\u00e7in, tam yedeklemeler aras\u0131nda olu\u015fan de\u011fi\u015fiklikler de korunur.<\/p>\n<h3>Veritaban\u0131 Geri Y\u00fckleme \u0130\u015flemleri (Point-in-Time Recovery &#8211; PITR)<\/h3>\n<p>Barman&#8217;\u0131n en g\u00fc\u00e7l\u00fc \u00f6zelliklerinden biri, veritaban\u0131n\u0131 belirli bir zamana geri y\u00fckleme yetene\u011fidir (PITR). Bu, veri kayb\u0131 veya bozulmas\u0131 durumunda kritik \u00f6neme sahiptir.<\/p>\n<h4>Senaryo: Veritaban\u0131 Bozulmas\u0131 veya Yanl\u0131\u015fl\u0131kla Silme<\/h4>\n<p>Diyelim ki PostgreSQL sunucusunda kritik bir tablo yanl\u0131\u015fl\u0131kla silindi veya veritaban\u0131 bozuldu. Veritaban\u0131n\u0131 belirli bir zamana (\u00f6rne\u011fin, silinme olay\u0131ndan hemen \u00f6nceki ana) geri y\u00fcklememiz gerekiyor.<\/p>\n<p>1.  <strong>Geri Y\u00fcklenecek Sunucuyu Haz\u0131rlama:<\/strong><br \/>\n    *   Bu, orijinal PostgreSQL sunucusu veya yeni bir sunucu olabilir. Yeni bir sunucu kullan\u0131l\u0131yorsa, PostgreSQL&#8217;in kurulu olmas\u0131 ancak \u00e7al\u0131\u015fm\u0131yor olmas\u0131 gerekir.<br \/>\n    *   E\u011fer orijinal sunucuyu kullan\u0131yorsan\u0131z, PostgreSQL hizmetini durdurun ve mevcut veri dizinini yedekleyin veya silin (dikkatli olun!).<\/p>\n<pre><code class=\"language-bash\">sudo systemctl stop postgresql-12\n        sudo rm -rf \/var\/lib\/pgsql\/12\/data\/* # Sadece test ortam\u0131nda yap\u0131n!<\/code><\/pre>\n<p>    *   Yeni bir veri dizini olu\u015fturun ve <code>postgres<\/code> kullan\u0131c\u0131s\u0131na ait oldu\u011fundan emin olun.<\/p>\n<pre><code class=\"language-bash\">sudo mkdir -p \/var\/lib\/pgsql\/12\/data_restore\n        sudo chown postgres:postgres \/var\/lib\/pgsql\/12\/data_restore\n        sudo chmod 700 \/var\/lib\/pgsql\/12\/data_restore<\/code><\/pre>\n<p>2.  <strong>Barman ile Geri Y\u00fckleme:<\/strong><br \/>\n    *   Barman sunucusunda <code>barman<\/code> kullan\u0131c\u0131s\u0131 olarak geri y\u00fckleme i\u015flemini ba\u015flat\u0131n.<br \/>\n    *   \u00d6nce mevcut yedeklemeleri ve kurtarma noktalar\u0131n\u0131 kontrol edin:<\/p>\n<pre><code class=\"language-bash\">barman list-backup main_pg\n        # Geri y\u00fcklemek istedi\u011finiz yedeklemenin kimli\u011fini (\u00f6rne\u011fin, 20230315T010000) ve kurtarma zaman\u0131n\u0131 not al\u0131n.<\/code><\/pre>\n<p>    *   Belirli bir zamana geri y\u00fckleme:<\/p>\n<pre><code class=\"language-bash\">barman recover --target-time \"2023-03-15 10:30:00.000000+03\" main_pg 20230315T010000 \/var\/lib\/pgsql\/12\/data_restore<\/code><\/pre>\n<p>        *   <code>--target-time<\/code>: Veritaban\u0131n\u0131n geri y\u00fcklenece\u011fi tam zaman damgas\u0131.<br \/>\n        *   <code>main_pg<\/code>: Yedeklemenin al\u0131nd\u0131\u011f\u0131 sunucu ad\u0131.<br \/>\n        *   <code>20230315T010000<\/code>: Geri y\u00fckleme i\u00e7in kullan\u0131lacak temel yedeklemenin kimli\u011fi (en son yedekleme i\u00e7in <code>LATEST<\/code> kullanabilirsiniz).<br \/>\n        *   <code>\/var\/lib\/pgsql\/12\/data_restore<\/code>: Veritaban\u0131 dosyalar\u0131n\u0131n geri y\u00fcklenece\u011fi hedef dizin.<\/p>\n<p>    *   Alternatif olarak, belirli bir i\u015flem kimli\u011fine (<code>--target-xid<\/code>) veya adland\u0131r\u0131lm\u0131\u015f bir kurtarma noktas\u0131na (<code>--target-name<\/code>) da geri y\u00fcklenebilir.<\/p>\n<p>3.  <strong>Geri Y\u00fcklenen Veritaban\u0131n\u0131 Ba\u015flatma:<\/strong><br \/>\n    *   Geri y\u00fckleme i\u015flemi tamamland\u0131\u011f\u0131nda, Barman hedef dizine bir <code>recovery.conf<\/code> (veya PostgreSQL 12 ve sonras\u0131 i\u00e7in <code>postgresql.auto.conf<\/code> i\u00e7inde <code>restore_command<\/code>) dosyas\u0131 olu\u015fturur. Bu dosya, PostgreSQL&#8217;e hangi WAL dosyalar\u0131n\u0131 nereden alaca\u011f\u0131n\u0131 s\u00f6yler.<br \/>\n    *   PostgreSQL veri dizinini geri y\u00fcklenen dizine ba\u011flay\u0131n veya sembolik ba\u011flant\u0131 olu\u015fturun:<\/p>\n<pre><code class=\"language-bash\">sudo rm -rf \/var\/lib\/pgsql\/12\/data # E\u011fer orijinal dizini sildiyseniz\n        sudo ln -s \/var\/lib\/pgsql\/12\/data_restore \/var\/lib\/pgsql\/12\/data\n        sudo chown -h postgres:postgres \/var\/lib\/pgsql\/12\/data # Sembolik ba\u011flant\u0131n\u0131n sahibini ayarla<\/code><\/pre>\n<p>    *   PostgreSQL hizmetini ba\u015flat\u0131n:<\/p>\n<pre><code class=\"language-bash\">sudo systemctl start postgresql-12<\/code><\/pre>\n<p>    *   PostgreSQL, ba\u015flang\u0131\u00e7ta <code>recovery.conf<\/code> dosyas\u0131n\u0131 okuyacak ve hedef zamana ula\u015fana kadar gerekli WAL dosyalar\u0131n\u0131 Barman sunucusundan \u00e7ekecektir. Kurtarma tamamland\u0131\u011f\u0131nda, sunucu normal \u00e7al\u0131\u015fmaya ge\u00e7ecektir.<\/p>\n<p>4.  <strong>Do\u011frulama:<\/strong><br \/>\n    *   Veritaban\u0131na ba\u011flan\u0131n ve verilerin beklendi\u011fi gibi geri y\u00fcklendi\u011fini do\u011frulay\u0131n.<\/p>\n<h3>PostgreSQL Veritaban\u0131 Ta\u015f\u0131ma (Migration)<\/h3>\n<p>Veritaban\u0131 ta\u015f\u0131ma i\u015flemi, asl\u0131nda bir geri y\u00fckleme i\u015fleminin \u00f6zel bir durumudur. Mevcut bir PostgreSQL veritaban\u0131n\u0131 yeni bir sunucuya ta\u015f\u0131mak i\u00e7in Barman&#8217;\u0131 kullanabiliriz.<\/p>\n<h4>Senaryo: Yeni Bir Sunucuya Ge\u00e7i\u015f<\/h4>\n<p>Mevcut PostgreSQL veritaban\u0131m\u0131z\u0131 <code>PG_SERVER<\/code>&#8216;dan tamamen yeni bir sunucu olan <code>NEW_PG_SERVER<\/code>&#8216;a (<code>192.168.1.30<\/code> \u00f6rnek IP) ta\u015f\u0131mak istiyoruz.<\/p>\n<p>1.  <strong>Yeni PostgreSQL Sunucusunu Haz\u0131rlama (NEW_PG_SERVER):<\/strong><br \/>\n    *   Yeni sunucuya CentOS 7 kurun.<br \/>\n    *   PostgreSQL&#8217;i kurun (yukar\u0131daki &#8220;PostgreSQL Sunucusu Kurulumu&#8221; b\u00f6l\u00fcm\u00fcndeki gibi), ancak <code>initdb<\/code> yapmay\u0131n veya hizmeti ba\u015flatmay\u0131n. Sadece paketleri kurun.<br \/>\n    *   <code>postgres<\/code> kullan\u0131c\u0131s\u0131n\u0131 ve gerekli dizinleri olu\u015fturun.<br \/>\n    *   Barman sunucusundan <code>NEW_PG_SERVER<\/code>&#8216;daki <code>postgres<\/code> kullan\u0131c\u0131s\u0131na SSH anahtar tabanl\u0131 eri\u015fimi yap\u0131land\u0131r\u0131n (yukar\u0131daki &#8220;SSH Anahtar Tabanl\u0131 Kimlik Do\u011frulama&#8221; b\u00f6l\u00fcm\u00fcndeki gibi).<\/p>\n<p>2.  <strong>Barman ile Yeni Sunucuya Geri Y\u00fckleme:<\/strong><br \/>\n    *   Barman sunucusunda <code>barman<\/code> kullan\u0131c\u0131s\u0131 olarak geri y\u00fckleme i\u015flemini ba\u015flat\u0131n.<br \/>\n    *   En son tam yedeklemeyi yeni sunucuya geri y\u00fckleyelim:<\/p>\n<pre><code class=\"language-bash\">barman recover --remote-ssh-command \"ssh postgres@192.168.1.30\" main_pg LATEST \/var\/lib\/pgsql\/12\/data<\/code><\/pre>\n<p>        *   <code>--remote-ssh-command<\/code>: Barman&#8217;\u0131n geri y\u00fckleme i\u015flemini uzaktaki <code>NEW_PG_SERVER<\/code> \u00fczerinde <code>postgres<\/code> kullan\u0131c\u0131s\u0131 olarak \u00e7al\u0131\u015ft\u0131rmas\u0131n\u0131 sa\u011flar.<br \/>\n        *   <code>main_pg<\/code>: Kaynak veritaban\u0131 sunucusunun ad\u0131.<br \/>\n        *   <code>LATEST<\/code>: En son tam yedeklemeyi kullan.<br \/>\n        *   <code>\/var\/lib\/pgsql\/12\/data<\/code>: Yeni sunucudaki hedef veri dizini.<\/p>\n<p>3.  <strong>Yeni PostgreSQL Sunucusunu Yap\u0131land\u0131rma ve Ba\u015flatma:<\/strong><br \/>\n    *   Geri y\u00fckleme i\u015flemi tamamland\u0131\u011f\u0131nda, <code>NEW_PG_SERVER<\/code> \u00fczerindeki <code>\/var\/lib\/pgsql\/12\/data<\/code> dizininde veritaban\u0131 dosyalar\u0131 ve bir <code>recovery.conf<\/code> (veya <code>postgresql.auto.conf<\/code> i\u00e7inde <code>restore_command<\/code>) dosyas\u0131 bulunacakt\u0131r.<br \/>\n    *   <code>NEW_PG_SERVER<\/code> \u00fczerindeki <code>postgresql.conf<\/code> ve <code>pg_hba.conf<\/code> dosyalar\u0131n\u0131 eski sunucudaki gibi veya yeni ortam\u0131n gerektirdi\u011fi \u015fekilde d\u00fczenleyin. \u00d6zellikle <code>listen_addresses<\/code>, <code>port<\/code> ve <code>pg_hba.conf<\/code> i\u00e7indeki ba\u011flant\u0131 kurallar\u0131n\u0131 kontrol edin.<br \/>\n    *   PostgreSQL hizmetini ba\u015flat\u0131n:<\/p>\n<pre><code class=\"language-bash\"># NEW_PG_SERVER \u00fczerinde\n        sudo systemctl enable postgresql-12\n        sudo systemctl start postgresql-12<\/code><\/pre>\n<p>    *   PostgreSQL, <code>recovery.conf<\/code> dosyas\u0131n\u0131 kullanarak kurtarma i\u015flemini tamamlayacak ve ard\u0131ndan normal \u00e7al\u0131\u015fmaya ge\u00e7ecektir.<\/p>\n<p>4.  <strong>Ta\u015f\u0131may\u0131 Do\u011frulama ve Uygulamalar\u0131 Y\u00f6nlendirme:<\/strong><br \/>\n    *   Yeni sunucudaki veritaban\u0131na ba\u011flan\u0131n ve verilerin eksiksiz ve do\u011fru oldu\u011funu do\u011frulay\u0131n.<br \/>\n    *   Uygulamalar\u0131n\u0131z\u0131n ve di\u011fer hizmetlerinizin veritaban\u0131 ba\u011flant\u0131 dizelerini yeni sunucunun IP adresine veya DNS ad\u0131na g\u00fcncelleyin.<br \/>\n    *   Eski PostgreSQL sunucusunu durdurmadan \u00f6nce yeni sunucunun tam olarak i\u015flevsel oldu\u011fundan emin olun.<\/p>\n<h3>Bak\u0131m ve En \u0130yi Uygulamalar<\/h3>\n<p>*   <strong>D\u00fczenli Yedekleme Testleri:<\/strong> Yedeklemelerinizin ger\u00e7ekten geri y\u00fcklenebilir oldu\u011funu d\u00fczenli olarak test edin. Bir yedekleme, geri y\u00fcklenemiyorsa hi\u00e7bir i\u015fe yaramaz.<br \/>\n*   <strong>Disk Alan\u0131 Y\u00f6netimi:<\/strong> Barman sunucusunda yeterli disk alan\u0131 oldu\u011fundan emin olun. <code>barman status<\/code> komutu ile disk kullan\u0131m\u0131n\u0131 izleyebilirsiniz. <code>retention_policy<\/code> ayar\u0131 eski yedeklemeleri otomatik olarak siler, ancak bu politikay\u0131 dikkatlice yap\u0131land\u0131rmal\u0131s\u0131n\u0131z.<br \/>\n*   <strong>\u0130zleme ve Uyar\u0131lar:<\/strong> Barman g\u00fcnl\u00fcklerini (<code>\/var\/log\/barman.log<\/code>) ve yedekleme durumunu izleyin. Yedekleme hatalar\u0131 veya WAL ar\u015fivleme sorunlar\u0131 i\u00e7in uyar\u0131lar kurun.<br \/>\n*   <strong>G\u00fcvenlik:<\/strong> SSH anahtarlar\u0131n\u0131z\u0131 g\u00fcvende tutun. Barman ve PostgreSQL i\u00e7in ayr\u0131lm\u0131\u015f kullan\u0131c\u0131lar kullan\u0131n. G\u00fcvenlik duvar\u0131 kurallar\u0131n\u0131z\u0131 s\u0131k\u0131 tutun.<br \/>\n*   <strong>Replikasyon Yuvalar\u0131 (Replication Slots):<\/strong> PostgreSQL 9.4 ve sonras\u0131 i\u00e7in <code>slot_name<\/code> kullanmak, Barman&#8217;\u0131n t\u00fcm WAL dosyalar\u0131n\u0131 almas\u0131n\u0131 garanti eder ve veri kayb\u0131n\u0131 \u00f6nler. Bu, <code>archive_command<\/code>&#8216;\u0131n olas\u0131 hatalar\u0131ndan kaynaklanabilecek WAL kayb\u0131n\u0131 engeller.<br \/>\n*   <strong><code>backup_method = postgres<\/code>:<\/strong> <code>rsync<\/code> yerine <code>postgres<\/code> (<code>pg_basebackup<\/code>) yedekleme y\u00f6ntemini kullanmak genellikle daha g\u00fcvenilir ve daha az yap\u0131land\u0131rma gerektirir, \u00e7\u00fcnk\u00fc PostgreSQL&#8217;in kendi yerle\u015fik yedekleme mekanizmas\u0131n\u0131 kullan\u0131r.<\/p>\n<h3>S\u0131k Kar\u015f\u0131la\u015f\u0131lan Sorunlar ve Giderilmesi<\/h3>\n<p>*   <strong>SSH Ba\u011flant\u0131 Sorunlar\u0131:<\/strong> <code>ssh-copy-id<\/code> ad\u0131mlar\u0131n\u0131 dikkatlice kontrol edin. <code>~\/.ssh\/authorized_keys<\/code> dosyas\u0131ndaki izinlerin (<code>600<\/code>) ve dizin izinlerinin (<code>700<\/code>) do\u011fru oldu\u011fundan emin olun. <code>ssh -vvv<\/code> ile detayl\u0131 hata ay\u0131klama yap\u0131n.<br \/>\n*   <strong><code>barman check<\/code> Hatalar\u0131:<\/strong> \u00c7\u0131kt\u0131y\u0131 dikkatlice okuyun. Genellikle <code>conninfo<\/code> veya <code>ssh_command<\/code> parametrelerindeki yanl\u0131\u015fl\u0131klar, PostgreSQL yap\u0131land\u0131rma sorunlar\u0131 (<code>wal_level<\/code>, <code>archive_mode<\/code>, <code>archive_command<\/code>) veya <code>pg_hba.conf<\/code> izinleri ile ilgilidir.<br \/>\n*   <strong>WAL Ar\u015fivleme Hatalar\u0131:<\/strong> <code>archive_command<\/code> i\u00e7indeki yolun do\u011fru oldu\u011fundan, Barman sunucusunda hedef dizinin var oldu\u011fundan ve <code>postgres<\/code> kullan\u0131c\u0131s\u0131n\u0131n o dizine yazma iznine sahip oldu\u011fundan emin olun. PostgreSQL sunucusunun g\u00fcnl\u00fcklerini kontrol edin.<br \/>\n*   <strong>Disk Alan\u0131 T\u00fckenmesi:<\/strong> Barman sunucusundaki disk alan\u0131n\u0131 d\u00fczenli olarak izleyin. <code>retention_policy<\/code> ayar\u0131n\u0131z\u0131 g\u00f6zden ge\u00e7irin veya eski yedeklemeleri manuel olarak silmek i\u00e7in <code>barman delete<\/code> komutunu kullan\u0131n.<br \/>\n*   <strong>SELinux Engellemeleri:<\/strong> E\u011fer SELinux etkinse, Barman&#8217;\u0131n PostgreSQL dizinlerine veya yedekleme dizinlerine eri\u015fimini engelleyebilir. SELinux g\u00fcnl\u00fcklerini (<code>\/var\/log\/audit\/audit.log<\/code>) kontrol edin ve gerekli kurallar\u0131 ekleyin veya SELinux&#8217;u ge\u00e7ici olarak devre d\u0131\u015f\u0131 b\u0131rak\u0131n (<code>setenforce 0<\/code>).<\/p>\n<h3>Sonu\u00e7<\/h3>\n<p>Barman, PostgreSQL veritabanlar\u0131 i\u00e7in kapsaml\u0131 ve g\u00fcvenilir bir yedekleme, geri y\u00fckleme ve felaket kurtarma \u00e7\u00f6z\u00fcm\u00fc sunar. Bu makalede, CentOS 7 \u00fczerinde Barman&#8217;\u0131 kullanarak PostgreSQL veritabanlar\u0131n\u0131 nas\u0131l yedekleyece\u011finizi, belirli bir zamana nas\u0131l geri y\u00fckleyece\u011finizi ve farkl\u0131 bir sunucuya nas\u0131l ta\u015f\u0131yaca\u011f\u0131n\u0131z\u0131 ad\u0131m ad\u0131m \u00f6\u011frendiniz. Barman&#8217;\u0131n sundu\u011fu Point-in-Time Recovery (PITR) yetene\u011fi, veri kayb\u0131 senaryolar\u0131nda veritaban\u0131n\u0131z\u0131 kritik bir \u00f6nceki duruma geri d\u00f6nd\u00fcrme esnekli\u011fi sa\u011flayarak i\u015f s\u00fcreklili\u011fi i\u00e7in hayati bir ara\u00e7 haline getirir.<\/p>\n<p>Unutmay\u0131n ki herhangi bir yedekleme stratejisinin ba\u015far\u0131s\u0131, yedeklemelerin d\u00fczenli olarak test edilmesine ve yedekleme ortam\u0131n\u0131n do\u011fru bir \u015fekilde izlenmesine ba\u011fl\u0131d\u0131r. Barman ile sa\u011flam bir yedekleme altyap\u0131s\u0131 kurarak, PostgreSQL veritabanlar\u0131n\u0131z\u0131n g\u00fcvenli\u011fini ve kullan\u0131labilirli\u011fini \u00f6nemli \u00f6l\u00e7\u00fcde art\u0131rabilirsiniz. G\u00fcvenilir bir yedekleme plan\u0131, her veritaban\u0131 y\u00f6neticisinin ara\u00e7 setinin vazge\u00e7ilmez bir par\u00e7as\u0131 olmal\u0131d\u0131r.<\/body><\/p>\n","protected":false},"excerpt":{"rendered":"Barman Kullanarak CentOS 7 \u00dczerinde PostgreSQL Veritabanlar\u0131n\u0131 Yedekleme, Geri Y\u00fckleme ve Ta\u015f\u0131ma\nPostgreSQL, g\u00fcvenilirli\u011fi, g\u00fc\u00e7l\u00fc \u00f6zellik","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"csco_page_header_type":"","csco_page_load_nextpost":"","csco_page_subscribe_form":"","csco_page_contact_form":"","footnotes":""},"categories":[241],"tags":[],"class_list":{"0":"post-32054","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-linux","7":"cs-entry","8":"cs-video-wrap"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v20.5 (Yoast SEO v25.3.1) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Barman Kullanarak CentOS 7 \u00dczerinde PostgreSQL Veritabanlar\u0131n\u0131 Yedekleme, Geri Y\u00fckleme ve Ta\u015f\u0131ma - Kodlar\u0131n Gizemli D\u00fcnyas\u0131<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/fatihsoysal.com\/blog\/barman-kullanarak-centos-7-uzerinde-postgresql-veritabanlarini-yedekleme-geri-yukleme-ve-tasima\/\" \/>\n<meta property=\"og:locale\" content=\"tr_TR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Barman Kullanarak CentOS 7 \u00dczerinde PostgreSQL Veritabanlar\u0131n\u0131 Yedekleme, Geri Y\u00fckleme ve Ta\u015f\u0131ma\" \/>\n<meta property=\"og:description\" content=\"Barman Kullanarak CentOS 7 \u00dczerinde PostgreSQL Veritabanlar\u0131n\u0131 Yedekleme, Geri Y\u00fckleme ve Ta\u015f\u0131ma PostgreSQL, g\u00fcvenilirli\u011fi, g\u00fc\u00e7l\u00fc \u00f6zellik\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fatihsoysal.com\/blog\/barman-kullanarak-centos-7-uzerinde-postgresql-veritabanlarini-yedekleme-geri-yukleme-ve-tasima\/\" \/>\n<meta property=\"og:site_name\" content=\"Kodlar\u0131n Gizemli D\u00fcnyas\u0131\" \/>\n<meta property=\"article:published_time\" content=\"2025-10-17T02:41:03+00:00\" \/>\n<meta name=\"author\" content=\"Fatih Soysal\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Yazan:\" \/>\n\t<meta name=\"twitter:data1\" content=\"Fatih Soysal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Tahmini okuma s\u00fcresi\" \/>\n\t<meta name=\"twitter:data2\" content=\"19 dakika\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/barman-kullanarak-centos-7-uzerinde-postgresql-veritabanlarini-yedekleme-geri-yukleme-ve-tasima\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/barman-kullanarak-centos-7-uzerinde-postgresql-veritabanlarini-yedekleme-geri-yukleme-ve-tasima\/\"},\"author\":{\"name\":\"Fatih Soysal\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\"},\"headline\":\"Barman Kullanarak CentOS 7 \u00dczerinde PostgreSQL Veritabanlar\u0131n\u0131 Yedekleme, Geri Y\u00fckleme ve Ta\u015f\u0131ma\",\"datePublished\":\"2025-10-17T02:41:03+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/barman-kullanarak-centos-7-uzerinde-postgresql-veritabanlarini-yedekleme-geri-yukleme-ve-tasima\/\"},\"wordCount\":2922,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\"},\"articleSection\":[\"Linux\"],\"inLanguage\":\"tr\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/fatihsoysal.com\/blog\/barman-kullanarak-centos-7-uzerinde-postgresql-veritabanlarini-yedekleme-geri-yukleme-ve-tasima\/#respond\"]}],\"copyrightYear\":\"2025\",\"copyrightHolder\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/barman-kullanarak-centos-7-uzerinde-postgresql-veritabanlarini-yedekleme-geri-yukleme-ve-tasima\/\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/barman-kullanarak-centos-7-uzerinde-postgresql-veritabanlarini-yedekleme-geri-yukleme-ve-tasima\/\",\"name\":\"Barman Kullanarak CentOS 7 \u00dczerinde PostgreSQL Veritabanlar\u0131n\u0131 Yedekleme, Geri Y\u00fckleme ve Ta\u015f\u0131ma - Kodlar\u0131n Gizemli D\u00fcnyas\u0131\",\"isPartOf\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#website\"},\"datePublished\":\"2025-10-17T02:41:03+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/barman-kullanarak-centos-7-uzerinde-postgresql-veritabanlarini-yedekleme-geri-yukleme-ve-tasima\/#breadcrumb\"},\"inLanguage\":\"tr\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/fatihsoysal.com\/blog\/barman-kullanarak-centos-7-uzerinde-postgresql-veritabanlarini-yedekleme-geri-yukleme-ve-tasima\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/barman-kullanarak-centos-7-uzerinde-postgresql-veritabanlarini-yedekleme-geri-yukleme-ve-tasima\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Anasayfa\",\"item\":\"https:\/\/fatihsoysal.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Barman Kullanarak CentOS 7 \u00dczerinde PostgreSQL Veritabanlar\u0131n\u0131 Yedekleme, Geri Y\u00fckleme ve Ta\u015f\u0131ma\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#website\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/\",\"name\":\"Fatihsoysal.com\",\"description\":\"Blog - Yaz\u0131l\u0131m D\u00fcnyas\u0131 Tecr\u00fcbelerim\",\"publisher\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/fatihsoysal.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"tr\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\",\"name\":\"Fatih Soysal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"tr\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png\",\"contentUrl\":\"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png\",\"width\":512,\"height\":512,\"caption\":\"Fatih Soysal\"},\"logo\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/\"},\"description\":\"Kullan\u0131m ve kodlama m\u00fckemmeliyetini odak alan uygulamalar olu\u015fturma deneyimine sahip, profesyonel olarak 15+ y\u0131l \u00fczeri deneyime sahip bir yaz\u0131l\u0131m m\u00fchendisi.\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/author\/fatihsoysal\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Barman Kullanarak CentOS 7 \u00dczerinde PostgreSQL Veritabanlar\u0131n\u0131 Yedekleme, Geri Y\u00fckleme ve Ta\u015f\u0131ma - Kodlar\u0131n Gizemli D\u00fcnyas\u0131","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/fatihsoysal.com\/blog\/barman-kullanarak-centos-7-uzerinde-postgresql-veritabanlarini-yedekleme-geri-yukleme-ve-tasima\/","og_locale":"tr_TR","og_type":"article","og_title":"Barman Kullanarak CentOS 7 \u00dczerinde PostgreSQL Veritabanlar\u0131n\u0131 Yedekleme, Geri Y\u00fckleme ve Ta\u015f\u0131ma","og_description":"Barman Kullanarak CentOS 7 \u00dczerinde PostgreSQL Veritabanlar\u0131n\u0131 Yedekleme, Geri Y\u00fckleme ve Ta\u015f\u0131ma PostgreSQL, g\u00fcvenilirli\u011fi, g\u00fc\u00e7l\u00fc \u00f6zellik","og_url":"https:\/\/fatihsoysal.com\/blog\/barman-kullanarak-centos-7-uzerinde-postgresql-veritabanlarini-yedekleme-geri-yukleme-ve-tasima\/","og_site_name":"Kodlar\u0131n Gizemli D\u00fcnyas\u0131","article_published_time":"2025-10-17T02:41:03+00:00","author":"Fatih Soysal","twitter_card":"summary_large_image","twitter_misc":{"Yazan:":"Fatih Soysal","Tahmini okuma s\u00fcresi":"19 dakika"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fatihsoysal.com\/blog\/barman-kullanarak-centos-7-uzerinde-postgresql-veritabanlarini-yedekleme-geri-yukleme-ve-tasima\/#article","isPartOf":{"@id":"https:\/\/fatihsoysal.com\/blog\/barman-kullanarak-centos-7-uzerinde-postgresql-veritabanlarini-yedekleme-geri-yukleme-ve-tasima\/"},"author":{"name":"Fatih Soysal","@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1"},"headline":"Barman Kullanarak CentOS 7 \u00dczerinde PostgreSQL Veritabanlar\u0131n\u0131 Yedekleme, Geri Y\u00fckleme ve Ta\u015f\u0131ma","datePublished":"2025-10-17T02:41:03+00:00","mainEntityOfPage":{"@id":"https:\/\/fatihsoysal.com\/blog\/barman-kullanarak-centos-7-uzerinde-postgresql-veritabanlarini-yedekleme-geri-yukleme-ve-tasima\/"},"wordCount":2922,"commentCount":0,"publisher":{"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1"},"articleSection":["Linux"],"inLanguage":"tr","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fatihsoysal.com\/blog\/barman-kullanarak-centos-7-uzerinde-postgresql-veritabanlarini-yedekleme-geri-yukleme-ve-tasima\/#respond"]}],"copyrightYear":"2025","copyrightHolder":{"@id":"https:\/\/fatihsoysal.com\/blog\/#organization"}},{"@type":"WebPage","@id":"https:\/\/fatihsoysal.com\/blog\/barman-kullanarak-centos-7-uzerinde-postgresql-veritabanlarini-yedekleme-geri-yukleme-ve-tasima\/","url":"https:\/\/fatihsoysal.com\/blog\/barman-kullanarak-centos-7-uzerinde-postgresql-veritabanlarini-yedekleme-geri-yukleme-ve-tasima\/","name":"Barman Kullanarak CentOS 7 \u00dczerinde PostgreSQL Veritabanlar\u0131n\u0131 Yedekleme, Geri Y\u00fckleme ve Ta\u015f\u0131ma - Kodlar\u0131n Gizemli D\u00fcnyas\u0131","isPartOf":{"@id":"https:\/\/fatihsoysal.com\/blog\/#website"},"datePublished":"2025-10-17T02:41:03+00:00","breadcrumb":{"@id":"https:\/\/fatihsoysal.com\/blog\/barman-kullanarak-centos-7-uzerinde-postgresql-veritabanlarini-yedekleme-geri-yukleme-ve-tasima\/#breadcrumb"},"inLanguage":"tr","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fatihsoysal.com\/blog\/barman-kullanarak-centos-7-uzerinde-postgresql-veritabanlarini-yedekleme-geri-yukleme-ve-tasima\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/fatihsoysal.com\/blog\/barman-kullanarak-centos-7-uzerinde-postgresql-veritabanlarini-yedekleme-geri-yukleme-ve-tasima\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Anasayfa","item":"https:\/\/fatihsoysal.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Barman Kullanarak CentOS 7 \u00dczerinde PostgreSQL Veritabanlar\u0131n\u0131 Yedekleme, Geri Y\u00fckleme ve Ta\u015f\u0131ma"}]},{"@type":"WebSite","@id":"https:\/\/fatihsoysal.com\/blog\/#website","url":"https:\/\/fatihsoysal.com\/blog\/","name":"Fatihsoysal.com","description":"Blog - Yaz\u0131l\u0131m D\u00fcnyas\u0131 Tecr\u00fcbelerim","publisher":{"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fatihsoysal.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"tr"},{"@type":["Person","Organization"],"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1","name":"Fatih Soysal","image":{"@type":"ImageObject","inLanguage":"tr","@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png","contentUrl":"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png","width":512,"height":512,"caption":"Fatih Soysal"},"logo":{"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/"},"description":"Kullan\u0131m ve kodlama m\u00fckemmeliyetini odak alan uygulamalar olu\u015fturma deneyimine sahip, profesyonel olarak 15+ y\u0131l \u00fczeri deneyime sahip bir yaz\u0131l\u0131m m\u00fchendisi.","url":"https:\/\/fatihsoysal.com\/blog\/author\/fatihsoysal\/"}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts\/32054","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/comments?post=32054"}],"version-history":[{"count":1,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts\/32054\/revisions"}],"predecessor-version":[{"id":32055,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts\/32054\/revisions\/32055"}],"wp:attachment":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/media?parent=32054"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/categories?post=32054"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/tags?post=32054"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}