2012-02-20 6 views
2

私は、スローニーチュートリアルにあるサンプルを使用しようとしていますが、例に構文エラーがあるようです。私はオンラインでより多くのドキュメンテーションを見つけようとしましたが、slonikコマンドの使い方を示す良いドキュメンテーションはまだありません。Slony-slonik構文の問題

#!/bin/sh 

/opt/local/lib/postgresql90/bin/slonik << _EOL_ 

define CLUSTERNAME slony_example; 
cluster name = @CLUSTERNAME; 

node 1 admin conninfo = 'dbname=my_primary host=$MASTERHOST user=$REPLICATIONUSER'; 
node 2 admin conninfo = 'dbname=my_rep host=$SLAVEHOST user=$REPLICATIONUSER'; 

#-- 
# init the first node. Its id MUST be 1. This creates the schema # _$CLUSTERNAME containing all replication system specific database # objects. 
#-- 
init cluster (id=1, comment = 'Master Node'); 

#-- 
# Slony-I organizes tables into sets. The smallest unit a node can # subscribe is a set. The following commands create one set containing # all 4 pgbench tables. The master or origin of the set is node 1. 
#-- 
create set (id=1, origin=1, comment='All pgbench tables'); 
set add table (set id=1, origin=1, id=1, fully qualified name ='public.pgbench_accounts', comment='accounts table'); 
set add table (set id=1, origin=1, id=2, fully qualified name ='public.pgbench_branches', comment='branches table'); 
set add table (set id=1, origin=1, id=3, fully qualified name ='public.pgbench_tellers', comment='tellers table'); 
set add table (set id=1, origin=1, id=4, fully qualified name ='public.pgbench_history', comment='history table'); 

#-- 
# Create the second node (the slave) tell the 2 nodes how to connect to Slony-I 2.1.1 Documentation 10/163 
# each other and how they should listen for events. 
#-- 

store node (id=2, comment = 'Slave node', event node=1); 
store path (server = 1, client = 2, conninfo='dbname=my_primary host=$MASTERHOST user=$REPLICATIONUSER'); 
store path (server = 2, client = 1, conninfo='dbname=my_rep host=$SLAVEHOST user=$REPLICATIONUSER'); 

_EOF_ 

しかし、私は、次のエラーを取得しておく::私が実行しようとしているスクリプトがある

postgres$ /tmp/slonik_example.sh 
<stdin>:29: ERROR: syntax error at or near dbname 

更新スクリプト上記の最初の回答に基づいて。エラーは以下のようになります。

postgres$ /tmp/slonik_example.sh 
<stdin>:31: ERROR: syntax error at or near _EOF_ 
+0

のSlonyは、多くの点で厳しい教師になることができます。私はあなたと同じ方法で手始めに構成を始めました。基本を理解するには良い方法です。 Slonyに慣れた後、私はaltperlツールを使い始めました。 http://slony.info/documentation/appendix.html#ALTPERL –

+0

ありがとう、私もそれを見ていきます。あなたslonikを使用する方法の他の良い例を認識していますか?非常にまばらに文書化されているようです。 – WildBill

+0

私は数年前にSlonyと一緒に仕事をしていたので、チュートリアルを書くことが私の野心でしたが、私はそれを完成させる時間がありませんでした。しかし、ここではかなり良い概要です。 http://www.dalibo.org/_media/pgconfeu_slony.pdf –

答えて

2

あなたがアンバランス引用符持って:あなたはおそらくしたい

store path (server = 1, client = 2, conninfo='dbname=my_primary host=$MASTERHOST user= '$REPLICATIONUSER'); 
store path (server = 2, client = 1, conninfo='dbname=my_rep host=$SLAVEHOST user= '$REPLICATIONUSER'); 

を:

store path (server = 1, client = 2, conninfo="dbname=my_primary host=$MASTERHOST user=$REPLICATIONUSER"); 
store path (server = 2, client = 1, conninfo="dbname=my_rep host=$SLAVEHOST user=$REPLICATIONUSER"); 
+0

ああ、二重引用符は機能しませんでしたが。それはまだそれに追いついたが、一重引用符を使用すると、より良いものになりました。今、EOFについて不平を言っています.... – WildBill

+0

更新されたバージョンに間違いがありますか?私はそれがなぜ機能していないのか完全に困惑しています...../ – WildBill

+0

あなたは一番上に_EOF_と一番下に_EOF_を持っています... –