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)
上一篇 2022年10月17日 上午10:36
下一篇 2022年10月17日 上午10:36


相关推荐

  • django验证码登录_django登录验证

    django验证码登录_django登录验证djoser是什么?作用:Django认证系统的REST实现。djoser库提供了一组DjangoRestFramework视图,用于处理注册、登录、注销、密码重置和帐户激活等基本操作。它适用于

    2022年8月7日
    7
  • selenium 和 IP代理池

    selenium 和 IP代理池3.1seleniumselenium:Selenium是一个自动化测试工具,利用它可以驱动浏览器执行特定的动作,如点击、下拉等操作(模拟浏览器操作)同时还可以获取浏览器当前呈现的页面的源代码,做到可见即可爬Selenium支持非常多的浏览器,如Chrome、Firefox、PhantomJS等浏览器对象的初始化并将其赋值为browser对象。接下来,我们要做的就是调用…

    2022年5月2日
    121
  • 网站挂马检测 php,Python实现的检测网站挂马程序

    网站挂马检测 php,Python实现的检测网站挂马程序#pythoncheck_change.pyUsage:pythoncheck_change.pyupdate/home/wwwrootpythoncheck_change.pycheck/home/wwwroot#pythoncheck_change.pyupdate/data/www#生成站点的md5值#echo”>/data/www/sitema…

    2026年4月19日
    4
  • Ubuntu下libxml2的安装和使用

    Ubuntu下libxml2的安装和使用这篇文章主要介绍 libxml2 的安装和使用 xml 文件的主要作用就是配置文件 实际的应用在前面的章节 Audio 设备文件解析中有需要对 audio policy configuratio xml 文件解析 google 使用的是开源库 libxml2 在源码目录 external libxml2 下面 现在就单独对这个库进行分析 在终端中执行 wang wang test sudoapt

    2026年3月16日
    2
  • java实现HMACSHA256加密签名

    java实现HMACSHA256加密签名java 实现 HMACSHA256 加密签名 需要按照字典排序的朋友可以用 SortedMapmes newTreeMap 进行排序后在加密 version1 0 project autoTrade author QC 班长 date 2017 8 3 time 10 17 importjavax crypto Mac importjava

    2026年3月19日
    0
  • AI龙虾OpenClaw爆火 全民养虾有隐忧各方观点

    AI龙虾OpenClaw爆火 全民养虾有隐忧各方观点

    2026年3月14日
    2

发表回复

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

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