Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
1,402
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.36 KB | None | 0 0
  1. # Prerequisites
  2. 1. [AWS Aurora to Maxwell STDOUT Producer](/abacaphiliac/b9d69615fa8b56f68031a0a83f41255e)
  3. 1. [Run Kafka Container](/abacaphiliac/f0553548f9c577214d16290c2e751071)
  4.  
  5. After running through the prerequisites, you will have:
  6. * an AWS Aurora instance
  7. * a Kafka service (named `kafka`), listening on `kafka:9092`
  8.  
  9. # Start Maxwell with Kafka Producer
  10. ```
  11. docker run -it --rm \
  12. --env MYSQL_USERNAME=AURORA_USERNAME \
  13. --env MYSQL_PASSWORD=AURORA_PASSWORD \
  14. --env MYSQL_HOST=AURORA_HOST \
  15. --link kafka \
  16. --env KAFKA_HOST=kafka \
  17. --env KAFKA_PORT=9092 \
  18. --name maxwell
  19. maxwell
  20. ```
  21.  
  22. output:
  23. ```
  24. 22:32:54,156 INFO ProducerConfig - ProducerConfig values:
  25. request.timeout.ms = 30000
  26. retry.backoff.ms = 100
  27. buffer.memory = 33554432
  28. ssl.truststore.password = null
  29. batch.size = 16384
  30. ssl.keymanager.algorithm = SunX509
  31. receive.buffer.bytes = 32768
  32. ssl.cipher.suites = null
  33. ssl.key.password = null
  34. sasl.kerberos.ticket.renew.jitter = 0.05
  35. ssl.provider = null
  36. sasl.kerberos.service.name = null
  37. max.in.flight.requests.per.connection = 5
  38. sasl.kerberos.ticket.renew.window.factor = 0.8
  39. bootstrap.servers = [kafka:9092]
  40. client.id =
  41. max.request.size = 1048576
  42. acks = 1
  43. linger.ms = 0
  44. sasl.kerberos.kinit.cmd = /usr/bin/kinit
  45. ssl.enabled.protocols = [TLSv1.2, TLSv1.1, TLSv1]
  46. metadata.fetch.timeout.ms = 60000
  47. ssl.endpoint.identification.algorithm = null
  48. ssl.keystore.location = null
  49. value.serializer = class org.apache.kafka.common.serialization.StringSerializer
  50. ssl.truststore.location = null
  51. ssl.keystore.password = null
  52. key.serializer = class org.apache.kafka.common.serialization.StringSerializer
  53. block.on.buffer.full = false
  54. metrics.sample.window.ms = 30000
  55. metadata.max.age.ms = 300000
  56. security.protocol = PLAINTEXT
  57. ssl.protocol = TLS
  58. sasl.kerberos.min.time.before.relogin = 60000
  59. timeout.ms = 30000
  60. connections.max.idle.ms = 540000
  61. ssl.trustmanager.algorithm = PKIX
  62. metric.reporters = []
  63. compression.type = none
  64. ssl.truststore.type = JKS
  65. max.block.ms = 60000
  66. retries = 0
  67. send.buffer.bytes = 131072
  68. partitioner.class = class org.apache.kafka.clients.producer.internals.DefaultPartitioner
  69. reconnect.backoff.ms = 50
  70. metrics.num.samples = 2
  71. ssl.keystore.type = JKS
  72.  
  73. 22:32:54,212 INFO AppInfoParser - Kafka version : 0.9.0.1
  74. 22:32:54,212 INFO AppInfoParser - Kafka commitId : 23c69d62a0cabf06
  75. 22:32:54,277 INFO Maxwell - Maxwell v1.7.0 is booting (MaxwellKafkaProducer), starting at BinlogPosition[mysql-bin-changelog.000002:56885]
  76. 22:32:54,952 INFO MysqlSavedSchema - Restoring schema id 1 (last modified at BinlogPosition[mysql-bin-changelog.000002:3521])
  77. 22:32:58,518 INFO OpenReplicator - starting replication at mysql-bin-changelog.000002:56885
  78. 22:33:23,282 WARN NetworkClient - Error while fetching metadata with correlation id 0 : {maxwell=LEADER_NOT_AVAILABLE}
  79. ```
  80.  
  81. The process is now waiting for new data events.
  82.  
  83. # Create a topic
  84. ```
  85. docker exec kafka /opt/kafka_2.11-0.10.1.0/bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic maxwell
  86. docker exec kafka /opt/kafka_2.11-0.10.1.0/bin/kafka-topics.sh --list --zookeeper localhost:2181
  87. ```
  88.  
  89. output:
  90. ```
  91. Created topic "maxwell".
  92. test
  93. maxwell
  94. ```
  95.  
  96. # Start a consumer (in another terminal window)
  97. This command will start an unnamed instance of `spotify/kafka` linked to the `kafka` service, start a consumer, display existing messages from the `maxwell` topic, and wait for new messages until you quit (which destroys the container):
  98. ```
  99. docker run -it --rm --link kafka spotify/kafka /opt/kafka_2.11-0.10.1.0/bin/kafka-console-consumer.sh --bootstrap-server kafka:9092 --topic maxwell --from-beginning
  100. ```
  101.  
  102. Connect to the AWS Aurora instance, insert some records, and update some records. Data events from Maxwell will be printed in the Consumer terminal window:
  103. ```
  104. {"database":"AURORA_DATABASE","table":"AURORA_TABLE","type":"update","ts":1484606003,"xid":1655558,"commit":true,"data":{"id":4,"first_name":"Tim","last_name":"Younger"},"old":{"first_name":"Timothy"}}
  105. {"database":"AURORA_DATABASE","table":"AURORA_TABLE","type":"update","ts":1484606435,"xid":1658343,"commit":true,"data":{"id":4,"first_name":"Timothy","last_name":"Younger"},"old":{"first_name":"Tim"}}
  106. {"database":"AURORA_DATABASE","table":"AURORA_TABLE","type":"update","ts":1484606451,"xid":1658455,"commit":true,"data":{"id":4,"first_name":"Tim","last_name":"Younger"},"old":{"first_name":"Timothy"}}
  107. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement