databus mysql搭建_databus bootstrap 部署

databus mysql搭建_databus bootstrap 部署databus分为relaybootstrap-producer(bst-producer)bootstrap-server(bst-server)client,他们之间的关系可以去网上找这里主要介绍部署这四个工程的方法1relay侦听端口为111151.1relay.propertiesdatabus.relay.container.httpPort=11115data…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE稳定放心使用

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

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/181070.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • tp框架使用心得(六)——分页查询

    tp框架使用心得(六)——分页查询

    2021年10月21日
    42
  • a4988 脉宽要求_A4988驱动模块使用详解(附:电流调节方法)

    a4988 脉宽要求_A4988驱动模块使用详解(附:电流调节方法)DIY3D打印机的时候,各种驱动、主板、固件等的最让人头疼,稍不注意就有可能烧机….这方面的知识不补不行啊。今天给大家介绍下A4988驱动,很小很便宜的一个部件,但学问不少哦,一起来看看吧。A4988简介A4988是一款完全的微步电动机驱动器,带有内置转换器,易于操作。该产品可在全、半、1/4、1/8及1/16步进模式时操作双极步进电动机,输出驱动性能可达35V及±1A。…

    2022年6月16日
    78
  • idea修改注释字体颜色_pycharm注释颜色设置

    idea修改注释字体颜色_pycharm注释颜色设置打开IDEA左上角FileSetting–>Editor–>ColorScheme–>LanguageDefaultsComments目录下的Blockcomment 多行注释 /* */Linecomment单行注释 //DocComment文档文件/** */找不到,可以在搜索框搜关键字(如Language) …

    2022年9月30日
    2
  • 单片机结构_单片机原理读书笔记

    单片机结构_单片机原理读书笔记文章目录Chapter1:51单片机结构1.1MCS-51单片机内部结构1.1.151单片机内部结构1.1.2核心部件CPU1.2存储器1.2.1ROM和RAM1.2.2普林斯顿结构、哈佛结构1.2.3片内存储器、片外存储器1.2.4程序存储器、外部数据、内部数据存储器1.3特殊功能寄存器1.4时钟电路和复位电路1.4.1时钟电路1.4.2基本时序单位1.4.3复位…

    2022年10月4日
    4
  • 汇编语言入门教程_python语言必背代码

    汇编语言入门教程_python语言必背代码本文转载自:http://www.hack520.org/huibian转载地址:https://blog.csdn.net/ivan_zjj/article/details/76146481本讲座以汇编初学者或对汇编一点也不了解的读者为对象,汇编高手不属于该范围,但强烈建议高手指导并增补、修改本文。2任何读者可以跟此贴,提出疑问,或解答其中的问题,但对于所有跟贴,水贴、内容有错、毫…

    2022年4月20日
    52
  • 线程的notify方法_forkjoinpool默认线程数量

    线程的notify方法_forkjoinpool默认线程数量从源码角度剖析notify/notifyAll方法到底做了些什么,线程是如何唤醒的。

    2025年10月6日
    2

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号