databus mysql搭建_databus bootstrap 部署
databus 分为 relay bootstrap-producer(bst-producer) bootstrap-server(bst-server) client,他们之间的关系可以去网上找 这里主要介绍部署这四个工程的方法
1 relay 侦听端口为 11115
1.1 relay.properties
databus.relay.container.httpPort=11115
databus.relay.container.jmx.rmiEnabled=false
databus.relay.eventBuffer.allocationPolicy=DIRECT_MEMORY
databus.relay.eventBuffer.queuePolicy=OVERWRITE_ON_WRITE
databus.relay.eventLogReader.enabled=false
databus.relay.eventLogWriter.enabled=false
databus.relay.schemaRegistry.type=FILE_SYSTEM
databus.relay.eventBuffer.maxSize=1024000000
databus.relay.eventBuffer.readBufferSize=10240
databus.relay.eventBuffer.scnIndexSize=10240000
#databus.relay.physicalSourcesConfigsPattern=conf/sources.json
databus.relay.dataSources.sequenceNumbersHandler.file.scnDir=./maxScn
databus.relay.startDbPuller=true
1.2 start.sh
cd `dirname $0`/..
script_dir=./bin
source $script_dir/setup.inc
source $script_dir/setup-relay.inc
cli_overrides=
# DEFAULT VALUES
relay_type=default
jvm_gc_log=${logs_dir}/relay-gc.log
db_relay_config=
# JVM ARGUMENTS
jvm_direct_memory_size=40g
jvm_direct_memory="-XX:MaxDirectMemorySize=${jvm_direct_memory_size}"
jvm_min_heap_size="1024m"
jvm_min_heap="-Xms${jvm_min_heap_size}"
jvm_max_heap_size="1024m"
jvm_max_heap="-Xmx${jvm_max_heap_size}"
jvm_gc_options="-XX:NewSize=512m -XX:MaxNewSize=512m -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:SurvivorRatio=6 -XX:MaxTenuringThreshold=7"
jvm_gc_log_option="-XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution "
if [ ! -z "${jvm_gc_log}" ] ; then
jvm_gc_log_option="${jvm_gc_log_option} -Xloggc:${jvm_gc_log}"
fi
jvm_arg_line="-d64 ${jvm_direct_memory} ${jvm_min_heap} ${jvm_max_heap} ${jvm_gc_options} ${jvm_gc_log_option} -ea"
log4j_file_option="-l ${conf_dir}/relay_log4j.properties"
config_file_option="-p ${conf_dir}/relay.properties"
#source_file_option=-db_relay_config=conf/sources.json
java_arg_line="${config_file_option} ${log4j_file_option}"
if [ ! -z "$cli_overrides" ] ; then
cli_overrides="-c '$cli_overrides'"
fi
#main_class=com.linkedin.databus.relay.example.PersonRelayServer;
main_class=com.linkedin.databus2.relay.DatabusRelayMain
cmdline="java -cp ${cp} ${jvm_arg_line} ${main_class} ${java_arg_line} $cli_overrides $*"
echo $cmdline
$cmdline 2>&1 > ${relay_out_file} &
echo $! > ${relay_pid_file}
启动
sh start.sh -db_relay_config=conf/sources.json
这个和官方默认提供的 start-example-relay.sh 大部分是一样的 只是把main_cliass改成了DatabusRelayMain 去掉了原来需要启动时 传参的person
然后启动的时候 指定 sources.json
当然 你也可以用原先的 PersonRelayServer 这个类已经把sources-person.json定死了 或者 你也可以在sh文件中定死
比较一下 PersonRelayServer 与 DatabusRelayMain 中的main方法 发现 PersonRelayServer 中就多了一行
cli.setDefaultPhysicalSrcConfigFiles("conf/sources-person.json");
2 bst-producer 侦听端口为 11116
2.1 在mysql中添加相应的数据库
默认的数据库名称为 bootstarp 你可以在配置文件中更改
然后运行 cdsddl.tab 文件 把相应的表数据添加到mysql中
CREATE TABLE bootstrap_sources (
id int(11) NOT NULL auto_increment,
src varchar(255) NOT NULL,
status TINYINT default 1,
logstartscn bigint(20) default 0,
PRIMARY KEY (id),
UNIQUE KEY src (src)
) ENGINE=InnoDB;
CREATE TABLE bootstrap_loginfo (
srcid int(11) NOT NULL,
logid int(11) NOT NULL default 0,
minwindowscn bigint(20) NOT NULL default -1,
maxwindowscn bigint(20) NOT NULL default -1,
maxrid bigint(20) NOT NULL default 0,
deleted TINYINT default 0,
PRIMARY KEY (srcid, logid)
) ENGINE=InnoDB;
CREATE TABLE bootstrap_producer_state (
srcid int(11) NOT NULL,
logid int(11) NOT NULL default 0,
windowscn bigint(20) NOT NULL default 0,
rid bigint(20) NOT NULL default 0,
PRIMARY KEY (srcid)
) ENGINE=InnoDB;
CREATE TABLE bootstrap_applier_state (
srcid int(11) NOT NULL,
logid int(11) NOT NULL default 0,
windowscn bigint(20) NOT NULL default 0,
rid bigint(20) NOT NULL default 0,
PRIMARY KEY (srcid)
) ENGINE=InnoDB;
CREATE TABLE bootstrap_seeder_state (
srcid int(11) NOT NULL,
startscn bigint(20) NOT NULL default -1,
endscn bigint(20) NOT NULL default -1,
rid bigint(20) NOT NULL default 0,
srckey varchar(255) NOT NULL,
PRIMARY KEY (srcid)
) ENGINE=InnoDB;
CREATE TABLE bootstrap_tab_minscn (
srcid int(11) NOT NULL,
minscn bigint(20) NOT NULL default -1,
PRIMARY KEY (srcid)
) ENGINE=InnoDB;
2.2 databus-bst-producer.properties
databus.bootstrap.bootstrapDBHostname=your_mysql_host
databus.bootstrap.bootstrapDBUsername=your_mysql_username
databus.bootstrap.bootstrapDBPassword=your_mysql_password
#databus.bootstrap.bootstrapDBName=dbbus
databus.bootstrap.bootstrapLogSize=1024000
databus.bootstrap.client.container.httpPort=11116
databus.bootstrap.client.container.jmx.rmiEnabled=false
databus.bootstrap.client.connectionDefaults.pullerRetries.initSleep=50
databus.bootstrap.client.connectionDefaults.pullerRetries.maxSleep=60000
databus.bootstrap.client.connectionDefaults.pullerRetries.maxRetryNum=-1
databus.bootstrap.client.connectionDefaults.dispatcherRetries.initSleep=0
databus.bootstrap.client.connectionDefaults.dispatcherRetries.maxSleep=60000
databus.bootstrap.client.connectionDefaults.dispatcherRetries.maxRetryNum=-1
databus.bootstrap.client.connectionDefaults.eventBuffer.maxSize=10240000
databus.bootstrap.client.connectionDefaults.eventBuffer.readBufferSize=1024000
databus.bootstrap.client.connectionDefaults.eventBuffer.scnIndexSize=128
databus.bootstrap.client.connectionDefaults.eventBuffer.allocationPolicy=HEAP_MEMORY
databus.bootstrap.client.checkpointPersistence.fileSystem.rootDirectory=var/checkpoints
#这个为relay侦听的ip与端口
databus.bootstrap.client.runtime.relay(1).host=127.0.0.1
databus.bootstrap.client.runtime.relay(1).port=11115
databus.bootstrap.client.runtime.relay(1).sources=com.linkedin.events.example.person.Person
2.3 start-bst-producer.sh
用默认的 start-bst-producer.sh 即可
3 bst-server 侦听端口为11117
3.1 databus-bst-server.properties
#这里的mysql地址应该与bst-producer中一致
databus.bootstrap.db.bootstrapDBHostname=your_mysql_host
databus.bootstrap.db.bootstrapDBUsername=your_mysql_username
databus.bootstrap.db.bootstrapDBPassword=your_mysql_password
#databus.bootstrap.db.bootstrapDBName=dbbus
databus.bootstrap.db.bootstrapLogSize=1024000
databus.bootstrap.db.bootstrapBatchSize=1000
databus.bootstrap.db.container.httpPort=11117
databus.bootstrap.db.container.jmx.rmiEnabled=false
databus.bootstrap.defaultRowsThresholdForSnapshotBypass=-1
databus.bootstrap.enableMinScnCheck=false
3.2 start-bst-server.sh
用官方提供的默认 start-bst-server.sh 即可
4 client 侦听端口为11118
4.1 client.properties
databus.client.container.httpPort=11118
databus.relay.container.jmx.rmiEnabled=false
databus.relay.eventBuffer.allocationPolicy=DIRECT_MEMORY
databus.relay.eventBuffer.queuePolicy=BLOCK_ON_WRITE
databus.relay.schemaRegistry.type=FILE_SYSTEM
databus.relay.eventBuffer.maxSize=10240000
databus.relay.eventBuffer.readBufferSize=1024000
databus.relay.eventBuffer.scnIndexSize=1024000
databus.client.connectionDefaults.pullerRetries.initSleep=1
databus.client.checkpointPersistence.fileSystem.rootDirectory=./client-checkpoints
databus.client.checkpointPersistence.clearBeforeUse=false
databus.client.connectionDefaults.enablePullerMessageQueueLogging=false
#以下为relay的ip和端口
databus.client.runtime.relay(1).host=127.0.0.1
databus.client.runtime.relay(1).port=11115
databus.client.runtime.relay(1).sources=com.linkedin.events.example.person.Person
#以下为bst-server的ip和端口
databus.client.runtime.bootstrap.enabled=true
databus.client.runtime.bootstrap.service(1).host=127.0.0.1
databus.client.runtime.bootstrap.service(1).port=11117
databus.client.runtime.bootstrap.service(1).sources=com.linkedin.events.example.person.Person
4.2 启动类 ClientMain.java
public class ClientMain {
public static void main(String[] args) throws Exception {
Properties startupProps = ServerContainer.processCommandLineArgs(args);
ConfigLoader configLoader = new ConfigLoader(
"databus.client.", new DatabusHttpClientImpl.Config());
DatabusHttpClientImpl.StaticConfig clientConfig = configLoader.loadConfig(startupProps);
DatabusHttpClientImpl client = new DatabusHttpClientImpl(clientConfig);
PersonConsumer personConsumer = new PersonConsumer();
client.registerDatabusStreamListener(personConsumer, null, PersonClientMain.PERSON_SOURCE,
PersonClientMain.ANIMAL_SOURCE);
client.registerDatabusBootstrapListener(personConsumer, null, PersonClientMain.PERSON_SOURCE,
PersonClientMain.ANIMAL_SOURCE);
client.startAndBlock();
}
}
4.3 start.sh
cd `dirname $0`/..
script_dir=./bin
source $script_dir/setup.inc
source $script_dir/setup-client.inc
cli_overrides=
# DEFAULT VALUES
client_type=default
jvm_gc_log=${logs_dir}/client-gc.log
# JVM ARGUMENTS
jvm_direct_memory_size=40g
jvm_direct_memory="-XX:MaxDirectMemorySize=${jvm_direct_memory_size}"
jvm_min_heap_size="1024m"
jvm_min_heap="-Xms${jvm_min_heap_size}"
jvm_max_heap_size="1024m"
jvm_max_heap="-Xmx${jvm_max_heap_size}"
jvm_gc_options="-XX:NewSize=512m -XX:MaxNewSize=512m -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:SurvivorRatio=6 -XX:MaxTenuringThreshold=7"
jvm_gc_log_option="-XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution "
if [ ! -z "${jvm_gc_log}" ] ; then
jvm_gc_log_option="${jvm_gc_log_option} -Xloggc:${jvm_gc_log}"
fi
jvm_arg_line="-d64 ${jvm_direct_memory} ${jvm_min_heap} ${jvm_max_heap} ${jvm_gc_options} ${jvm_gc_log_option} -ea"
log4j_file_option="-l ${conf_dir}/client_log4j.properties"
config_file_option="-p ${conf_dir}/client.properties"
java_arg_line="${config_file_option} ${log4j_file_option}"
if [ ! -z "$cli_overrides" ] ; then
cli_overrides="-c '$cli_overrides'"
fi
#main_class=com.linkedin.databus.client.example.PersonClientMain;
main_class=com.linkedin.databus.client.example.ClientMain;
cmdline="java -cp ${cp} ${jvm_arg_line} ${main_class} ${java_arg_line} $cli_overrides $*"
echo $cmdline
$cmdline 2>&1 > ${client_out_file} &
echo $! > ${client_pid_file}
与老的 start-example-client.sh 相比 也只是把 main_class 改了 同时删除了启动是所需传的person 参数
5 相应的 setup-xxx.inc stop-xxxx.sh 文件也最好改一下
如
setup-client.inc
var_dir=${script_dir}/../var
if [ ! -d ${var_dir} ] ; then
mkdir -p ${var_dir}
fi
client_pid_file=${var_dir}/databus2-client.pid
client_out_file=${logs_dir}/databus2-client.out
setup-relay.inc
var_dir=${script_dir}/../var
if [ ! -d ${var_dir} ] ; then
mkdir -p ${var_dir}
fi
relay_pid_file=${var_dir}/databus2-relay.pid
relay_out_file=${logs_dir}/databus2-relay.out
databus mysql搭建_databus bootstrap 部署相关推荐
- databus mysql搭建_Databus架构分析与初步实践(for mysql)
目前关于databus的相关资料较少,特别是针对mysql的文档尤为稀少.本篇文章中介绍了databus相关组件及实现原理,初步实现了databus对mysql数据库的数据抓取,希望对后续使用者能提供 ...
- databus mysql搭建_【databus】初识Databus
1. 简介 Databus是一个低延迟.可靠的.支持事务的.保持一致性的数据变更抓取系统.由LinkedIn于2013年开源.Databus通过挖掘数据库日志的方式,将数据库变更实时.可靠的从数据库拉 ...
- rancher安装mysql_四、rancher搭建Mysql集群化部署,做到同步备份
一.Rancher基础镜像查找: 1.基础镜像操作地址:https://hub.docker.com/r/library/mariadb/ 2.选择自己需要的镜像进行搜索,里面有对应版本:也有最新的如 ...
- ubuntu mysql集群搭建_ubuntu server部署mysql集群
简介 [说明本次部署的内容,目的等等] 本部署文档的目的是如何在ubuntu server上进行mysql的群集部署. 前期准备 在进行本文档操作前,需要完成如下前期步骤: 1.安装3台ubuntu ...
- Mysql搭建PXC集群 - Percona XtraDB Cluster
转载来源:https://blog.csdn.net/lvshaorong/article/details/80501905 pxc集群是Percona XtraDB Cluster的缩写,是基于p ...
- 项目部署mysql安装_Tomcat7+jdk+mysql安装及项目部署
Tomcat7+jdk+mysql安装及项目部署 1. 下载tomcat7.jdk.mysql apache-tomcat-7.0.42.tar.gz jdk-7u25-linux-i586.gz m ...
- python django mysql安装_Django+Nginx+uWSGI+Mysql搭建Python Web服务器
原标题:Django+Nginx+uWSGI+Mysql搭建Python Web服务器 安装的时候全部选择英文,记得以前选择中文的时候安装时出了问题,服务器组件一个不选,Ubuntu安装做的很贴心,基 ...
- docker 部署_Kooteam搭建之Docker部署
Kooteam搭建之Docker部署 前言 撰写此部署的文档,主要有两个目的:1.熟悉Docker的基本使用:2.为方便自身的工作的管理,在网络上找了开源的kooteam 软件,作为自身的工作管理: ...
- MyCAT+MySQL 搭建高可用企业级数据库集群
第1章 课程介绍 课程介绍 1-1 MyCAT导学 试看 1-2 课程介绍 第2章 MyCAT入门 这一章中,我们将回顾了垂直切分,水平切分,分库分表等基础概念,然后快速回如何安装和启动MyCAT的, ...
最新文章
- 清华唐杰团队造了个“中文AI设计师”,效果比Dall·E好,可在线试玩
- 解决Unity中新导入了C#文件在vs打开一直都是杂项文件的问题
- linux文件管理相关操作
- bootstrap中点击左边展开
- Redis 服务器管理相关命令
- boost::mp11::mp_set_union相关用法的测试程序
- 台式电脑已连接但无法上网_电脑无法上网?五步帮你解决!
- Thinkphp学习笔记——友情链接的添加和验证
- 傅里叶变换 ~ 什么是傅里叶变换?
- 混合线性模型介绍--Wiki
- 这5款电影资源网站,让人第一眼就心动,第二眼就流连忘返!
- git gitlan 切糕入门
- mysql 判断当前星期_MySQL获取星期的函数
- sas table将缺失值计入百分比_逻辑回归的评分卡的SAS实现
- Linux打开21端口
- APP全栈工程师修炼之路(一)
- 初级调色转档CameraRaw
- 深度诗歌阅读:你永远是个孩子
- BP神经网络隐层节点的个数设置方法
- win32创建窗口及其消息循环