2

Trying to run the example slony config script in the documentation but getting the following error:

postgres$ /tmp/slonik_example.sh 
<stdin>:8: PGRES_FATAL_ERROR load '$libdir/slony1_funcs';  - ERROR:  could not access file "$libdir/slony1_funcs": No such file or directory 
<stdin>:8: Error: the extension for the Slony-I C functions cannot be loaded in database 'dbname=my_primary host=localhost user=warfish password=coalitions' 

Yet the LIBDIR variable is set correctly:

postgres$ ./pg_config 
BINDIR = /opt/local/lib/postgresql90/bin 
DOCDIR = /opt/local/share/doc/postgresql 
HTMLDIR = /opt/local/share/doc/postgresql 
INCLUDEDIR = /opt/local/include/postgresql90 
PKGINCLUDEDIR = /opt/local/include/postgresql90 
INCLUDEDIR-SERVER = /opt/local/include/postgresql90/server 
LIBDIR = /opt/local/lib/postgresql90 

And the lib is present:

ls -l /opt/local/lib/postgresql90/slony1_funcs.so 
-rwxr-xr-x  1 root  admin  34944 Feb 17 16:20 /opt/local/lib/postgresql90/slony1_funcs.so 

Script is as follows:

cat /tmp/slonik_example.sh 
#!/bin/sh 

CLUSTERNAME=slony_example; 
/opt/local/lib/postgresql90/bin/slonik <<_EOF_ 
define CLUSTERNAME slony_example; 
cluster name = @CLUSTERNAME; 
node 1 admin conninfo = 'dbname=my_primary host=localhost user=user1 password=pw'; 
node 2 admin conninfo = 'dbname=my_rep host=localhost user=user1 password=pw'; 
#-- 
# 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=localhost user=user1 password=pw'); 
store path (server = 2, client = 1, conninfo='dbname=my_rep host=localhost user=user1 password=pw'); 
_EOF_ 

Read in the doc that likely the lib is not in the correct place or $libdir is not set correctly, but everything looks to be in place. Am I missing something else I am not aware of?

1
  • Did you check file system level permissions and database level permissions on slony trigger functions? Is the slony version you are using OK for PostgreSQL 9.0?
    – tscho
    Feb 22, 2012 at 7:35

2 Answers 2

2

In my situation, this error was caused by Slony not being installed on every machine in the cluster. I had Slony installed and all the requisite libs on the main host/master, but the clients needed Slony installed (or maybe just the library functions file put in $libdir) as well.

1

In my database slony1_funcs.so it is in the PKGLIBDIR directory

PKGLIBDIR = /usr/lib64/pgsql

I found this information about "PKGLIBDIR vs LIBDIR":

" libdir is for build-time linkable libraries, anything that you might want to pass as -lxxx. So typical locations are /usr/lib, /usr/local/lib, or /usr/local/pgsql/lib. pkglibdir is for dynamically loadable libraries"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.