数据库中间件DBLE学习(二) 学习配置schema.xml

PyCircuit 6:用Python和MLIR生成Verilog的硬件开发新思路 硬件描述语言(如Verilog)和高级硬件生成器(如Chisel)在开发效率与学习门槛上各有取舍。PyCircuit 6 创新性地结合Python前端与MLIR中间表示,通过自定义硬件Dialect和优化Pass,将Python代码转换为可综合的Verilog。这一方案降低了硬件生成的门槛,同时保留了MLIR的可扩展性,适用于快速原型开发、参数化IP生成及硬件加速器设计。本文深入解析其架构、实操流程与优化技巧,为硬件开发者提供新选择。 阅读详情
前言

一边有一个经常引诱我让我“娱乐至死”的视频,还有一个不停“鞭策“我让我快点学习的大BOSS。正是有这两种极端的爱才让我常常在自信中明白自己努力的方向。嗯,“人间不值得”!

SCHEMA.XML介绍

上一篇写了:数据库中间件DBLE学习(一) 基本介绍和快速搭建,主要介绍快速安装。在安装的过程中,我们配置了schema.xml文件。schema.xml是一个比较重要的文件。该文件提供了逻辑库,逻辑表,分片规则,数据分片,物理数据库等配置。它主要有以下几个标签组成。

  • schema标签,主要是逻辑库和逻辑表的配置,其中逻辑表又有多种类型,比如:全局表、分片表、ER分片表、非分片表等。
  • dataNode标签,主要定义了数据分片存放的节点,一个dataNode标签往往就对应着一个数据分片。
  • dataHost标签,主要定义了物理数据库及主从读写分离的配置。
实战SCHEMA.XML配置

接下来我们来实战一下,实战就拿经典PRODUCT表,ORDERS订单表来做实验。前面曾经介绍过逻辑表拆分可以有很多种类型。首先我们先规划一下,假设我们是一家新的电商公司,在电商平台上卖自家公司生产的商品,我们的商品总共就5-6种,但挡不住客户对我们生产的商品的喜爱,款款都是爆款啊,一经发售订单量就惊人。那么我们怎么来拆分库表呢?

  • PRODUCTS产品表,就卖几款爆品,我们要把它做成全局表。也就是每个分片上都有这个PRODUCTS产品表的数据。这样不会有多大的消耗,毕竟这个表数据量小。也比较方便和分片表进行关联。
  • ORDERS订单表,有上千万的订单。这个数据量比较大,我们要把ORDERS表做成分片表。PRODUCTS产品表和ORDERS表存在一对多的关系。我们可以按照order_id来进行取模分片。这样不会有数据过热的问题,并且产品表是小表在每个分片上都有,我们能非常方便的使用产品表和订单表进行关联。

说这么多,不如来张图给大家看一下。

如图所示,应用直接连接数据库中间件,操作逻辑库testdb,逻辑表PRODUCTS和ORDERS。而上述逻辑库和逻辑表对应存放在物理数据库主机A和主机B上。MySQL主机A上有分片dn1,MySQL主机B上有分片dn2。dn1上存储了全局表PRODUCTS和按order_id取模的ORDERS表1。dn2上存储了全局表PRODUCTS和按order_id取模的ORDERS表2。

整个脉络理清了,这是我们的配置环境。

服务器 IP地址 描述
DBLE服务器 192.168.56.185 DBLE实例,数据库中间件,负责接收SQL进行路由分发
MySQL A服务器 192.168.56.181 物理实例A,有db_1数据库
MySQL B1服务器主 192.168.56.182 物理实例B,有db_2数据库
MySQL B2服务器从 192.168.56.183 物理实例B的从库
物理MySQL环境配置

安装MySQL服务器A和MySQL服务器B的主从环境。然后在这两套物理数据库上都创建Buddy用户。

create user 'buddy'@'%' identified by '123456';
GRANT ALL PRIVILEGES ON *.* TO 'buddy'@'%' IDENTIFIED BY '123456';
配置schema标签

进入dble的conf文件夹下配置schema.xml文件。首先咱们配置schema标签。主要配置内容如下:

 <schema name="testdb">
        <!--er tables-->
        <table name="orders" primaryKey="order_id" dataNode="dn1,dn2" rule="rule_mod"/>
        <!--global  tables-->
        <table name="products" primaryKey="product_id" type="global" dataNode="dn1,dn2"/>
    </schema>
  • sehama标签

对逻辑库的定义,name指定了逻辑库的名字。

  • table标签

对表的定义,name指定了表的名字,dataNode指定这张表涉及的数据节点,这里两张表都指定的是dn1,dn2。rule指定了分片的规则,这里是取模算法。如果是全局表需要在type属性列声明为global。

配置dataNode标签
<dataNode name="dn1" dataHost="dataHost1" database="db_1"/>
<dataNode name="dn2" dataHost="dataHost2" database="db_2"/>
  • dataNode标签

name指定的是数据分片节点名称,dataHost指定对应的数据库实例,database对在mysql物理实例中的schema。

配置dataHost标签
<dataHost name="dataHost1" maxCon="1000" minCon="10" balance="0" switchType="-1" slaveThreshold="100">
    <heartbeat>show slave status</heartbeat>
    <!-- can have multi write hosts -->
    <writeHost host="hostM1" url="192.168.56.181:3306" user="buddy" password="buddy">
    </writeHost>
</dataHost>
<dataHost name="dataHost2" maxCon="
分布式数据库DBLE 快速入门 DBLE 是企业级开源分布式中间件,江湖人送外号 “MyCat Plus”;以其简单稳定,持续维护,良好的社区环境和广大的群众基础得到了社区的大力支持; 环境准备 DBLE项目资料 DBLE官方网站:https://opensource.actionsky.com 可以详细了解DBLE的背景和应用场景,本文不涉及到的细节都可在官方文档获得更细节都信息;对于刚了解到同学,可以以本文为快速入门基础 DBLE官方项目:https://github.com/actiontech/dble 如对源码有兴趣或 阅读详情

相关推荐

生产环境-Mysql高可用配置(dble+mysql+keeplived).pdf

1.体系 dble+mysql+keeplived 2.机器与软件描述 mysql01(172.28.8.65) mysql02(172.28.8.61) dble01(172.28.8.62) dble02(172.28.8.63) keeplived01(172.28.8.62) keeplived02(172.28.8.63) 亮点: 1.数据库主主复制详细代码 2.DBLE中间件用于Mysql集群的详细配置 3.keeplived保证高可用容灾

手把手教你用Cadence Virtuoso完成LNA全套仿真:基于SpectreRF手册的实战补充

本文详细指导如何使用Cadence Virtuoso和SpectreRF完成LNA的全套仿真,涵盖噪声仿真、增益压缩、THD分析及双音IP3测量等关键步骤。针对官方手册中的常见问题,提供了12个实战解决方案,包括hbnoise函数选择、双音信号源配置等,帮助工程师高效完成射频IC设计。

weixin_29102619的博客 533

【scratch音乐课】天空之城:音符与节拍、消息与链表

scratch是一个非常小巧的青少年编程工具,自带程序编写语句,积木式语句非常直观、易用,可创作数学、科学、音乐、绘画等方面作品。本文用scratch“演奏”一首大家非常熟悉的《天空之城》,并向大家介绍一些基本乐理知识,以及scratch中消息、链表的使用。

★·°立芯;︶︵︶ 1万+

OpenClaw记忆插件升级实战:从memory-lancedb-pro安装到AgentSkill封装

向量数据库作为现代AI应用的核心基础设施,通过将非结构化数据转换为高维向量并利用相似度检索实现语义理解。其原理基于嵌入模型生成向量表示,结合近似最近邻搜索算法实现高效查询。这项技术为智能体系统提供了长期记忆和上下文感知能力,显著提升了对话连贯性与任务执行效率。在AI智能体开发领域,向量数据库常用于知识库构建、对话历史管理和个性化推荐等场景。本文聚焦OpenClaw框架中memory-lancedb-pro插件的部署实践,针对**插件加载顺序**和**Apache Arrow依赖**两大常见痛点,通过封装成可

weixin_42525482的博客 643

MATLAB机械臂轨迹规划:在关节空间中生成多项式轨迹以及 jtraj函数(内容超详细讲解)

matlab机器人仿真,关节空间多项式轨迹生成

qq_40969179的博客 1万+

【Isaac Sim】无头服务器远程桌面连接实战:Turbovnc配置与常见问题解决

本文详细介绍了在无头GPU服务器上通过Turbovnc远程桌面连接并运行NVIDIA Isaac Sim的实战教程。针对无图形界面服务器运行仿真软件的核心痛点,文章提供了从Turbovnc安装配置、SSH隧道建立,到以普通用户身份启动服务、解决GLXBadFBConfig等常见图形错误的完整方案,帮助开发者在云端高效部署机器人仿真环境。

weixin_29254673的博客 776

虚拟机Ubuntu连接USRP

笔记本通过网线连接USRP。

xiaozir的博客 2322

【C++实战(62)】从0到1:C++打造TCP网络通信实战指南

本文是 C++ 网络编程实战专栏第 62 篇,聚焦 TCP 客户端与服务端开发。先阐述 TCP 协议特点、核心 API 及阻塞与非阻塞 IO 区别,打牢基础;再详解 TCP 服务端初始化、客户端连接处理与数据收发,以及客户端初始化、异常处理和协议设计;最后通过简易聊天系统实战,介绍线程池应用、协议解析及稳定性测试,助力开发者掌握 TCP 网络编程实操技能。

邓邓子的博客 1003

多准则决策方法体系(AHP、熵权法、随机森林、加权线性法、TOPSIS、模糊综合评价)

多准则决策方法体系的基础,是由三大赋权方法和三大评价框架构成的 “3+3” 核心模块。赋权方法聚焦于准则重要性的量化,评价框架则专注于多准则信息的综合集成,二者共同覆盖了从 “确定权重” 到 “输出结果” 的全流程决策需求。

```On Earth, Be Water, By Coding``` 530

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

上一篇: 聊一聊分库分表及它生产的一些概念
下一篇: 数据库中间件分片算法之hash
Buddy Yuan
博客等级 码龄21年 2粉丝 6原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值