首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Slony - slonik语法问题

Slony - slonik语法问题
EN

Stack Overflow用户
提问于 2012-02-20 23:43:42
回答 1查看 1.5K关注 0票数 2

我尝试使用slony教程中的示例,但看起来他们的示例中存在语法错误。我试着在网上找到更多的文档,但我还没有真正找到好的文档来说明如何使用slonik命令。我尝试运行的脚本是:

代码语言:javascript
复制
#!/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_

但我一直收到以下错误:

代码语言:javascript
复制
postgres$ /tmp/slonik_example.sh
<stdin>:29: ERROR: syntax error at or near dbname

根据第一个答案更新上面的脚本。现在的错误是:

代码语言:javascript
复制
postgres$ /tmp/slonik_example.sh
<stdin>:31: ERROR: syntax error at or near _EOF_
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-02-20 23:48:58

你有不平衡的引号:

代码语言:javascript
复制
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');

您可能需要:

代码语言:javascript
复制
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");
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/9363906

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档