Postgresql Slony-slonik语法问题

Postgresql Slony-slonik语法问题,postgresql,slony,Postgresql,Slony,我试图使用slony教程中的示例,但他们的示例中似乎存在语法错误。我试着在网上找到更多的文档,但还没有找到好的文档来展示如何使用slonik命令。我尝试运行的脚本是: #!/bin/sh /opt/local/lib/postgresql90/bin/slonik << _EOL_ define CLUSTERNAME slony_example; cluster name = @CLUSTERNAME; node 1 admin conninfo = 'dbname=my_p

我试图使用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_
#/垃圾箱/垃圾箱

/opt/local/lib/postgresql90/bin/slonik您的报价不平衡:

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");

啊,虽然双引号不起作用。它仍然对此感到恶心,但使用单引号让事情变得更好。现在它在抱怨EOF…你看到更新版本有什么问题吗?我完全搞不懂这为什么行不通/你有EOL在上面,EOF在下面…斯隆在很多方面都是一个严厉的老师。我以与您相同的方式开始,手工编写配置,这是理解基本原理的好方法。在熟悉Slony之后,我开始使用altperl工具。谢谢,我也来看看。你知道其他关于如何使用slonik的好例子吗?几年前,当我和斯隆一起工作时,我的目标是写一篇教程,但我没有时间完成它。但这里有一个很好的概要。
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");