How to implement tungsten replicator BuildAuditTable filter

563 views Asked by At

This is regarding :

com.continuent.tungsten.replicator.filter.BuildAuditTable

I tried both Tungsten 2.2 and 3.0

My intial configuration

./tools/tpm install alpha \
--topology=master-slave \
--master=host1 \
--replication-user=tungsten \
--replication-password=password \
--install-directory=/opt/continuent \
--members=host1,host2 \
--start

Then i tried adding BuildAuditTable filter in the following two ways :

Try 1:

 ./tools/tpm update alpha \
 --property='replicator.filter.bidiSlave.auditf=com.continuent.tungsten.replicator.filter.BuildAuditTable' \
 --property='replicator.filter.bidiSlave.auditf.targetTableName=indiaresorts.audit_table' \
 --repl-svc-applier-filters=auditf  

Try 2 :

  ./tools/tpm update alpha \
 --property='replicator.filter.auditf=com.continuent.tungsten.replicator.filter.BuildAuditTable' \
 --property='replicator.filter.auditf.targetTableName=indiaresorts.audit_table' \
 --repl-svc-applier-filters=auditf  

But both times i got the following error :

Error on host2 (slave)
ERROR : 
pendingExceptionMessage: Plugin class name property is missing or null:  key=replicator.filter.auditf

Please let me know how i can get through this issue. Also i had a doubt about the audit table: whether it is automatically created or we have to create it and what its schema will be (column names e.t.c.).

Waiting for your kind response.

1

There are 1 answers

0
ento On

I had to add a .tpl (template) file prior to tpm install in order to define a new property in the static-{service_name}.properties configuration file.

  1. Create a new directory at tungsten-replicator/filters where you extracted the Tungsten tarball.

    Starting from 3.0.0, this can also be in the directory specified with --template-search-path.

  2. Add tungsten-replicator/filters/your_name_of_choice.tpl containing custom property keys and default values.

    replicator.filter.custom=com.continuent.tungsten.replicator.filter.JavaScriptFilter
    replicator.filter.custom.script=
    replicator.filter.custom.config=
    
  3. Install:

    ./tools/tpm install alpha \
      ...
      --property='replicator.filter.custom.script=path/to/script' \
      --property='replicator.filter.custom.config=path/to/config' \
      --repl-svc-applier-filters=custom
    

You can check the service configuration file at path/to/installation_directory/{service_name}/tungsten/tungsten-replicator/conf/static-{service_name}.properties on one of the nodes to see if the template file was incorporated.

As for the audit table, a casual glance at the source code seems to indicate that

  • You need to create the table yourself
  • The schema is the same as that of the incoming table

Which means either the replication must be restricted to a single table or the audit table must contain all possible columns contained in the database.