目前yugabyte 的cdc 功能处于beta 阶段,应该也快实际可用了,以下是一个简单的试用

环境准备

使用docker-compose

  • docker-compose 文件
version: '2'
services:
  cdc-connector:
      build: ./
  graphql-engine:
    image: hasura/graphql-engine:v1.0.0-beta.6
    ports:
    - "8080:8080"
    environment:
      HASURA_GRAPHQL_DATABASE_URL: postgres://postgres@yb-tserver2:5433/postgres
      HASURA_GRAPHQL_ENABLE_CONSOLE: "true" # set to "false" to disable console
      HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log, query-log
  yb-master:
      image: yugabytedb/yugabyte:latest
      container_name: yb-master-n1
      command: [ "/home/yugabyte/bin/yb-master", 
                "--fs_data_dirs=/mnt/disk0,/mnt/disk1", 
                "--master_addresses=yb-master-n1:7100", 
                "--replication_factor=1"]
      ports:
      - "7000:7000"
      environment:
        SERVICE_7000_NAME: yb-master
  yb-tserver:
      image: yugabytedb/yugabyte:latest
      container_name: yb-tserver-n1
      command: [ "/home/yugabyte/bin/yb-tserver", 
                "--fs_data_dirs=/mnt/disk0,/mnt/disk1",
                "--start_pgsql_proxy", 
                "--tserver_master_addrs=yb-master-n1:7100"]
      ports:
      - "9042:9042"
      - "6379:6379"
      - "5433:5433"
      - "9000:9000"
      environment:
        SERVICE_5433_NAME: ysql
        SERVICE_9042_NAME: ycql
        SERVICE_6379_NAME: yedis
        SERVICE_9000_NAME: yb-tserver
      depends_on:
      - yb-master
  yb-tserver2:
      image: yugabytedb/yugabyte:latest
      container_name: yb-tserver-n2
      command: [ "/home/yugabyte/bin/yb-tserver", 
                "--fs_data_dirs=/mnt/disk0,/mnt/disk1",
                "--start_pgsql_proxy", 
                "--tserver_master_addrs=yb-master-n1:7100"]
      ports:
      - "9043:9042"
      - "6380:6379"
      - "5434:5433"
      - "9001:9000"
      environment:
        SERVICE_5433_NAME: ysql
        SERVICE_9042_NAME: ycql
        SERVICE_6379_NAME: yedis
        SERVICE_9000_NAME: yb-tserver
      depends_on:
      - yb-master
 
 
  • 启动ysql
docker-compose exec yb-master bash -c "YB_ENABLED_IN_POSTGRES=1 FLAGS_pggate_master_addresses=yb-master-n1:7100 /home/yugabyte/postgres/bin/initdb -D /tmp/yb_pg_initdb_tmp_data_dir -U postgres"
  • 创建数据库
CREATE TABLE users (name text, pass text, id int, primary key (id));
 
  • 下载connector
https://github.com/yugabyte/yb-kafka-connector/blob/master/yb-cdc/yb-cdc-connector.jar
  • 安装connector 到java ext 目录(本地)
    以上demo使用的是docker 运行
 
Linux: jre\lib\ext\yb-cdc-connector.jar
macOS: \Library\Java\Extensions\yb-cdc-connector.jar
Windows: %SystemRoot%\Sun\Java\lib\ext\yb-cdc-connector.jar

简单测试

没有使用kafka,使用的是 标准输出,为了简化测试 ,实际生产肯定应该使用kafaka

  • 启动命令 (本地)
    ```code
    java -jar yb_cdc_connector.jar --table_name postgres --master_addrs 127.0.0.1:7100 --log_only
 
* 启动模式
上边docker-compose up  -d 之后会包含yb-cdc-connector
效果
```code
/usr/lib/python2.7/site-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.24.3) or chardet (2.2.1) doesn't match a supported version!
  RequestsDependencyWarning)
Attaching to app_cdc-connector_1
cdc-connector_1 | [2019-10-18 02:36:00,907] INFO Starting CDC Kafka Connector... (org.yb.cdc.Main:28)
cdc-connector_1 | 2019-10-18 02:36:00,913 [INFO|org.yb.cdc.KafkaConnector|KafkaConnector] Creating new YB client...
cdc-connector_1 | [2019-10-18 02:36:01,028] WARN Slow DNS lookup! Resolved IP of `yb-master' to 172.19.0.4 in 6093014ns (org.yb.client.AsyncYBClient:2102)
cdc-connector_1 | [2019-10-18 02:36:01,171] INFO Discovered tablet YB Master for table YB Master with partition ["", "") (org.yb.client.AsyncYBClient:1593)
cdc-connector_1 | 2019-10-18 02:36:02,195 [ERROR|org.yb.cdc.KafkaConnector|KafkaConnector] Could not find a table with name users
cdc-connector_1 | [2019-10-18 02:37:13,641] INFO Starting CDC Kafka Connector... (org.yb.cdc.Main:28)
cdc-connector_1 | 2019-10-18 02:37:13,648 [INFO|org.yb.cdc.KafkaConnector|KafkaConnector] Creating new YB client...
cdc-connector_1 | [2019-10-18 02:37:13,742] WARN Slow DNS lookup! Resolved IP of `yb-master' to 172.19.0.4 in 3880047ns (org.yb.client.AsyncYBClient:2102)
cdc-connector_1 | [2019-10-18 02:37:13,856] INFO Discovered tablet YB Master for table YB Master with partition ["", "") (org.yb.client.AsyncYBClient:1593)
cdc-connector_1 | 2019-10-18 02:37:13,868 [ERROR|org.yb.cdc.KafkaConnector|KafkaConnector] Could not find a table with name users
cdc-connector_1 | [2019-10-18 02:39:29,903] INFO Starting CDC Kafka Connector... (org.yb.cdc.Main:28)
cdc-connector_1 | 2019-10-18 02:39:29,909 [INFO|org.yb.cdc.KafkaConnector|KafkaConnector] Creating new YB client...
cdc-connector_1 | [2019-10-18 02:39:30,003] WARN Slow DNS lookup! Resolved IP of `yb-master' to 172.19.0.4 in 3878725ns (org.yb.client.AsyncYBClient:2102)
cdc-connector_1 | [2019-10-18 02:39:30,125] INFO Discovered tablet YB Master for table YB Master with partition ["", "") (org.yb.client.AsyncYBClient:1593)
cdc-connector_1 | 2019-10-18 02:39:30,137 [ERROR|org.yb.cdc.KafkaConnector|KafkaConnector] Could not find a table with name users
cdc-connector_1 | [2019-10-18 02:41:15,985] INFO Starting CDC Kafka Connector... (org.yb.cdc.Main:28)
cdc-connector_1 | 2019-10-18 02:41:15,991 [INFO|org.yb.cdc.KafkaConnector|KafkaConnector] Creating new YB client...
cdc-connector_1 | [2019-10-18 02:41:16,089] WARN Slow DNS lookup! Resolved IP of `yb-master' to 172.19.0.4 in 3907821ns (org.yb.client.AsyncYBClient:2102)
cdc-connector_1 | [2019-10-18 02:41:16,208] INFO Discovered tablet YB Master for table YB Master with partition ["", "") (org.yb.client.AsyncYBClient:1593)
cdc-connector_1 | 2019-10-18 02:41:16,285 [INFO|org.yb.cdc.KafkaConnector|KafkaConnector] Created new stream with id b0d1f019a5544fee8e4f0171f64e453b
cdc-connector_1 | 2019-10-18 02:41:16,291 [INFO|org.yb.cdc.KafkaConnector|KafkaConnector] Polling for new tablet bf9fff471e8044cdaef702f0e7489741
cdc-connector_1 | 2019-10-18 02:41:16,292 [INFO|org.yb.cdc.KafkaConnector|KafkaConnector] Polling for new tablet 66991b7373294418977409d50499ea5d
cdc-connector_1 | 2019-10-18 02:41:16,292 [INFO|org.yb.cdc.KafkaConnector|KafkaConnector] Polling for new tablet 
cdc-conne
 
  • 添加数据
INSERT INTO "public"."users"("name", "pass", "id") VALUES('dalong', 'eee', 1);
  • 效果

说明

yugabyte cdc 对于实时数据处理,数据分析,数据传递,还是很方便的,基于此功能我们可以开发灵活的数据分析系统 ,当前还是beta 状态,很期待
可以ga

参考资料

https://docs.yugabyte.com/latest/deploy/cdc/cdc-to-kafka/

yugabyte cdc 试用的更多相关文章

  1. yugabyte cloud native db 基本试用

    备注: 测试环境使用docker进行安装试用 1. 安装 a. Download mkdir ~/yugabyte && cd ~/yugabyte wget https://down ...

  2. yugabyte docker-compose 运行试用

    以前运行yugabyte 使用的是yb-docker-ctl,现在直接可以方便的使用docker-compose 运行了 pull image docker pull yugabytedb/yugab ...

  3. SharePoint Online 申请试用链接地址

    SharePoint Online 申请试用链接地址: https://products.office.com/en-us/business/compare-office-365-for-busine ...

  4. 活动助手Beta用户试用报告

    用户试用报告 1.面向参与者用户 1.1 日常参加各类学习(水综测)活动中,有没有遇到以下问题: (1) 信息来源混乱,不知道靠不靠谱 (2) 每次报名都要重新填写自己的学号手机号,有时候填错了就没综 ...

  5. 创建WP8试用应用

    参考资料: 创建 Windows Phone 的试用应用 如何在 Windows Phone 应用中实现试用体验 Windows Phone 7 开发 31 日谈——第23日:提供试用版应用程序 对资 ...

  6. Oracle CDC配置案例

    异步部署 1. 环境的配置准备 1.1.    数据库版本 SQL> select * from v$version; BANNER ------------------------------ ...

  7. SQL Server 变更数据捕获(CDC)监控表数据

    一.本文所涉及的内容(Contents) 本文所涉及的内容(Contents) 背景(Contexts) 实现过程(Realization) 补充说明(Addon) 参考文献(References) ...

  8. 达梦7的试用 与SQLSERVER的简单技术对比

    达梦7的试用 与SQLSERVER的简单技术对比 达梦数据库公司推出了他们的数据库服务管理平台,可以在该平台使用达梦数据库而无须安装达梦7数据库 地址:http://online.dameng.com ...

  9. SQL Server 变更数据捕获(CDC)

    标签:SQL SERVER/MSSQL SERVER/数据库/DBA/字段/对象更改 概述 变更数据捕获用于捕获应用到 SQL Server 表中的插入.更新和删除活动,并以易于使用的关系格式提供这些 ...

随机推荐

  1. JS异步操作概述(转)

    add by zhj: 只转载了一部分.异步操作的三种模式未转载,因为里面代码比较多,复制过来麻烦 原文:https://wangdoc.com/javascript/async/general.ht ...

  2. SQL系列(四)—— 唯一值(distinct)

    有时需要查询某列上的不重复的数据,如: SELECT name FROM student; 结果: name lxy lxy lxy lxy 这样的结果显然不符合我们的需求.如何对列数据进行去重,查询 ...

  3. spring boot EnableAutoConfiguration exclude 无效

    本文链接:https://blog.csdn.net/ID19870510/article/details/79373386 首先讲一下SpringBootApplication注解源码定义为 @Ta ...

  4. SpringBoot构建RESTful API

    1.RESTful介绍 RESTful是一种软件架构风格! RESTful架构风格规定,数据的元操作,即CRUD(create, read, update和delete,即数据的增删查改)操作,分别对 ...

  5. Java之路---Day18(List集合)

    2019-11-05-23:03:28 List集合: java.util.List 接口继承自 Collection 接口,是单列集合的一个重要分支,习惯性地会将实现了List 接口的对象称为Lis ...

  6. kylin安装过程问题排查

    问题:日志报错:/usr/local/apps/kylin/tomcat/conf/.keystore (没有那个文件或目录) 解决:在kylin内置tomcat的server.xml中里边有个对ht ...

  7. 【转载】C#通过Contains方法判断DataTable中是否存在某个列名

    在C#中的Datatable数据变量的操作过程中,有时候需要判断DataTable中是否存在某个列名,此时可以通过DataTable对象的Columns列对象集合属性下的Contains方法来进行判断 ...

  8. 详解js中的this指向

    this指向问题是个老生常谈的问题了,现在我给大家一个例子 var obj={ bar:'Cynthia' , foo:function(){ console.log(this.bar,"w ...

  9. 前端项目中公共方法汇总utils.js

    目录 判断手机类型IOS Android 格式化金钱 金钱字符串变回数字 用aa替换中文 并返回 去除文件后缀,得到文件名称(不带后缀) 获取浏览器类型(名称) post方式下载文件流 动态设置img ...

  10. 渗透 Facebook 的思路与发现

    0x00 写在故事之前 身一位渗透测试人员,比起 Client Side 的弱点,我更喜欢 Server Side 的攻击,能够直接控制服务器并获得权限操作 SHELL 才爽 . 当然一次完美的渗透出 ...