# Replicator

The goal of AngusReplicator is to synchronize transactions from CouchDB to some external data source like mysql. With this, read operations on specific datasets could be more effectively and faster instead of querying the ledger.

apiVersion: integrator.angusnext.io/v1
kind: AngusReplicator
metadata:
  name: replicator-customer01-mysql
  namespace: customer01
spec:
  image: angus/angus-replicator
  tag: "dev"
  replicas: 1
  couchdb:
    username: admin
    password: password
    host: peer01.customer01.svc.cluster.local
  externaldbs:
    - name: replicatedb01
      type: mysql
      host: mysql.customer01.svc.cluster.local
      username: username
      password: password
      database: statedb-replica
      table: transactions
      sources:
        - chaincode: general-chain
          channel: default
        - chaincode: general-chain
          channel: default
    - name: replicatedb02
      type: mysql
      host: mysql2.customer01.svc.cluster.local
      username: username
      password: password
      database: statedb-replica
      table: transactions
      sources:
        - chaincode: general-chain
          channel: default
        - chaincode: general-chain
          channel: default

# Properties

key Description
image The image name of the angus replicator
tag The tag of the angus replicator
replicas The number of replicas
couchdb.username The username of the couchdb
couchdb.password The password of the couchdb
couchdb.host The hostname of the couchdb
couchdb.port The port of the couchdb (optional)
externaldbs[x].name The name of the external database
externaldbs[x].type datasource type, currently only supported is mysql
externaldbs[x].host FQDN for connection to the database
externaldbs[x].username Username for connection to the database
externaldbs[x].password Password for connection to the database
externaldbs[x].database Database name
externaldbs[x].table Which table to use for the replication
externaldbs[x].sources.channel Channel name
externaldbs[x].sources.chaincode Chaincode name