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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • IP地址的ABCDE类划分[通俗易懂]

    IP地址的ABCDE类划分[通俗易懂]1、0-—127。A类网络号码范围是0.0.0.0—127.0.0.0,用于128个网络。但网络不能近由0组成且127.0.0.0保留用于回路。剩下的126个网络,1到126,共有16777214个可能的主机地址(16777216减2)A类网络—主机——主机—主机0-1271270002、128—191。B

    2022年5月18日
    46
  • 获取textview行数

    获取textview行数如果我们想获取TextView内容的行数,TextView没有提供现成的api供我们使用,需要我们自己获取。这里提供一个间接的方法,通过StaticLayout来间接获取行数。下面是代码:publicstaticintgetTextViewLines(TextViewtextView,inttextViewWidth){intwidth=textViewWidt…

    2025年7月1日
    0
  • vector初始化与清空[通俗易懂]

    vector初始化与清空[通俗易懂]vector初始化与清空vector初始化vector<int>v;如果直接进行访问v[i]会报错解决方案:可以使用v.resize(n)或者v.resize(n,m)来初始化,前者是使用n个0来初始化,后者是使用n个m来初始化。vector清空//1.clear,清空元素,但不回收空间v.clear();//2.swap,清空元素并回收内存vector<int>().swap

    2022年9月16日
    0
  • Cocos图片加密与解密

    Cocos图片加密与解密现在做的cocos项目没有对资源进行加密处理,发布出来的APK一旦被人解包,则所有图片资源都会暴露出来,为了避免图片资源被人恶意使用,所有我准备给自己项目中使用到的图片进行简单加密,这样可以防住一部分解包伸手党。我们这里采用最常见的**异或加密**,*异或加密性质:一个数异或同一个数两次,得到的是本身*。根据这个性质,我们可以采用把图片的字节流进行异或加密,只需要设置一个Key,在本地客户端使用…

    2022年6月21日
    28
  • kworkers_kworker进程

    kworkers_kworker进程名字的意思什么时候有的这么看系统中查看显示的内容怎么看有什么用参考名字的意思KernelWorker什么时候有的kworker是3.x内核引入的这么看系统中查看Linux下使用ps-ef|grepkowrker显示的内容怎么看显示的格式kworker/%u:%d%su:是unbound的缩写,代表没有绑定特定的CPU,kworker/u2:0中的2是work_pool的

    2022年9月24日
    0
  • 解决哈希冲突的方法「建议收藏」

    解决哈希冲突的方法「建议收藏」在实际的应用中,选取合适的哈希函数可减少冲突,但冲突是不可避免的。所以我就想给大家说几种解决哈希冲突的方法啦~首先就是开放定址法,用这个方法处理冲突的核心思想就是在冲突发生的时候,形成一个地址序列,顺着这个序列挨个去检查探测,一直等到找到一个“空”的开放地址。把我们发生冲突的关键字值存放到这个“空”地址中去。这个地址的算法一般就是:Hi=(H(key)+di)%m  这里面的i=1,2,。

    2022年6月17日
    37

发表回复

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

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