{"id":158731,"date":"2012-11-15T12:01:03","date_gmt":"2012-11-15T08:01:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=158731"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=158731","title":{"rendered":"<span class=\"post_title\">PostgreSQL \u2014 Asynchronous Replication + Pooling + Failover<\/span>"},"content":{"rendered":"<div class=\"content html_format\">\n<h5>\u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 master-slave \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0430 \u0431\u0430\u0437\u0435 Postgresql 9.1<\/h5>\n<p>  \u0412\u043f\u0435\u0440\u0432\u044b\u0435 \u0432\u0441\u0442\u0430\u043b\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u0435\u0434\u0438\u043d\u043e\u043b\u0438\u0447\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0439 \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u0431\u044b\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043c\u0438\u043d\u0438-\u043c\u0430\u043d\u0443\u0430\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438 \u0445\u043e\u0447\u0443 \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c.<\/p>\n<p>  \u0414\u043b\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u041c\u0430\u0441\u0442\u0435\u0440-\u0421\u043b\u0435\u0439\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f   <\/p>\n<ul>\n<li>PostgreSQL 9.1 (\u0411\u0414) +<\/li>\n<li>Bucardo 4.5 (\u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0442\u043e\u0440) +<\/li>\n<li>PgPool-II (\u043f\u0443\u043b\u0435\u0440 \u0438 \u0444\u0430\u0439\u043b\u043e\u0432\u0435\u0440)<\/li>\n<\/ul>\n<p>  <a name=\"habracut\"><\/a>  <\/p>\n<h6><b>Bucardo<\/b><\/h6>\n<p>  \u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u0430\u044f Postgres replication system \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f \u043d\u0430 Perl5.<\/p>\n<p>  \u0423\u0434\u043e\u0431\u043d\u0430 \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u044c\u044e \u0432 \u043f\u043e\u0441\u0442\u0433\u0440\u0435\u0441 \u0438 \u043b\u0435\u0433\u043a\u043e\u0439, \u043e\u0442\u0440\u0430\u0436\u0430\u0435\u043c\u043e\u0439 \u0432 \u0431\u0434, \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u043e\u0439.<\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u0442 \u0441\u0432\u043e\u044e \u0411\u0414, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0440\u0435\u043f\u043b\u0438\u0446\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0431\u0430\u0437\u044b, \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u044b\u0435 \u0432 \u043b\u0438\u0441\u0442\u044b (\u0441\u043f\u0438\u0441\u043a\u0438).<br \/>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u0438\u043f \u0441\u0432\u044f\u0437\u0438 Pushdelta (Trigger. One way master-slave).<br \/>  \u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442. \u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u043e\u0431\u0435 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u0442.\u0435. \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043c\u0430\u0441\u0442\u0435\u0440\u0430, \u043f\u0440\u0438 \u0435\u0433\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438, \u043e\u043d \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u00ab\u0434\u043e\u0433\u043e\u043d\u0438\u0442\u00bb \u0441\u043b\u0435\u0439\u0432.<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440\u043d\u044b\u0439 \u043f\u043b\u0430\u043d \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 bucardo \u043d\u0430 \u041c\u0430\u0441\u0442\u0435\u0440\u0435:<\/p>\n<pre><code class=\"bash\">sudo aptitude install bucardo    #  + install Perl mods (DBI, DBD::Pg, DBIx::Safe) sudo bucardo_ctl install           # connection settings <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0443\u044e \u0431\u0434 bucardo, \u043d\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0435\u0435 \u0438\u0437 bucardo.schema (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u043d \u043f\u0440\u0438\u0446\u0435\u043f\u043b\u0435\u043d \u043a 8.4 \u0438 \u0432 \u0441\u0442\u0430\u0440\u0448\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u043e\u0441\u0435\u0447\u043a\u0430 \u0441 \u0430\u0432\u0442\u043e\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0439 \u0431\u0434)<\/p>\n<pre><code class=\"bash\"> sudo bucardo_ctl add db bucardo_dbname name=master_dbname # \u041d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0411\u0414-\u043c\u0430\u0441\u0442\u0435\u0440\u0430  # + \u0432 \u0431\u0434 \u0440\u0443\u0447\u043a\u0430\u043c\u0438 \u043f\u0430\u0440\u043e\u043b\u044c \u0432 bucardo.db (\u0434\u0430\u0431\u044b \u043d\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u043b\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c)  sudo bucardo_ctl add db bucardo_dbname name=slave_dbname # \u041d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0411\u0414-\u0441\u043b\u0435\u0439\u0432\u0430  sudo bucardo_ctl add table tbl_name db=bucardo_dbname herd=source_name # \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446 \u043c\u0430\u0441\u0442\u0435\u0440\u0430 \u0432 \u0441\u043f\u0438\u0441\u043e\u043a(herd)   sudo bucardo_ctl add sync sync_name type=pushdelta source=herd_name targetdb=slave_dbname # \u041d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0434\u043b\u044f \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438  sudo bucardo_ctl start # \u0417\u0430\u043f\u0443\u0441\u043a \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438 <\/code><\/pre>\n<p>  \u041d\u0430 \u0441\u043b\u0435\u0439\u0432\u0435 \u044f \u0435\u0433\u043e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u043b\u0430, \u043d\u043e \u043d\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u043b\u0430 (\u0442.\u043a. \u0441\u043b\u0435\u0439\u0432 \u043e\u0434\u0438\u043d \u0438 \u0441 \u043d\u0435\u0433\u043e \u0438\u0434\u0442\u0438 \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043d\u0435\u043a\u0443\u0434\u0430)<\/p>\n<h6><b>PgPool-II<\/b><\/h6>\n<p>  \u0418\u043c\u0435\u0435\u0442 \u0448\u0438\u0440\u043e\u043a\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u0441\u0442\u0440\u0430\u0434\u0430\u0435\u0442 \u043d\u0435\u0445\u0432\u0430\u0442\u043a\u043e\u0439 \u043c\u0430\u043d\u0443\u0430\u043b\u043e\u0432. \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043a\u0443 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438, \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0432 \u043a \u0411\u0414 \u043f\u043e \u043f\u0443\u043b\u0430\u043c, \u0430 \u0442\u0430\u043a \u0436\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f FailOver&#8217;\u043e\u043c, \u0442.\u0435. \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u0435\u043b\u0435\u043c \u0441 \u043c\u0430\u0441\u0442\u0435\u0440\u0430 \u043d\u0430 \u0441\u043b\u0435\u0439\u0432 \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f\u043c\u0438.<\/p>\n<p>  \u041d\u0430 debian \u0441\u0442\u0430\u0432\u0438\u0442\u0441\u044f \u0438\u0437 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f, \u043e\u0442 \u0432\u0435\u0440\u0441\u0438\u0438 postgres \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442.  <\/p>\n<pre><code class=\"bash\"> sudo aptitude install pgpool2 <\/code><\/pre>\n<p>  \u041a\u043e\u043d\u0444\u0438\u0433\u0438 \u0445\u0440\u0430\u043d\u0438\u0442 \u0432 \/etc\/pgpool2\/<\/p>\n<ul>\n<li>pgpool.conf \u2014 \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 (\u043e \u043d\u0438\u0445 \u0447\u0443\u0442\u044c \u043d\u0438\u0436\u0435)<\/li>\n<li>pcp.conf \u2014 \u0421\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0435 \u2014 \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u0442\u0440\u043e\u0433\u0430\u0442\u044c<\/li>\n<li>pool_hba.conf \u2014 \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u0432 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f. \u041c\u043e\u0436\u043d\u043e \u044e\u0437\u0430\u0442\u044c \u0441\u0432\u043e\u0439, \u043c\u043e\u0436\u043d\u043e \u2014 \u043f\u043e\u0441\u0433\u0440\u0435\u0441\u043e\u0432\u044b\u0439. \u041b\u0443\u0447\u0448\u0435 \u2014 \u043f\u043e\u0441\u0442\u0433\u0440\u0435\u0441\u043e\u0432\u044b\u0439<\/li>\n<\/ul>\n<p>  \u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430 PgPool \u043a\u0430\u043a \u043f\u0443\u043b\u0435\u0440, \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438, \u0447\u0442\u043e \u0441\u0430\u043c\u043e\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0435, \u0444\u0430\u0439\u043b\u043e\u0432\u0435\u0440.<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \/etc\/pgpool2\/pgpool.conf (\u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e) \u0414\u043b\u044f \u041c\u0430\u0441\u0442\u0435\u0440\u0430:  <\/p>\n<pre><code class=\"bash\"> listen_addresses = '*'  port = 9999  socket_dir = '\/var\/run\/postgresql'  pcp_port = 9898  pcp_socket_dir = '\/var\/run\/postgresql'    backend_hostname0 = master_server  backend_port0 = 5432  backend_weight0 = 1  backend_data_directory0 = '\/master_data'  backend_flag0 = 'ALLOW_TO_FAILOVER'  \t  backend_hostname1 = slave_server  backend_port1 = 5432  backend_weight1 = 1  backend_data_directory1 = '\/slave_data'  backend_flag1 = 'ALLOW_TO_FAILOVER'    connection_cache = on    replication_mode = off    load_balance_mode = on    master_slave_mode = on  master_slave_sub_mode = 'stream'    parallel_mode = on  pgpool2_hostname = ''    system_db_hostname  = master_server  system_db_port = 5432  system_db_dbname = 'pgpool'  system_db_schema = 'pgpool_catalog'  system_db_user = 'pgpool'  system_db_password = ''    failover_command = '\/etc\/pgpool2\/failover.sh %d %P %H %R'  recovery_user = 'postgres' recovery_password = '' recovery_1st_stage_command = '\/etc\/pgpool2\/recovery_1st_stage.sh' recovery_2nd_stage_command = '' recovery_timeout = 90 client_idle_limit_in_recovery = 0 <\/code><\/pre>\n<p>  \u0422\u0430\u043a \u0436\u0435 \u0432 \/etc\/pgpool2\/ \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0435:<\/p>\n<p>  &#187;failover.sh&#187; \u2014 \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u043a\u0440\u0438\u043f\u0442, \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0430\u0434\u0435\u043d\u0438\u044f \u043c\u0430\u0441\u0442\u0435\u0440\u0430  <\/p>\n<pre><code class=\"bash\"> #!\/bin\/bash -x  FALLING_NODE=$1         # %d  OLDPRIMARY_NODE=$2      # %P  NEW_PRIMARY=$3          # %H  PGDATA=$4               # %R    if [ $FALLING_NODE = $OLDPRIMARY_NODE ]; then      if [ $UID -eq 0 ]      then          su postgres -c &quot;ssh -T postgres@$NEW_PRIMARY touch $PGDATA\/trigger&quot;      else          ssh -T postgres@$NEW_PRIMARY touch $PGDATA\/trigger      fi      exit 0;  fi;  exit 0; <\/code><\/pre>\n<p>  &#187;recovery_1st_stage.sh&#187; \u2014 \u0421\u043a\u0440\u0438\u043f\u0442 \u0441 \u0433\u043e\u0432\u043e\u0440\u044f\u0449\u0438\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c   <\/p>\n<pre><code class=\"bash\"> #!\/bin\/bash -x    PGDATA=$1  REMOTE_HOST=$2  REMOTE_PGDATA=$3    PORT=5432  PGHOME=\/home\/yugo-n\/pgsql-9.2.1  ARCH=$PGHOME\/data\/arch    rm  -rf $ARCH\/*    ssh -T postgres@$REMOTE_HOST &quot;  LD_LIBRARY_PATH=$PGHOME\/lib:LD_LIBRARH_PATH;  rm -rf $REMOTE_PGDATA  $PGHOME\/bin\/pg_basebackup -h $HOSTNAME -U r_user -D $REMOTE_PGDATA -x -c fast  rm $REMOTE_PGDATA\/trigger&quot;    ssh -T postgres@$REMOTE_HOST &quot;rm -rf $ARCH\/*&quot;  ssh -T postgres@$REMOTE_HOST &quot;mkdir -p $REMOTE_PGDATA\/pg_xlog\/archive_status&quot;    ssh -T postgres@$REMOTE_HOST &quot;  cd $REMOTE_PGDATA;  cp postgresql.conf postgresql.conf.bak;  sed -e 's\/#*hot_standby = off\/hot_standby = on\/' postgresql.conf.bak &gt; postgresql.conf;  rm -f postgresql.conf.bak;  cat &gt; recovery.conf &lt;&lt; EOT  standby_mode = 'on'  primary_conninfo = 'host=&quot;$HOSTNAME&quot; port=$PORT user=r_user'  restore_command = 'scp $HOSTNAME:$ARCH\/%f %p'  trigger_file = '$PGDATA\/trigger'  EOT  &quot; <\/code><\/pre>\n<p>  <b>\u0412\u0430\u0436\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442!<\/b> \u041d\u0443\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b\/\u043f\u0430\u043f\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 pgpool&#8217;\u043e\u043c \u0431\u044b\u043b\u0438 \u0441 owner postgres::postgres<\/p>\n<p>  \u0414\u043b\u044f \u0421\u043b\u0435\u0439\u0432\u0430 \u0432\u0441\u0435 \u043f\u043e\u0447\u0442\u0438 \u0442\u043e\u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u0442\u043e\u043b\u044c\u043a\u043e \u0441 master_slave_mode = off \u0438 failover_command = &#187;<\/p>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f PgPool \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u043c \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u044b\u043c  <\/p>\n<pre><code class=\"bash\">sudo pgpool <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u041c\u0430\u0441\u0442\u0435\u0440-\u043c\u043e\u043d\u043e\u0421\u043b\u0435\u0439\u0432 \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u044e \u0441 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438 \u0444\u0430\u0439\u043b\u043e\u0432\u0435\u0440\u043e\u043c.<\/p>\n<p>  \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0438\u0434\u0435\u0442 \u0432\u0441\u0435\u0433\u0434\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043a \u043c\u0430\u0441\u0442\u0435\u0440\u0443 \u0447\u0435\u0440\u0435\u0437 \u043f\u043e\u0440\u0442 pgPool&#8217;a (\u0437\u0434\u0435\u0441\u044c \u2014 9999).<br \/>  \u041f\u0440\u0438 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 \u0438\u0434\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u043c\u0430\u0441\u0442\u0435\u0440, \u0431\u044d\u043a\u044d\u043d\u0434\u043e\u0432\u043e \u0440\u0435\u043f\u043b\u0438\u0446\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u0441\u043b\u0435\u0439\u0432, \u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0438 \u0441 \u0442\u043e\u0433\u043e \u0438 \u0441 \u0434\u0440\u0443\u0433\u043e\u0433\u043e.<br \/>  \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0441\u043b\u0435\u0439\u0432\u0430, \u043f\u0440\u0438 \u0432\u043e\u0437\u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0434\u043e\u0440\u0435\u043f\u043b\u0438\u0446\u0438\u0440\u0443\u044e\u0442\u0441\u044f.<br \/>  \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043c\u0430\u0441\u0442\u0435\u0440\u0430, \u0431\u0435\u0437 \u0440\u0430\u0437\u0440\u044b\u0432\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f pgpool \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0447\u0442\u0435\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u0438\u0441\u044c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0430 \u0440\u0435\u043f\u043b\u0438\u043a\u0443, \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0434\u0435\u043b\u0430\u044f \u0435\u0435 \u00ab\u043c\u0430\u0441\u0442\u0435\u0440\u043e\u043c\u00bb. \u041f\u0440\u0438 \u043f\u043e\u0434\u043d\u044f\u0442\u0438\u0438 \u043c\u0430\u0441\u0442\u0435\u0440\u0430, \u043e\u043d \u0434\u043e\u0433\u043e\u043d\u044f\u0435\u0442 \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u043e \u0441\u043b\u0435\u0439\u0432\u0430 \u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0435 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u043e\u043f\u044f\u0442\u044c \u0436\u0435 \u0431\u0435\u0437 \u0440\u0430\u0437\u0440\u044b\u0432\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u0415\u0441\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043a\u0430\u043a \u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u0430\u0432\u0430\u043c\u0438, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u0436\u0438\u0432\u043e\u043c \u043c\u0430\u0441\u0442\u0435\u0440\u0435 \u043d\u0430 \u0441\u043b\u0435\u0439\u0432 \u0431\u044b\u043b\u0438 \u0431\u044b \u043f\u0440\u0430\u0432\u0430 \u0442\u043e\u043b\u044c\u043a\u043e RO, \u0430 \u043f\u0440\u0438 \u0435\u0433\u043e \u043f\u0430\u0434\u0435\u043d\u0438\u0438 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u043b\u0438\u0441\u044c \u043d\u0430 RW (\u0430 \u043f\u043e\u0442\u043e\u043c \u043f\u0440\u0438 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u2014 \u043e\u0431\u0440\u0430\u0442\u043d\u043e), \u043d\u043e \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432\u043d\u0435\u0448\u043d\u0435\u0435 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0438\u0434\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043a \u0430\u0434\u0440\u0435\u0441\u0443 \u041c\u0430\u0441\u0442\u0435\u0440\u0430, \u0442\u043e \u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0448\u0430\u043b\u043e\u0432\u043b\u0438\u0432\u044b\u0445 \u0440\u0443\u0447\u043a\u0430\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432.<\/p>\n<p>  \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0441\u0442\u0430\u0442\u0435\u0439\u043a\u0430 \u043d\u0430\u0439\u0434\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0443 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445 DBA.<br \/>  \u0418 \u0432\u0441\u0435\u043c \u0441\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435! \t\t\t \t\t\t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/158731\/\"> http:\/\/habrahabr.ru\/post\/158731\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">\n<h5>\u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 master-slave \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0430 \u0431\u0430\u0437\u0435 Postgresql 9.1<\/h5>\n<p>  \u0412\u043f\u0435\u0440\u0432\u044b\u0435 \u0432\u0441\u0442\u0430\u043b\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u0435\u0434\u0438\u043d\u043e\u043b\u0438\u0447\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0439 \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u0431\u044b\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043c\u0438\u043d\u0438-\u043c\u0430\u043d\u0443\u0430\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438 \u0445\u043e\u0447\u0443 \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c.<\/p>\n<p>  \u0414\u043b\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u041c\u0430\u0441\u0442\u0435\u0440-\u0421\u043b\u0435\u0439\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f   <\/p>\n<ul>\n<li>PostgreSQL 9.1 (\u0411\u0414) +<\/li>\n<li>Bucardo 4.5 (\u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0442\u043e\u0440) +<\/li>\n<li>PgPool-II (\u043f\u0443\u043b\u0435\u0440 \u0438 \u0444\u0430\u0439\u043b\u043e\u0432\u0435\u0440)<\/li>\n<\/ul>\n<p>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-158731","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/158731","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=158731"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/158731\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=158731"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=158731"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=158731"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}