亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区
Chinaunix
標(biāo)題:
postgresql-slony-I同步復(fù)制配置步驟
[打印本頁]
作者:
huangxifeng607
時間:
2010-02-20 17:30
標(biāo)題:
postgresql-slony-I同步復(fù)制配置步驟
主數(shù)據(jù)庫: 172.16.254.21 端口:5432
從數(shù)據(jù)庫: 172.16.254.22 端口:5432
步驟1:主從均安裝slon
apt-get install slon-bin
步驟2:主從數(shù)據(jù)庫配置權(quán)限,創(chuàng)建語言。
在主數(shù)據(jù)庫中 vi /etc/postgresql/8.3/node/pg_hba.conf
添加一條記錄 host all repl 172.16.254.22/32 md5
在主從數(shù)據(jù)庫均執(zhí)行以下操作:
shell>psql
node=#create role repl password '123456' login superuser
#創(chuàng)建用戶repl,賦予超級用戶權(quán)限
node=# use node;
node=# create language plpgsql;
#創(chuàng)建語言plpgsql
步驟3:備份主數(shù)據(jù)庫至從數(shù)據(jù)庫并恢復(fù)
#在主數(shù)據(jù)庫備份要復(fù)制的數(shù)據(jù)庫
pg_dump node > node_20100220.dmp
#在從庫恢復(fù)數(shù)據(jù)庫node
postgres=#create database node;
postgres=#\q
shell>psql node > /export/scripts/master.log &
$SLON $CLUSTER_NAME "$SLAVE" >> /export/scripts/slave.log &
}
stop()
{
# killall slon
kill -9 `ps axu|grep 'dbname=node' |grep -v grep|awk '{print $2}'`
}
case $1 in
'install')
install
;;
'uninstall')
uninstall
;;
'start')
start
;;
'stop')
stop
;;
*)
echo "usage: $0 {install|uninstall|start|stop} "
;;
esac
步驟5:啟動
./replication start
步驟6:測試
1.在主數(shù)據(jù)庫的空表public.hxf中添加一條記錄
insert into hxf(uid,uname) select 1,'huangxifeng';
2.在主數(shù)據(jù)庫中看到有一條記錄
node=# select * from hxf;
uid | uname
-----+-------------
1 | huangxifeng
(1 row)
3.在從數(shù)據(jù)庫中看到有一條記錄
node=# select * from hxf;
uid | uname
-----+-------------
1 | huangxifeng
(1 row)
本文來自ChinaUnix博客,如果查看原文請點:
http://blog.chinaunix.net/u2/66215/showart_2182947.html
歡迎光臨 Chinaunix (http://72891.cn/)
Powered by Discuz! X3.2