Postgresql ile pgsync kullanımı

postgresql ile ruby on rails kullanıyorsanız ve sürekli production veritabanını local ortamınıza restore etmek ile uğraşıyorsanız yazımızda yer alan gem tam size göre…

Serhan Balcı
Feb 23, 2017 · 1 min read

proje klasöründe aşağıda ki komutu çalıştırıyoruz.

gem install pgsync

daha sonra config dosyasını oluşturmak için;

pgsync --setup

.pgsync.yml dosyasına aşağıdaki satırları ekleyerek hangi veritabanından hangi veritabanına tabloları kopyalayacağımızı belirtiyoruz.

Burada önemli nokta from: production veritabanı, to: development veritabanını işaret etmelidir.

from: postgres://database_user:database_password@database_ip_address:5432/database_nameto: postgres://database_user:database_password@localhost:5432/database_development_name

son olarak aşağıdaki komutu çalıştırarak canlı veritabanından local ortama istediğimiz tablolarda yer alan kayıtları alabiliriz.

pgsync table_1,table_2,table_3

canlı ortamda yer alan veritabanının pg_hba.conf dosyasına local ortamdan erişeceğiniz ip adresini eklemeyi unutmayın…

serhanbalci

13 years of professional experience & knowledge about software development.

Serhan Balcı

Written by

Software Development Manager

serhanbalci

13 years of professional experience & knowledge about software development.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade