{"id":31096,"date":"2025-10-05T17:41:58","date_gmt":"2025-10-05T14:41:58","guid":{"rendered":"https:\/\/fatihsoysal.com\/blog\/?p=31096"},"modified":"2025-10-05T17:41:58","modified_gmt":"2025-10-05T14:41:58","slug":"postgresqli-ruby-on-rails-uygulamanizla-ubuntu-14-04-uzerinde-kullanma-rehberi","status":"publish","type":"post","link":"https:\/\/fatihsoysal.com\/blog\/postgresqli-ruby-on-rails-uygulamanizla-ubuntu-14-04-uzerinde-kullanma-rehberi\/","title":{"rendered":"PostgreSQL&#8217;i Ruby on Rails Uygulaman\u0131zla Ubuntu 14.04 \u00dczerinde Kullanma Rehberi"},"content":{"rendered":"<p><body><\/p>\n<h2>PostgreSQL&#8217;i Ruby on Rails Uygulaman\u0131zla Ubuntu 14.04 \u00dczerinde Kullanma Rehberi<\/h2>\n<p>Bu kapsaml\u0131 rehber, Ruby on Rails uygulamalar\u0131n\u0131z\u0131 Ubuntu 14.04 i\u015fletim sistemi \u00fczerinde g\u00fc\u00e7l\u00fc ve g\u00fcvenilir bir ili\u015fkisel veritaban\u0131 y\u00f6netim sistemi olan PostgreSQL ile nas\u0131l entegre edece\u011finizi ad\u0131m ad\u0131m a\u00e7\u0131klamaktad\u0131r. Geli\u015ftirme ortam\u0131 kurulumundan \u00fcretim ortam\u0131 ipu\u00e7lar\u0131na kadar t\u00fcm s\u00fcre\u00e7 detayl\u0131 bir \u015fekilde ele al\u0131nacakt\u0131r.<\/p>\n<h3>Giri\u015f<\/h3>\n<p>Web uygulamalar\u0131 geli\u015ftirirken, verilerin depolanmas\u0131 ve y\u00f6netilmesi kritik bir \u00f6neme sahiptir. Ruby on Rails, geli\u015ftiricilere h\u0131zl\u0131 ve etkin bir \u015fekilde web uygulamalar\u0131 olu\u015fturma imkan\u0131 sunarken, veritaban\u0131 soyutlamas\u0131 sayesinde farkl\u0131 veritaban\u0131 sistemleriyle kolayca entegre olabilir. Varsay\u0131lan olarak SQLite ile gelen Rails, daha b\u00fcy\u00fck \u00f6l\u00e7ekli ve \u00fcretim ortam\u0131na haz\u0131r uygulamalar i\u00e7in genellikle PostgreSQL veya MySQL gibi daha g\u00fc\u00e7l\u00fc veritaban\u0131 \u00e7\u00f6z\u00fcmlerini tercih eder.<\/p>\n<p>Ubuntu 14.04, uzun s\u00fcreli destek (LTS) sa\u011flayan eski bir i\u015fletim sistemi s\u00fcr\u00fcm\u00fc olmas\u0131na ra\u011fmen, hala bir\u00e7ok sunucu ve geli\u015ftirme ortam\u0131nda kullan\u0131lmaktad\u0131r. Bu makale, bu \u00f6zel ortamda PostgreSQL&#8217;in kurulumu, yap\u0131land\u0131r\u0131lmas\u0131 ve Rails uygulaman\u0131zla sorunsuz bir \u015fekilde \u00e7al\u0131\u015fmas\u0131 i\u00e7in gereken t\u00fcm ad\u0131mlar\u0131 i\u00e7erecektir. Amac\u0131m\u0131z, bu s\u00fcre\u00e7te kar\u015f\u0131la\u015fabilece\u011finiz potansiyel zorluklar\u0131 a\u015fman\u0131za yard\u0131mc\u0131 olmak ve uygulaman\u0131z\u0131n veritaban\u0131 katman\u0131n\u0131 sa\u011flam temeller \u00fczerine in\u015fa etmenizi sa\u011flamakt\u0131r.<\/p>\n<h3>Neden PostgreSQL?<\/h3>\n<p>Rails uygulamalar\u0131 i\u00e7in bir\u00e7ok veritaban\u0131 se\u00e7ene\u011fi bulunsa da, PostgreSQL s\u0131kl\u0131kla tercih edilen bir \u00e7\u00f6z\u00fcmd\u00fcr. Bunun birka\u00e7 \u00f6nemli nedeni vard\u0131r:<\/p>\n<h4>G\u00fcvenilirlik ve Veri B\u00fct\u00fcnl\u00fc\u011f\u00fc<\/h4>\n<p>PostgreSQL, ACID (Atomicity, Consistency, Isolation, Durability) prensiplerine s\u0131k\u0131 s\u0131k\u0131ya ba\u011fl\u0131 kalarak veri b\u00fct\u00fcnl\u00fc\u011f\u00fcn\u00fc en \u00fcst d\u00fczeyde tutar. \u0130\u015flem y\u00f6netimi, kilit mekanizmalar\u0131 ve kurtarma yetenekleri sayesinde veri kayb\u0131 riskini minimize eder ve y\u00fcksek g\u00fcvenilirlik sunar. \u00d6zellikle finans, sa\u011fl\u0131k gibi kritik verilerin i\u015flendi\u011fi uygulamalar i\u00e7in bu \u00f6zellik vazge\u00e7ilmezdir.<\/p>\n<h4>Geli\u015fmi\u015f \u00d6zellikler ve Geni\u015fletilebilirlik<\/h4>\n<p>PostgreSQL, geleneksel ili\u015fkisel veritaban\u0131 \u00f6zelliklerinin \u00f6tesinde zengin bir \u00f6zellik seti sunar. JSONB deste\u011fi sayesinde belge tabanl\u0131 verileri etkin bir \u015fekilde saklayabilir ve sorgulayabilir, co\u011frafi bilgi sistemleri (GIS) i\u00e7in PostGIS gibi g\u00fc\u00e7l\u00fc uzant\u0131larla konum tabanl\u0131 uygulamalar geli\u015ftirebilirsiniz. Ayr\u0131ca, stored procedure&#8217;lar, view&#8217;lar, trigger&#8217;lar, user-defined tipler ve fonksiyonlar gibi geli\u015fmi\u015f \u00f6zellikler sayesinde karma\u015f\u0131k i\u015f mant\u0131klar\u0131n\u0131 veritaban\u0131 seviyesinde uygulayabilirsiniz. A\u00e7\u0131k kaynak yap\u0131s\u0131, s\u00fcrekli yeni uzant\u0131lar\u0131n ve \u00f6zelliklerin geli\u015ftirilmesine olanak tan\u0131r.<\/p>\n<h4>Performans<\/h4>\n<p>Do\u011fru yap\u0131land\u0131r\u0131ld\u0131\u011f\u0131nda ve optimize edildi\u011finde PostgreSQL, y\u00fcksek performansl\u0131 uygulamalar i\u00e7in m\u00fckemmel bir temel sa\u011flar. Geli\u015fmi\u015f sorgu planlay\u0131c\u0131s\u0131, indeksleme se\u00e7enekleri (B-tree, GiST, GIN, SP-GiST, BRIN), ba\u011flant\u0131 havuzlama ve e\u015fzamanl\u0131l\u0131k kontrol\u00fc (MVCC &#8211; Multi-Version Concurrency Control) gibi \u00f6zellikler sayesinde yo\u011fun y\u00fck alt\u0131ndaki sistemlerde bile h\u0131zl\u0131 yan\u0131t s\u00fcreleri sunabilir.<\/p>\n<h4>Topluluk Deste\u011fi ve A\u00e7\u0131k Kaynak<\/h4>\n<p>PostgreSQL, g\u00fc\u00e7l\u00fc ve aktif bir a\u00e7\u0131k kaynak toplulu\u011funa sahiptir. Bu topluluk, s\u00fcrekli olarak yeni \u00f6zellikler geli\u015ftirir, hatalar\u0131 d\u00fczeltir ve kullan\u0131c\u0131lara destek sa\u011flar. Kapsaml\u0131 dok\u00fcmantasyon, forumlar ve mailing listeleri arac\u0131l\u0131\u011f\u0131yla kar\u015f\u0131la\u015f\u0131lan sorunlara h\u0131zl\u0131ca \u00e7\u00f6z\u00fcm bulmak m\u00fcmk\u00fcnd\u00fcr. A\u00e7\u0131k kaynak olmas\u0131, lisans maliyetlerini ortadan kald\u0131r\u0131r ve yaz\u0131l\u0131m\u0131n \u015feffaf bir \u015fekilde incelenmesine olanak tan\u0131r.<\/p>\n<h3>\u00d6n Gereksinimler<\/h3>\n<p>Bu rehbere ba\u015flamadan \u00f6nce a\u015fa\u011f\u0131daki \u00f6n gereksinimlerin sisteminizde kurulu ve yap\u0131land\u0131r\u0131lm\u0131\u015f olmas\u0131 gerekmektedir:<\/p>\n<h4>Ubuntu 14.04 \u0130\u015fletim Sistemi<\/h4>\n<p>Bu rehber, Ubuntu 14.04 (Trusty Tahr) \u00fczerinde \u00e7al\u0131\u015facak \u015fekilde tasarlanm\u0131\u015ft\u0131r. Di\u011fer Ubuntu veya Linux da\u011f\u0131t\u0131mlar\u0131nda ad\u0131mlar benzer olsa da, baz\u0131 paket isimleri veya komutlar farkl\u0131l\u0131k g\u00f6sterebilir. Sunucunuzun g\u00fcncel oldu\u011fundan emin olmak i\u00e7in a\u015fa\u011f\u0131daki komutlar\u0131 \u00e7al\u0131\u015ft\u0131r\u0131n:<\/p>\n<pre><code class=\"language-bash\">sudo apt-get update\nsudo apt-get upgrade<\/code><\/pre>\n<h4>Ruby ve Ruby on Rails Kurulumu<\/h4>\n<p>Sisteminizde belirli bir Ruby s\u00fcr\u00fcm\u00fcn\u00fcn (tercihen 2.x veya \u00fczeri) ve Rails&#8217;in (tercihen 4.x veya \u00fczeri, Ubuntu 14.04 d\u00f6neminde pop\u00fcler olan s\u00fcr\u00fcmler) kurulu olmas\u0131 gerekmektedir. Ruby s\u00fcr\u00fcmlerini y\u00f6netmek i\u00e7in RVM (Ruby Version Manager) veya rbenv gibi ara\u00e7lar kullanman\u0131z \u015fiddetle tavsiye edilir. Bu, farkl\u0131 projeler i\u00e7in farkl\u0131 Ruby s\u00fcr\u00fcmlerini izole etmenizi sa\u011flar.<\/p>\n<p><strong>RVM ile Ruby ve Rails kurulumu (\u00d6rnek):<\/strong><\/p>\n<pre><code class=\"language-bash\">gpg --keyserver hkp:\/\/keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3\n\\curl -sSL https:\/\/get.rvm.io | bash -s stable --ruby\nsource ~\/.rvm\/scripts\/rvm\nrvm install 2.3.1 # Ubuntu 14.04 d\u00f6neminde pop\u00fcler olabilecek bir s\u00fcr\u00fcm\nrvm use 2.3.1 --default\ngem install rails -v 4.2.11 # Ubuntu 14.04 d\u00f6neminde pop\u00fcler olabilecek bir s\u00fcr\u00fcm<\/code><\/pre>\n<h4>Temel Linux Komut Bilgisi<\/h4>\n<p>Terminalde temel komutlar\u0131 (cd, ls, sudo, apt-get, nano\/vim vb.) kullanma konusunda rahat olman\u0131z beklenmektedir.<\/p>\n<h3>PostgreSQL Kurulumu<\/h3>\n<p>Ubuntu 14.04 \u00fczerinde PostgreSQL kurulumu <code>apt-get<\/code> paket y\u00f6neticisi arac\u0131l\u0131\u011f\u0131yla olduk\u00e7a basittir.<\/p>\n<h4>Paket Deposu G\u00fcncelleme<\/h4>\n<p>\u0130lk olarak, paket listenizi g\u00fcncelleyerek en son paket bilgilerini ald\u0131\u011f\u0131n\u0131zdan emin olun:<\/p>\n<pre><code class=\"language-bash\">sudo apt-get update<\/code><\/pre>\n<h4>PostgreSQL Sunucusunu Kurma<\/h4>\n<p>PostgreSQL sunucusunu ve ilgili istemci ara\u00e7lar\u0131n\u0131 kurmak i\u00e7in a\u015fa\u011f\u0131daki komutu kullan\u0131n:<\/p>\n<pre><code class=\"language-bash\">sudo apt-get install postgresql postgresql-contrib libpq-dev<\/code><\/pre>\n<p>*   <code>postgresql<\/code>: PostgreSQL sunucu paketini kurar.<br \/>\n*   <code>postgresql-contrib<\/code>: PostgreSQL i\u00e7in ek mod\u00fcller ve yard\u0131mc\u0131 programlar i\u00e7erir.<br \/>\n*   <code>libpq-dev<\/code>: PostgreSQL istemci k\u00fct\u00fcphaneleri i\u00e7in geli\u015ftirme ba\u015fl\u0131klar\u0131n\u0131 ve statik k\u00fct\u00fcphaneleri i\u00e7erir. Bu paket, Rails uygulaman\u0131z\u0131n PostgreSQL veritaban\u0131na ba\u011flanmak i\u00e7in kulland\u0131\u011f\u0131 <code>pg<\/code> gem&#8217;ini derlemek i\u00e7in gereklidir.<\/p>\n<p>Kurulum tamamland\u0131\u011f\u0131nda, PostgreSQL servisi otomatik olarak ba\u015flat\u0131lacakt\u0131r. Servisin durumunu kontrol etmek i\u00e7in:<\/p>\n<pre><code class=\"language-bash\">sudo service postgresql status<\/code><\/pre>\n<p>\u00c7\u0131kt\u0131da &#8220;running&#8221; veya benzeri bir ifade g\u00f6rmelisiniz.<\/p>\n<h3>PostgreSQL Kullan\u0131c\u0131 ve Veritaban\u0131 Olu\u015fturma<\/h3>\n<p>PostgreSQL, varsay\u0131lan olarak <code>postgres<\/code> adl\u0131 bir s\u00fcper kullan\u0131c\u0131 olu\u015fturur. Bu kullan\u0131c\u0131, sistemdeki <code>postgres<\/code> Linux kullan\u0131c\u0131s\u0131 ile ili\u015fkilidir. Veritaban\u0131 i\u015flemleri i\u00e7in genellikle uygulamaya \u00f6zel kullan\u0131c\u0131lar ve veritabanlar\u0131 olu\u015fturmak en iyi uygulamad\u0131r.<\/p>\n<h4><code>psql<\/code> Komut Sat\u0131r\u0131 Arac\u0131na Eri\u015fim<\/h4>\n<p><code>postgres<\/code> Linux kullan\u0131c\u0131s\u0131na ge\u00e7i\u015f yaparak <code>psql<\/code> komut sat\u0131r\u0131 arac\u0131na eri\u015febilirsiniz:<\/p>\n<pre><code class=\"language-bash\">sudo -i -u postgres\npsql<\/code><\/pre>\n<p>Art\u0131k <code>psql<\/code> istemcisindesiniz. \u00c7\u0131kmak i\u00e7in <code>\\q<\/code> yaz\u0131p Enter tu\u015funa basabilirsiniz.<\/p>\n<h4>Yeni Bir PostgreSQL Kullan\u0131c\u0131s\u0131 Olu\u015fturma<\/h4>\n<p>Rails uygulaman\u0131z i\u00e7in yeni bir veritaban\u0131 kullan\u0131c\u0131s\u0131 olu\u015ftural\u0131m. Bu kullan\u0131c\u0131ya uygulaman\u0131z\u0131n ba\u011flanmas\u0131n\u0131 sa\u011flayaca\u011f\u0131z.<br \/>\n<code>psql<\/code> istemcisindeyken a\u015fa\u011f\u0131daki komutu \u00e7al\u0131\u015ft\u0131r\u0131n. <code>your_username<\/code> ve <code>your_password<\/code> k\u0131s\u0131mlar\u0131n\u0131 kendi se\u00e7ti\u011finiz g\u00fc\u00e7l\u00fc kullan\u0131c\u0131 ad\u0131 ve \u015fifre ile de\u011fi\u015ftirin:<\/p>\n<pre><code class=\"language-sql\">CREATE USER your_username WITH PASSWORD 'your_password';<\/code><\/pre>\n<p><strong>\u00d6nemli:<\/strong> \u00dcretim ortam\u0131nda daima g\u00fc\u00e7l\u00fc ve tahmin edilemez \u015fifreler kullan\u0131n.<\/p>\n<h4>Yeni Bir Veritaban\u0131 Olu\u015fturma<\/h4>\n<p>\u015eimdi Rails uygulaman\u0131z\u0131n kullanaca\u011f\u0131 bir veritaban\u0131 olu\u015ftural\u0131m. <code>your_database_name<\/code> yerine uygulaman\u0131z\u0131n ad\u0131n\u0131 veya uygun bir isim kullan\u0131n. Ayr\u0131ca, bu veritaban\u0131n\u0131n sahibini az \u00f6nce olu\u015fturdu\u011funuz kullan\u0131c\u0131 olarak ayarlayal\u0131m:<\/p>\n<pre><code class=\"language-sql\">CREATE DATABASE your_database_name OWNER your_username;<\/code><\/pre>\n<h4>Kullan\u0131c\u0131ya Veritaban\u0131 Yetkileri Verme<\/h4>\n<p>Olu\u015fturdu\u011funuz kullan\u0131c\u0131n\u0131n veritaban\u0131 \u00fczerinde gerekli yetkilere sahip oldu\u011fundan emin olun:<\/p>\n<pre><code class=\"language-sql\">GRANT ALL PRIVILEGES ON DATABASE your_database_name TO your_username;<\/code><\/pre>\n<p>Bu komut, <code>your_username<\/code> kullan\u0131c\u0131s\u0131na <code>your_database_name<\/code> veritaban\u0131 \u00fczerinde t\u00fcm yetkileri verir. Geli\u015ftirme ortam\u0131 i\u00e7in bu genellikle yeterlidir. \u00dcretim ortam\u0131nda, daha k\u0131s\u0131tl\u0131 yetkiler vermeyi d\u00fc\u015f\u00fcnebilirsiniz.<\/p>\n<p><code>psql<\/code> istemcisinden \u00e7\u0131kmak i\u00e7in <code>\\q<\/code> yaz\u0131n ve Enter&#8217;a bas\u0131n. Ard\u0131ndan <code>exit<\/code> yazarak <code>postgres<\/code> Linux kullan\u0131c\u0131s\u0131ndan kendi kullan\u0131c\u0131n\u0131za geri d\u00f6nebilirsiniz.<\/p>\n<h4><code>pg_hba.conf<\/code> Dosyas\u0131n\u0131 Yap\u0131land\u0131rma (Gerekirse)<\/h4>\n<p>PostgreSQL&#8217;in istemci kimlik do\u011frulama yap\u0131land\u0131rma dosyas\u0131 <code>pg_hba.conf<\/code>&#8216;tur. Bu dosya, hangi kullan\u0131c\u0131lar\u0131n hangi veritabanlar\u0131na hangi IP adreslerinden hangi kimlik do\u011frulama y\u00f6ntemleriyle ba\u011flanabilece\u011fini kontrol eder. Varsay\u0131lan olarak, yerel ba\u011flant\u0131lar genellikle <code>peer<\/code> veya <code>md5<\/code> ile yap\u0131land\u0131r\u0131lm\u0131\u015ft\u0131r.<\/p>\n<p>Dosyay\u0131 d\u00fczenlemek i\u00e7in:<\/p>\n<pre><code class=\"language-bash\">sudo nano \/etc\/postgresql\/9.3\/main\/pg_hba.conf<\/code><\/pre>\n<p>(PostgreSQL s\u00fcr\u00fcm\u00fc 9.3 olabilir, <code>ls \/etc\/postgresql\/<\/code> komutuyla do\u011fru s\u00fcr\u00fcm numaras\u0131n\u0131 kontrol edin).<\/p>\n<p>Genellikle, yerel ba\u011flant\u0131lar i\u00e7in a\u015fa\u011f\u0131daki sat\u0131rlar\u0131 bulacaks\u0131n\u0131z:<\/p>\n<pre><code class=\"language-\"># TYPE  DATABASE        USER            ADDRESS                 METHOD\nlocal   all             postgres                                peer\nlocal   all             all                                     peer\nhost    all             all             127.0.0.1\/32            md5\nhost    all             all             ::1\/128                 md5<\/code><\/pre>\n<p>E\u011fer uygulaman\u0131z farkl\u0131 bir kullan\u0131c\u0131yla veya farkl\u0131 bir IP&#8217;den ba\u011flanacaksa ve <code>peer<\/code> kimlik do\u011frulama y\u00f6ntemi sorun \u00e7\u0131kar\u0131yorsa, <code>md5<\/code> veya <code>trust<\/code> (yaln\u0131zca geli\u015ftirme i\u00e7in) gibi y\u00f6ntemlere ge\u00e7i\u015f yapman\u0131z gerekebilir. \u00d6rne\u011fin, t\u00fcm yerel kullan\u0131c\u0131lar\u0131n <code>md5<\/code> \u015fifreleriyle ba\u011flanmas\u0131na izin vermek i\u00e7in:<\/p>\n<pre><code class=\"language-\"># TYPE  DATABASE        USER            ADDRESS                 METHOD\nlocal   all             all                                     md5\nhost    all             all             127.0.0.1\/32            md5\nhost    all             all             ::1\/128                 md5<\/code><\/pre>\n<p>De\u011fi\u015fiklikleri kaydettikten sonra PostgreSQL servisini yeniden ba\u015flatman\u0131z gerekir:<\/p>\n<pre><code class=\"language-bash\">sudo service postgresql restart<\/code><\/pre>\n<h3>Ruby on Rails Uygulamas\u0131 Haz\u0131rl\u0131\u011f\u0131<\/h3>\n<p>\u015eimdi s\u0131ra Rails uygulaman\u0131z\u0131 PostgreSQL ile \u00e7al\u0131\u015facak \u015fekilde haz\u0131rlamaya geldi.<\/p>\n<h4>Yeni Bir Rails Uygulamas\u0131 Olu\u015fturma (\u0130ste\u011fe Ba\u011fl\u0131)<\/h4>\n<p>E\u011fer s\u0131f\u0131rdan bir uygulama olu\u015fturuyorsan\u0131z, Rails&#8217;i PostgreSQL adapt\u00f6r\u00fcyle ba\u015flatabilirsiniz:<\/p>\n<pre><code class=\"language-bash\">rails new your_app_name --database=postgresql\ncd your_app_name<\/code><\/pre>\n<p>Bu komut, <code>database.yml<\/code> dosyas\u0131n\u0131 otomatik olarak PostgreSQL i\u00e7in yap\u0131land\u0131racakt\u0131r.<\/p>\n<h4>Mevcut Bir Uygulamay\u0131 Kullanma<\/h4>\n<p>E\u011fer mevcut bir uygulaman\u0131z varsa veya <code>--database=postgresql<\/code> se\u00e7ene\u011fini kullanmad\u0131ysan\u0131z, a\u015fa\u011f\u0131daki ad\u0131mlar\u0131 uygulaman\u0131z gerekecektir.<\/p>\n<h4><code>pg<\/code> Gem&#8217;ini <code>Gemfile<\/code>&#8216;a Ekleme<\/h4>\n<p>Rails uygulaman\u0131z\u0131n k\u00f6k dizininde bulunan <code>Gemfile<\/code> dosyas\u0131n\u0131 a\u00e7\u0131n ve <code>pg<\/code> gem&#8217;ini ekleyin:<\/p>\n<pre><code class=\"language-ruby\"># Gemfile\n\ngem 'rails', '4.2.11' # veya kulland\u0131\u011f\u0131n\u0131z Rails s\u00fcr\u00fcm\u00fc\n<h2>... di\u011fer gem'ler ...<\/h2>\n\ngroup :development, :test do\n  gem 'sqlite3' # Bu sat\u0131r\u0131 silebilir veya yorum sat\u0131r\u0131 yapabilirsiniz\nend\n\ngroup :production do\n  gem 'pg'\nend\n\n<h2>Veya t\u00fcm ortamlar i\u00e7in:<\/h2>\ngem 'pg'<\/code><\/pre>\n<p><code>pg<\/code> gem&#8217;i, Ruby&#8217;nin PostgreSQL veritaban\u0131 ile ileti\u015fim kurmas\u0131n\u0131 sa\u011flayan adapt\u00f6rd\u00fcr. E\u011fer <code>sqlite3<\/code> gem&#8217;i zaten varsa ve PostgreSQL&#8217;i varsay\u0131lan olarak kullanacaksan\u0131z, <code>sqlite3<\/code> sat\u0131r\u0131n\u0131 silebilir veya yorum sat\u0131r\u0131 yapabilirsiniz. Ancak genellikle geli\u015ftirme ve test ortamlar\u0131 i\u00e7in SQLite&#8217;\u0131 tutmak ve production i\u00e7in PostgreSQL&#8217;i kullanmak yayg\u0131n bir yakla\u015f\u0131md\u0131r.<\/p>\n<h4><code>bundle install<\/code> \u00c7al\u0131\u015ft\u0131rma<\/h4>\n<p><code>Gemfile<\/code>&#8216;da yapt\u0131\u011f\u0131n\u0131z de\u011fi\u015fiklikleri uygulamak i\u00e7in terminalde uygulaman\u0131z\u0131n k\u00f6k dizininde <code>bundle install<\/code> komutunu \u00e7al\u0131\u015ft\u0131r\u0131n:<\/p>\n<pre><code class=\"language-bash\">bundle install<\/code><\/pre>\n<p>Bu komut, <code>pg<\/code> gem&#8217;ini ve ba\u011f\u0131ml\u0131l\u0131klar\u0131n\u0131 kuracakt\u0131r. E\u011fer <code>libpq-dev<\/code> paketi kurulu de\u011filse, bu ad\u0131mda bir hata alabilirsiniz. Hata al\u0131rsan\u0131z, <code>libpq-dev<\/code> paketini kurdu\u011funuzdan emin olun ve <code>bundle install<\/code> komutunu tekrar \u00e7al\u0131\u015ft\u0131r\u0131n.<\/p>\n<h3>Rails Uygulamas\u0131n\u0131 PostgreSQL&#8217;e Ba\u011flama<\/h3>\n<p>Rails uygulaman\u0131z\u0131n PostgreSQL ile nas\u0131l ileti\u015fim kuraca\u011f\u0131n\u0131 <code>config\/database.yml<\/code> dosyas\u0131nda belirtirsiniz.<\/p>\n<h4><code>database.yml<\/code> Dosyas\u0131n\u0131 Yap\u0131land\u0131rma<\/h4>\n<p><code>config\/database.yml<\/code> dosyas\u0131n\u0131 a\u00e7\u0131n ve a\u015fa\u011f\u0131daki gibi yap\u0131land\u0131r\u0131n. <code>development<\/code>, <code>test<\/code> ve <code>production<\/code> ortamlar\u0131 i\u00e7in ayr\u0131 ayr\u0131 yap\u0131land\u0131rma yapman\u0131z \u00f6nemlidir.<\/p>\n<pre><code class=\"language-yaml\"># config\/database.yml\n\ndevelopment:\n  adapter: postgresql\n  encoding: unicode\n  database: your_app_name_development\n  pool: 5\n  username: your_username # PostgreSQL kullan\u0131c\u0131n\u0131z\n  password: your_password # PostgreSQL kullan\u0131c\u0131n\u0131z\u0131n \u015fifresi\n  host: localhost\n\ntest:\n  adapter: postgresql\n  encoding: unicode\n  database: your_app_name_test\n  pool: 5\n  username: your_username\n  password: your_password\n  host: localhost\n\nproduction:\n  adapter: postgresql\n  encoding: unicode\n  database: your_app_name_production\n  pool: 5\n  username: your_username\n  password: your_password\n  host: localhost\n  # \u00dcretim ortam\u0131nda genellikle bu bilgileri ortam de\u011fi\u015fkenlerinden almak daha g\u00fcvenlidir.\n  # username: <%= ENV['DATABASE_USERNAME'] %>\n  # password: <%= ENV['DATABASE_PASSWORD'] %><\/code><\/pre>\n<p>*   <code>adapter: postgresql<\/code>: Rails&#8217;e PostgreSQL adapt\u00f6r\u00fcn\u00fc kullanmas\u0131n\u0131 s\u00f6yler.<br \/>\n*   <code>encoding: unicode<\/code>: Veritaban\u0131 karakter kodlamas\u0131n\u0131 belirtir.<br \/>\n*   <code>database<\/code>: Uygulaman\u0131z\u0131n ba\u011flanaca\u011f\u0131 veritaban\u0131n\u0131n ad\u0131n\u0131 belirtir. Her ortam i\u00e7in farkl\u0131 bir veritaban\u0131 kullanmak iyi bir uygulamad\u0131r (\u00f6rne\u011fin, <code>your_app_name_development<\/code>, <code>your_app_name_test<\/code>, <code>your_app_name_production<\/code>).<br \/>\n*   <code>pool<\/code>: Veritaban\u0131 ba\u011flant\u0131 havuzundaki maksimum ba\u011flant\u0131 say\u0131s\u0131n\u0131 belirtir.<br \/>\n*   <code>username<\/code>: PostgreSQL&#8217;de olu\u015fturdu\u011funuz kullan\u0131c\u0131n\u0131n ad\u0131.<br \/>\n*   <code>password<\/code>: PostgreSQL&#8217;de olu\u015fturdu\u011funuz kullan\u0131c\u0131n\u0131n \u015fifresi.<br \/>\n*   <code>host<\/code>: Veritaban\u0131 sunucusunun adresi. Yerel makinenizde \u00e7al\u0131\u015f\u0131yorsa <code>localhost<\/code> veya <code>127.0.0.1<\/code> kullan\u0131n.<\/p>\n<h4>Ortam De\u011fi\u015fkenleri Kullan\u0131m\u0131 (G\u00fcvenlik \u0130\u00e7in)<\/h4>\n<p>\u00d6zellikle \u00fcretim ortam\u0131nda <code>database.yml<\/code> dosyas\u0131na do\u011frudan \u015fifre yazmak g\u00fcvenlik riski ta\u015f\u0131r. Bunun yerine, \u015fifre ve kullan\u0131c\u0131 ad\u0131 gibi hassas bilgileri ortam de\u011fi\u015fkenlerinden almak daha g\u00fcvenli bir yakla\u015f\u0131md\u0131r.<\/p>\n<pre><code class=\"language-yaml\"># config\/database.yml (production k\u0131sm\u0131 i\u00e7in \u00f6rnek)\n\nproduction:\n  adapter: postgresql\n  encoding: unicode\n  database: your_app_name_production\n  pool: 5\n  username: <%= ENV['PG_USERNAME'] %>\n  password: <%= ENV['PG_PASSWORD'] %>\n  host: <%= ENV['PG_HOST'] || 'localhost' %><\/code><\/pre>\n<p>Ard\u0131ndan, sunucunuzda bu ortam de\u011fi\u015fkenlerini ayarlaman\u0131z gerekir. \u00d6rne\u011fin, <code>~\/.bashrc<\/code> veya da\u011f\u0131t\u0131m\u0131n\u0131za \u00f6zg\u00fc bir yap\u0131land\u0131rma dosyas\u0131nda:<\/p>\n<pre><code class=\"language-bash\">export PG_USERNAME=\"your_username\"\nexport PG_PASSWORD=\"your_strong_password\"\nexport PG_HOST=\"localhost\" # veya veritaban\u0131 sunucusunun IP adresi<\/code><\/pre>\n<p>Bu de\u011fi\u015fkenleri ayarlad\u0131ktan sonra terminal oturumunuzu yeniden ba\u015flatman\u0131z veya <code>source ~\/.bashrc<\/code> komutunu \u00e7al\u0131\u015ft\u0131rman\u0131z gerekebilir.<\/p>\n<h3>Veritaban\u0131 \u0130\u015flemleri<\/h3>\n<p><code>database.yml<\/code> dosyas\u0131n\u0131 yap\u0131land\u0131rd\u0131ktan sonra, Rails&#8217;in veritaban\u0131 komutlar\u0131n\u0131 kullanarak veritaban\u0131n\u0131z\u0131 olu\u015fturabilir, tablolar\u0131 migrate edebilir ve ba\u015flang\u0131\u00e7 verilerini y\u00fckleyebilirsiniz.<\/p>\n<h4>Veritaban\u0131n\u0131 Olu\u015fturma<\/h4>\n<p>Uygulaman\u0131z\u0131n kullanaca\u011f\u0131 veritabanlar\u0131n\u0131 olu\u015fturmak i\u00e7in:<\/p>\n<pre><code class=\"language-bash\">rails db:create<\/code><\/pre>\n<p>Bu komut, <code>database.yml<\/code> dosyas\u0131ndaki <code>development<\/code> ve <code>test<\/code> ortamlar\u0131 i\u00e7in belirtilen veritabanlar\u0131n\u0131 olu\u015fturacakt\u0131r. \u00dcretim ortam\u0131 i\u00e7in:<\/p>\n<pre><code class=\"language-bash\">RAILS_ENV=production rails db:create<\/code><\/pre>\n<h4>Migration&#8217;lar\u0131 \u00c7al\u0131\u015ft\u0131rma<\/h4>\n<p>Uygulaman\u0131zdaki tablolar\u0131 ve \u015femay\u0131 olu\u015fturmak i\u00e7in migration&#8217;lar\u0131 \u00e7al\u0131\u015ft\u0131rman\u0131z gerekir:<\/p>\n<pre><code class=\"language-bash\">rails db:migrate<\/code><\/pre>\n<p>Bu komut, <code>db\/migrate<\/code> dizinindeki t\u00fcm bekleyen migration dosyalar\u0131n\u0131 \u00e7al\u0131\u015ft\u0131racakt\u0131r. \u00dcretim ortam\u0131 i\u00e7in:<\/p>\n<pre><code class=\"language-bash\">RAILS_ENV=production rails db:migrate<\/code><\/pre>\n<h4>Seed Verilerini Y\u00fckleme (\u0130ste\u011fe Ba\u011fl\u0131)<\/h4>\n<p>Uygulaman\u0131z i\u00e7in ba\u015flang\u0131\u00e7 verileri (\u00f6rne\u011fin, y\u00f6netici kullan\u0131c\u0131, varsay\u0131lan ayarlar) varsa, bunlar\u0131 <code>db\/seeds.rb<\/code> dosyas\u0131na ekleyebilir ve a\u015fa\u011f\u0131daki komutla y\u00fckleyebilirsiniz:<\/p>\n<pre><code class=\"language-bash\">rails db:seed<\/code><\/pre>\n<p>\u00dcretim ortam\u0131 i\u00e7in:<\/p>\n<pre><code class=\"language-bash\">RAILS_ENV=production rails db:seed<\/code><\/pre>\n<h4>Konsol \u00dczerinden Veritaban\u0131 Etkile\u015fimi<\/h4>\n<p>Rails konsolu (<code>rails c<\/code>), uygulaman\u0131z\u0131n veritaban\u0131yla etkile\u015fime ge\u00e7mek i\u00e7in g\u00fc\u00e7l\u00fc bir ara\u00e7t\u0131r.<\/p>\n<pre><code class=\"language-bash\">rails c<\/code><\/pre>\n<p>Konsoldayken, Active Record modellerinizi kullanarak veritaban\u0131 kay\u0131tlar\u0131n\u0131 olu\u015fturabilir, okuyabilir, g\u00fcncelleyebilir ve silebilirsiniz. \u00d6rne\u011fin:<\/p>\n<pre><code class=\"language-ruby\"># Kullan\u0131c\u0131 modeli oldu\u011funu varsayal\u0131m\nUser.create(name: \"John Doe\", email: \"john@example.com\")\nUser.all<\/code><\/pre>\n<h3>\u00dcretim Ortam\u0131 \u0130\u00e7in Ek \u0130pu\u00e7lar\u0131<\/h3>\n<p>Uygulaman\u0131z\u0131 \u00fcretim ortam\u0131na da\u011f\u0131t\u0131rken, a\u015fa\u011f\u0131daki ek ipu\u00e7lar\u0131n\u0131 g\u00f6z \u00f6n\u00fcnde bulundurman\u0131z \u00f6nemlidir.<\/p>\n<h4>G\u00fcvenlik<\/h4>\n<p>*   <strong>G\u00fc\u00e7l\u00fc \u015eifreler:<\/strong> PostgreSQL kullan\u0131c\u0131lar\u0131 i\u00e7in daima karma\u015f\u0131k ve benzersiz \u015fifreler kullan\u0131n.<br \/>\n*   <strong>Kullan\u0131c\u0131 Yetkileri:<\/strong> Uygulaman\u0131z\u0131n veritaban\u0131 kullan\u0131c\u0131s\u0131na yaln\u0131zca ihtiya\u00e7 duydu\u011fu minimum yetkileri verin. S\u00fcper kullan\u0131c\u0131 yetkilerini asla bir uygulamaya vermeyin.<br \/>\n*   <strong>A\u011f G\u00fcvenli\u011fi:<\/strong> PostgreSQL sunucunuzu g\u00fcvenlik duvar\u0131 (ufw) ile koruyun. Yaln\u0131zca uygulaman\u0131z\u0131n \u00e7al\u0131\u015ft\u0131\u011f\u0131 sunucudan veya g\u00fcvenilir IP adreslerinden gelen ba\u011flant\u0131lara izin verin.<\/p>\n<pre><code class=\"language-bash\">sudo ufw allow 5432\/tcp # PostgreSQL varsay\u0131lan portu\n    sudo ufw enable<\/code><\/pre>\n<p>    Ancak, sadece uygulaman\u0131z\u0131n \u00e7al\u0131\u015ft\u0131\u011f\u0131 sunucudan ba\u011flant\u0131 gerekiyorsa, <code>pg_hba.conf<\/code> dosyas\u0131nda <code>host all all 127.0.0.1\/32 md5<\/code> gibi yerel ba\u011flant\u0131lar\u0131 kullanmak daha g\u00fcvenlidir.<\/p>\n<h4>Yedekleme ve Geri Y\u00fckleme Stratejileri<\/h4>\n<p>Veri kayb\u0131n\u0131 \u00f6nlemek i\u00e7in d\u00fczenli olarak veritaban\u0131 yedeklemeleri al\u0131n. <code>pg_dump<\/code> ve <code>pg_restore<\/code> ara\u00e7lar\u0131 bu ama\u00e7la kullan\u0131labilir.<br \/>\n*   <strong>Yedekleme:<\/strong><\/p>\n<pre><code class=\"language-bash\">pg_dump -Fc -U your_username -h localhost your_database_name > backup.dump<\/code><\/pre>\n<p>*   <strong>Geri Y\u00fckleme:<\/strong><\/p>\n<pre><code class=\"language-bash\">pg_restore -U your_username -h localhost -d your_database_name backup.dump<\/code><\/pre>\n<p>Otomatik yedekleme \u00e7\u00f6z\u00fcmleri veya bulut tabanl\u0131 veritaban\u0131 hizmetleri (AWS RDS, Google Cloud SQL) kullanmak, yedekleme s\u00fcrecini daha g\u00fcvenilir hale getirebilir.<\/p>\n<h4>Performans Optimizasyonu<\/h4>\n<p>*   <strong>\u0130ndeksler:<\/strong> S\u0131k\u00e7a sorgulanan s\u00fctunlara (\u00f6zellikle <code>WHERE<\/code> ko\u015fullar\u0131nda, <code>JOIN<\/code> anahtarlar\u0131nda) indeks ekleyerek sorgu performans\u0131n\u0131 art\u0131r\u0131n. Rails migration&#8217;lar\u0131nda <code>add_index<\/code> kullanarak indeksler olu\u015fturabilirsiniz.<br \/>\n*   <strong>Sorgu Optimizasyonu:<\/strong> N+1 sorgu sorunlar\u0131n\u0131 \u00f6nlemek i\u00e7in <code>includes<\/code> veya <code>eager_load<\/code> gibi Active Record y\u00f6ntemlerini kullan\u0131n. Karma\u015f\u0131k sorgular\u0131 optimize etmek i\u00e7in <code>EXPLAIN ANALYZE<\/code> komutunu kullanarak sorgu planlar\u0131n\u0131 inceleyin.<br \/>\n*   <strong>Ba\u011flant\u0131 Havuzu:<\/strong> <code>database.yml<\/code> dosyas\u0131ndaki <code>pool<\/code> ayar\u0131n\u0131 uygulaman\u0131z\u0131n ihtiya\u00e7lar\u0131na g\u00f6re ayarlay\u0131n. \u00c7ok fazla ba\u011flant\u0131 performans\u0131 d\u00fc\u015f\u00fcrebilir, \u00e7ok az ba\u011flant\u0131 ise uygulaman\u0131z\u0131n t\u0131kanmas\u0131na neden olabilir.<\/p>\n<h4>Ba\u011flant\u0131 Havuzu (Connection Pooling)<\/h4>\n<p>Rails&#8217;in kendi ba\u011flant\u0131 havuzu olsa da, PGBouncer gibi harici bir ba\u011flant\u0131 havuzu arac\u0131 kullanmak, \u00f6zellikle y\u00fcksek trafikli uygulamalarda veritaban\u0131 ba\u011flant\u0131lar\u0131n\u0131 daha verimli y\u00f6netmenize yard\u0131mc\u0131 olabilir. PGBouncer, uygulamadan gelen ba\u011flant\u0131 isteklerini bir havuza al\u0131r ve bu havuzdan PostgreSQL&#8217;e s\u0131n\u0131rl\u0131 say\u0131da ba\u011flant\u0131 a\u00e7arak veritaban\u0131 \u00fczerindeki y\u00fck\u00fc azalt\u0131r.<\/p>\n<h3>S\u0131k Kar\u015f\u0131la\u015f\u0131lan Sorunlar ve \u00c7\u00f6z\u00fcmleri<\/h3>\n<p>Bu b\u00f6l\u00fcmde, PostgreSQL ve Rails entegrasyonu s\u0131ras\u0131nda kar\u015f\u0131la\u015fabilece\u011finiz baz\u0131 yayg\u0131n sorunlar ve bunlar\u0131n \u00e7\u00f6z\u00fcmleri ele al\u0131nmaktad\u0131r.<\/p>\n<h4><code>pg<\/code> Gem&#8217;i Kurulum Hatalar\u0131 (<code>libpq-dev<\/code> Eksikli\u011fi)<\/h4>\n<p><strong>Sorun:<\/strong> <code>bundle install<\/code> \u00e7al\u0131\u015ft\u0131r\u0131rken <code>pg<\/code> gem&#8217;i derlenemiyor ve <code>missing header files<\/code> veya benzeri bir hata al\u0131yorsunuz.<br \/>\n<strong>\u00c7\u00f6z\u00fcm:<\/strong> Bu genellikle <code>libpq-dev<\/code> paketi eksikli\u011finden kaynaklan\u0131r. Bu paket, <code>pg<\/code> gem&#8217;inin C uzant\u0131lar\u0131n\u0131 derlemek i\u00e7in gerekli olan PostgreSQL geli\u015ftirme dosyalar\u0131n\u0131 sa\u011flar.<\/p>\n<pre><code class=\"language-bash\">sudo apt-get install libpq-dev\nbundle install<\/code><\/pre>\n<h4><code>database.yml<\/code> Yap\u0131land\u0131rma Hatalar\u0131<\/h4>\n<p><strong>Sorun:<\/strong> Uygulaman\u0131z veritaban\u0131na ba\u011flanam\u0131yor ve <code>ActiveRecord::AdapterNotSpecified<\/code> veya <code>PG::ConnectionBad<\/code> gibi hatalar al\u0131yorsunuz.<br \/>\n<strong>\u00c7\u00f6z\u00fcm:<\/strong><br \/>\n*   <code>config\/database.yml<\/code> dosyas\u0131ndaki <code>adapter<\/code>, <code>database<\/code>, <code>username<\/code>, <code>password<\/code> ve <code>host<\/code> ayarlar\u0131n\u0131 dikkatlice kontrol edin.<br \/>\n*   Yaz\u0131m hatalar\u0131 veya yanl\u0131\u015f girilen bilgiler en yayg\u0131n nedenlerdir.<br \/>\n*   <code>host: localhost<\/code> yerine <code>host: 127.0.0.1<\/code> denemeyi d\u00fc\u015f\u00fcnebilirsiniz.<\/p>\n<h4>Kullan\u0131c\u0131\/\u015eifre Yetkilendirme Sorunlar\u0131 (<code>pg_hba.conf<\/code>)<\/h4>\n<p><strong>Sorun:<\/strong> <code>PG::ConnectionBad: FATAL: password authentication failed for user \"your_username\"<\/code> veya <code>FATAL: Peer authentication failed for user \"your_username\"<\/code> gibi hatalar al\u0131yorsunuz.<br \/>\n<strong>\u00c7\u00f6z\u00fcm:<\/strong><br \/>\n*   <strong>\u015eifre Do\u011frulama Hatas\u0131:<\/strong> <code>database.yml<\/code> dosyas\u0131ndaki \u015fifrenin PostgreSQL&#8217;de ayarlad\u0131\u011f\u0131n\u0131z \u015fifreyle tam olarak e\u015fle\u015fti\u011finden emin olun.<br \/>\n*   <strong>Peer Kimlik Do\u011frulama Hatas\u0131:<\/strong> Bu genellikle <code>pg_hba.conf<\/code> dosyas\u0131nda <code>local all all peer<\/code> ayar\u0131n\u0131n aktif olmas\u0131ndan kaynaklan\u0131r. <code>peer<\/code> kimlik do\u011frulamas\u0131, veritaban\u0131 kullan\u0131c\u0131s\u0131n\u0131n Linux kullan\u0131c\u0131s\u0131yla e\u015fle\u015fmesini gerektirir. E\u011fer uygulaman\u0131z farkl\u0131 bir Linux kullan\u0131c\u0131s\u0131 alt\u0131nda \u00e7al\u0131\u015f\u0131yorsa veya \u015fifre ile ba\u011flanmak istiyorsan\u0131z, <code>pg_hba.conf<\/code> dosyas\u0131n\u0131 <code>md5<\/code> olarak de\u011fi\u015ftirmeniz ve PostgreSQL servisini yeniden ba\u015flatman\u0131z gerekir (bkz. <code>pg_hba.conf<\/code> b\u00f6l\u00fcm\u00fc).<\/p>\n<pre><code class=\"language-bash\">sudo nano \/etc\/postgresql\/9.3\/main\/pg_hba.conf\n    # local   all             all                                     md5\n    sudo service postgresql restart<\/code><\/pre>\n<h4>Veritaban\u0131 Ba\u011flant\u0131 Zaman A\u015f\u0131m\u0131<\/h4>\n<p><strong>Sorun:<\/strong> Uygulaman\u0131z yo\u011fun y\u00fck alt\u0131nda \u00e7al\u0131\u015f\u0131rken veya belirli aral\u0131klarla <code>could not connect to server: Connection timed out<\/code> gibi hatalar al\u0131yor.<br \/>\n<strong>\u00c7\u00f6z\u00fcm:<\/strong><br \/>\n*   <strong>PostgreSQL Servisi \u00c7al\u0131\u015f\u0131yor Mu?<\/strong> \u0130lk olarak PostgreSQL servisinin \u00e7al\u0131\u015ft\u0131\u011f\u0131ndan emin olun: <code>sudo service postgresql status<\/code>.<br \/>\n*   <strong>A\u011f Ba\u011flant\u0131s\u0131:<\/strong> Veritaban\u0131 sunucusuna a\u011f ba\u011flant\u0131s\u0131n\u0131n oldu\u011fundan emin olun (\u00f6zellikle farkl\u0131 bir sunucudaysa). G\u00fcvenlik duvar\u0131 kurallar\u0131n\u0131 kontrol edin.<br \/>\n*   <strong>Ba\u011flant\u0131 Havuzu:<\/strong> <code>database.yml<\/code> dosyas\u0131ndaki <code>pool<\/code> boyutunu art\u0131rmay\u0131 deneyin.<br \/>\n*   <strong>Veritaban\u0131 Kaynaklar\u0131:<\/strong> Veritaban\u0131 sunucusunun CPU, RAM veya disk G\/\u00c7 gibi kaynaklar\u0131n\u0131n yetersiz olup olmad\u0131\u011f\u0131n\u0131 kontrol edin.<\/p>\n<h3>Sonu\u00e7<\/h3>\n<p>Bu rehberde, Ruby on Rails uygulaman\u0131z\u0131 Ubuntu 14.04 \u00fczerinde PostgreSQL ile nas\u0131l entegre edece\u011finizi ad\u0131m ad\u0131m \u00f6\u011frendiniz. PostgreSQL&#8217;in kurulumundan kullan\u0131c\u0131 ve veritaban\u0131 olu\u015fturmaya, Rails uygulaman\u0131z\u0131n yap\u0131land\u0131rmas\u0131ndan temel veritaban\u0131 i\u015flemlerine ve \u00fcretim ortam\u0131 ipu\u00e7lar\u0131na kadar bir\u00e7ok konuyu ele ald\u0131k.<\/p>\n<p>PostgreSQL, g\u00fc\u00e7l\u00fc \u00f6zellikleri, g\u00fcvenilirli\u011fi ve performans\u0131yla Rails uygulamalar\u0131 i\u00e7in m\u00fckemmel bir veritaban\u0131 se\u00e7ene\u011fidir. Bu rehberdeki ad\u0131mlar\u0131 takip ederek, uygulaman\u0131z\u0131n veritaban\u0131 katman\u0131n\u0131 sa\u011flam bir \u015fekilde kurabilir ve gelecekteki geli\u015ftirmeler i\u00e7in g\u00fc\u00e7l\u00fc bir temel olu\u015fturabilirsiniz. Unutmay\u0131n, veritaban\u0131 y\u00f6netimi s\u00fcrekli dikkat ve optimizasyon gerektiren bir aland\u0131r. D\u00fczenli yedeklemeler almak, g\u00fcvenlik \u00f6nlemlerini uygulamak ve performans\u0131 izlemek, uygulaman\u0131z\u0131n uzun vadeli ba\u015far\u0131s\u0131 i\u00e7in kritik \u00f6neme sahiptir.<\/p>\n<p>\u0130leri okuma i\u00e7in PostgreSQL&#8217;in resmi dok\u00fcmantasyonunu, Rails Guides&#8217;\u0131 ve Active Record hakk\u0131nda daha fazla bilgi edinmek i\u00e7in Rails API dok\u00fcmanlar\u0131n\u0131 incelemeniz tavsiye edilir.<\/body><\/p>\n","protected":false},"excerpt":{"rendered":"PostgreSQL&#8217;i Ruby on Rails Uygulaman\u0131zla Ubuntu 14.04 \u00dczerinde Kullanma Rehberi\nBu kapsaml\u0131 rehber, Ruby on Rails uygulamalar\u0131n\u0131z\u0131 Ubuntu 14.04","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":[1468],"tags":[],"class_list":{"0":"post-31096","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-ubuntu","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>PostgreSQL&#039;i Ruby on Rails Uygulaman\u0131zla Ubuntu 14.04 \u00dczerinde Kullanma Rehberi - 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\/postgresqli-ruby-on-rails-uygulamanizla-ubuntu-14-04-uzerinde-kullanma-rehberi\/\" \/>\n<meta property=\"og:locale\" content=\"tr_TR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PostgreSQL&#039;i Ruby on Rails Uygulaman\u0131zla Ubuntu 14.04 \u00dczerinde Kullanma Rehberi\" \/>\n<meta property=\"og:description\" content=\"PostgreSQL&#039;i Ruby on Rails Uygulaman\u0131zla Ubuntu 14.04 \u00dczerinde Kullanma Rehberi Bu kapsaml\u0131 rehber, Ruby on Rails uygulamalar\u0131n\u0131z\u0131 Ubuntu 14.04\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fatihsoysal.com\/blog\/postgresqli-ruby-on-rails-uygulamanizla-ubuntu-14-04-uzerinde-kullanma-rehberi\/\" \/>\n<meta property=\"og:site_name\" content=\"Kodlar\u0131n Gizemli D\u00fcnyas\u0131\" \/>\n<meta property=\"article:published_time\" content=\"2025-10-05T14:41:58+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=\"17 dakika\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/postgresqli-ruby-on-rails-uygulamanizla-ubuntu-14-04-uzerinde-kullanma-rehberi\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/postgresqli-ruby-on-rails-uygulamanizla-ubuntu-14-04-uzerinde-kullanma-rehberi\/\"},\"author\":{\"name\":\"Fatih Soysal\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\"},\"headline\":\"PostgreSQL&#8217;i Ruby on Rails Uygulaman\u0131zla Ubuntu 14.04 \u00dczerinde Kullanma Rehberi\",\"datePublished\":\"2025-10-05T14:41:58+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/postgresqli-ruby-on-rails-uygulamanizla-ubuntu-14-04-uzerinde-kullanma-rehberi\/\"},\"wordCount\":2828,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\"},\"articleSection\":[\"Ubuntu\"],\"inLanguage\":\"tr\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/fatihsoysal.com\/blog\/postgresqli-ruby-on-rails-uygulamanizla-ubuntu-14-04-uzerinde-kullanma-rehberi\/#respond\"]}],\"copyrightYear\":\"2025\",\"copyrightHolder\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/postgresqli-ruby-on-rails-uygulamanizla-ubuntu-14-04-uzerinde-kullanma-rehberi\/\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/postgresqli-ruby-on-rails-uygulamanizla-ubuntu-14-04-uzerinde-kullanma-rehberi\/\",\"name\":\"PostgreSQL'i Ruby on Rails Uygulaman\u0131zla Ubuntu 14.04 \u00dczerinde Kullanma Rehberi - Kodlar\u0131n Gizemli D\u00fcnyas\u0131\",\"isPartOf\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#website\"},\"datePublished\":\"2025-10-05T14:41:58+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/postgresqli-ruby-on-rails-uygulamanizla-ubuntu-14-04-uzerinde-kullanma-rehberi\/#breadcrumb\"},\"inLanguage\":\"tr\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/fatihsoysal.com\/blog\/postgresqli-ruby-on-rails-uygulamanizla-ubuntu-14-04-uzerinde-kullanma-rehberi\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/postgresqli-ruby-on-rails-uygulamanizla-ubuntu-14-04-uzerinde-kullanma-rehberi\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Anasayfa\",\"item\":\"https:\/\/fatihsoysal.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PostgreSQL&#8217;i Ruby on Rails Uygulaman\u0131zla Ubuntu 14.04 \u00dczerinde Kullanma Rehberi\"}]},{\"@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":"PostgreSQL'i Ruby on Rails Uygulaman\u0131zla Ubuntu 14.04 \u00dczerinde Kullanma Rehberi - 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\/postgresqli-ruby-on-rails-uygulamanizla-ubuntu-14-04-uzerinde-kullanma-rehberi\/","og_locale":"tr_TR","og_type":"article","og_title":"PostgreSQL'i Ruby on Rails Uygulaman\u0131zla Ubuntu 14.04 \u00dczerinde Kullanma Rehberi","og_description":"PostgreSQL'i Ruby on Rails Uygulaman\u0131zla Ubuntu 14.04 \u00dczerinde Kullanma Rehberi Bu kapsaml\u0131 rehber, Ruby on Rails uygulamalar\u0131n\u0131z\u0131 Ubuntu 14.04","og_url":"https:\/\/fatihsoysal.com\/blog\/postgresqli-ruby-on-rails-uygulamanizla-ubuntu-14-04-uzerinde-kullanma-rehberi\/","og_site_name":"Kodlar\u0131n Gizemli D\u00fcnyas\u0131","article_published_time":"2025-10-05T14:41:58+00:00","author":"Fatih Soysal","twitter_card":"summary_large_image","twitter_misc":{"Yazan:":"Fatih Soysal","Tahmini okuma s\u00fcresi":"17 dakika"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fatihsoysal.com\/blog\/postgresqli-ruby-on-rails-uygulamanizla-ubuntu-14-04-uzerinde-kullanma-rehberi\/#article","isPartOf":{"@id":"https:\/\/fatihsoysal.com\/blog\/postgresqli-ruby-on-rails-uygulamanizla-ubuntu-14-04-uzerinde-kullanma-rehberi\/"},"author":{"name":"Fatih Soysal","@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1"},"headline":"PostgreSQL&#8217;i Ruby on Rails Uygulaman\u0131zla Ubuntu 14.04 \u00dczerinde Kullanma Rehberi","datePublished":"2025-10-05T14:41:58+00:00","mainEntityOfPage":{"@id":"https:\/\/fatihsoysal.com\/blog\/postgresqli-ruby-on-rails-uygulamanizla-ubuntu-14-04-uzerinde-kullanma-rehberi\/"},"wordCount":2828,"commentCount":0,"publisher":{"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1"},"articleSection":["Ubuntu"],"inLanguage":"tr","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fatihsoysal.com\/blog\/postgresqli-ruby-on-rails-uygulamanizla-ubuntu-14-04-uzerinde-kullanma-rehberi\/#respond"]}],"copyrightYear":"2025","copyrightHolder":{"@id":"https:\/\/fatihsoysal.com\/blog\/#organization"}},{"@type":"WebPage","@id":"https:\/\/fatihsoysal.com\/blog\/postgresqli-ruby-on-rails-uygulamanizla-ubuntu-14-04-uzerinde-kullanma-rehberi\/","url":"https:\/\/fatihsoysal.com\/blog\/postgresqli-ruby-on-rails-uygulamanizla-ubuntu-14-04-uzerinde-kullanma-rehberi\/","name":"PostgreSQL'i Ruby on Rails Uygulaman\u0131zla Ubuntu 14.04 \u00dczerinde Kullanma Rehberi - Kodlar\u0131n Gizemli D\u00fcnyas\u0131","isPartOf":{"@id":"https:\/\/fatihsoysal.com\/blog\/#website"},"datePublished":"2025-10-05T14:41:58+00:00","breadcrumb":{"@id":"https:\/\/fatihsoysal.com\/blog\/postgresqli-ruby-on-rails-uygulamanizla-ubuntu-14-04-uzerinde-kullanma-rehberi\/#breadcrumb"},"inLanguage":"tr","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fatihsoysal.com\/blog\/postgresqli-ruby-on-rails-uygulamanizla-ubuntu-14-04-uzerinde-kullanma-rehberi\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/fatihsoysal.com\/blog\/postgresqli-ruby-on-rails-uygulamanizla-ubuntu-14-04-uzerinde-kullanma-rehberi\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Anasayfa","item":"https:\/\/fatihsoysal.com\/blog\/"},{"@type":"ListItem","position":2,"name":"PostgreSQL&#8217;i Ruby on Rails Uygulaman\u0131zla Ubuntu 14.04 \u00dczerinde Kullanma Rehberi"}]},{"@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\/31096","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=31096"}],"version-history":[{"count":1,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts\/31096\/revisions"}],"predecessor-version":[{"id":31097,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts\/31096\/revisions\/31097"}],"wp:attachment":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/media?parent=31096"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/categories?post=31096"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/tags?post=31096"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}