在 Linux 上使用 postgresql 配置 symmetricDS 时出现异常

在 Linux 上使用 postgresql 配置 symmetricDS 时出现异常

SymmetricDS 是一个 Java 工具,它可以通过间歇性的互联网连接复制数据库和表。我在配置它以与 postgresql 配合使用时遇到了麻烦。

我正在做的这块配置说明:

#Next, create the SymmetricDS-specific tables in the corp node database.
#These tables will
#contain the configuration for synchronization. The following command uses 
#the auto-creation
#feature to create all the necessary SymmetricDS system tables.

../bin/symadmin --engine corp-000 create-sym-tables

当我运行此命令时,出现以下异常:

[corp-000] - PostgreSqlSymmetricDialect - Done with auto update of
             SymmetricDS tables
[corp-000] - PostgreSqlSymmetricDialect - Please add
             "custom_variable_classes = 'symmetric'"
             to your postgresql.conf file
-------------------------------------------------------------------------------
An exception occurred.  Please see the following for details:
-------------------------------------------------------------------------------
org.postgresql.util.PSQLException: ERROR: unrecognized configuration parameter "symmetric.triggers_disabled"
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2157)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1886)
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:555)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:417)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:410)
    at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
    at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
    at org.jumpmind.db.sql.JdbcSqlTransaction$5.execute(JdbcSqlTransaction.java:299)
    at org.jumpmind.db.sql.JdbcSqlTransaction$5.execute(JdbcSqlTransaction.java:289)
    at org.jumpmind.db.sql.JdbcSqlTransaction.executeCallback(JdbcSqlTransaction.java:316)
    org.jumpmind.db.sql.SqlException: ERROR: unrecognized configuration parameter "symmetric.triggers_disabled"
    at org.jumpmind.db.sql.AbstractSqlTemplate.translate(AbstractSqlTemplate.java:288)
    at org.jumpmind.db.sql.AbstractSqlTemplate.translate(AbstractSqlTemplate.java:279)
    at org.jumpmind.db.sql.JdbcSqlTransaction.executeCallback(JdbcSqlTransaction.java:318)
    at org.jumpmind.db.sql.JdbcSqlTransaction.prepareAndExecute(JdbcSqlTransaction.java:289)
    at org.jumpmind.symmetric.db.postgresql.PostgreSqlSymmetricDialect.enableSyncTriggers(PostgreSqlSymmetricDialect.java:217)
    at org.jumpmind.symmetric.db.postgresql.PostgreSqlSymmetricDialect.createRequiredDatabaseObjects(PostgreSqlSymmetricDialect.java:75)
    org.jumpmind.symmetric.SymmetricException: Please add "custom_variable_classes = 'symmetric'" to your postgresql.conf file
    at org.jumpmind.symmetric.db.postgresql.PostgreSqlSymmetricDialect.createRequiredDatabaseObjects(PostgreSqlSymmetricDialect.java:79)
    at org.jumpmind.symmetric.db.AbstractSymmetricDialect.initTablesAndDatabaseObjects(AbstractSymmetricDialect.java:154)
    at org.jumpmind.symmetric.AbstractSymmetricEngine.setupDatabase(AbstractSymmetricEngine.java:364)
    at org.jumpmind.symmetric.SymmetricAdmin.createSymTables(SymmetricAdmin.java:424)
    at org.jumpmind.symmetric.SymmetricAdmin.executeWithOptions(SymmetricAdmin.java:270)
    at org.jumpmind.symmetric.AbstractCommandLauncher.execute(AbstractCommandLauncher.java:130)
    at org.jumpmind.symmetric.SymmetricAdmin.main(SymmetricAdmin.java:119)
-------------------------------------------------------------------------------

我的数据库中创建了一堆表,所以它似乎可以正常工作。我对 postgresql.conf 文件进行了更改,但仍然抛出了此异常。出了什么问题?

答案1

我犯的错误是编辑了错误的 postgresql.conf 文件,然后没有重新启动 postgresql 数据库,因此这些更改不会生效。我可以通过执行以下操作来消除此异常:

  1. 找到你真正的 postgresql.conf 文件,我的是/var/lib/pgsql/data/postgresql.conf

  2. 以 root 身份编辑文件并根据异常内容更改行:

    #custom_variable_classes = ''         
    custom_variable_classes = 'symmetric'
    
  3. 保存文件并重新启动 postgresql:

    systemctl start postgresql.service
    
  4. 再次运行命令../bin/symadmin --engine corp-000 create-sym-tables

它正常完成并打印以下结果:

[el@rosewill samples ]$ ../bin/symadmin --engine corp-000 create-sym-tables
Log output will be written to ../logs/symmetric.log
[] - AbstractCommandLauncher - Option: name=engine, value={corp-000}
[corp-000] - PostgreSqlSymmetricDialect - The DbDialect being used is org.jumpmind.symmetric.db.postgresql.PostgreSqlSymmetricDialect
[corp-000] - ExtensionPointManager - Found 5 extension points that will be registered
[corp-000] - AbstractSymmetricEngine - Initializing SymmetricDS database
[corp-000] - PostgreSqlSymmetricDialect - Checking if SymmetricDS tables need created or altered
[corp-000] - PostgreSqlSymmetricDialect - Just installed sym_triggers_disabled
[corp-000] - PostgreSqlSymmetricDialect - Just installed sym_node_disabled
[corp-000] - PostgreSqlSymmetricDialect - Just installed sym_largeobject
[corp-000] - ConfigurationService - Auto-configuring config channel
[corp-000] - ConfigurationService - Auto-configuring reload channel
[corp-000] - ConfigurationService - Auto-configuring heartbeat channel
[corp-000] - ConfigurationService - Auto-configuring default channel
[corp-000] - ConfigurationService - Auto-configuring filesync channel
[corp-000] - AbstractSymmetricEngine - Done initializing SymmetricDS database

对 symmetricDS 开发人员的一个请求,请使用简洁明了的错误消息,而不是在 21 页控制台输出的末尾显示 3 页错误消息。当用户挠头想知道这是什么时:错误:无法识别的配置参数“symmetric.triggers_disabled”。

别让我思考! http://www.sensible.com/dmmt.html

相关内容