Skip to content

[配置]sequence

jamie12221 edited this page Nov 29, 2020 · 1 revision

配置序列号

{数据库名字}_{表名字}.sequence.json放置在sequecnes文件夹下面

{
	"clazz":"io.mycat.plug.sequence.SequenceMySQLGenerator",
	"name":"db1_travelrecord"
}

如果不配置,分片表使用雪花算法生成全局序列号

io.mycat.plug.sequence.SequenceMySQLGenerator
{
	"clazz":"io.mycat.plug.sequence.SequenceMySQLGenerator",
	"name":"db1_travelrecord"
}

在prototype服务器的db1库导入dbseq.sql文件

在mycat_sequence表建立db1_travelrecord行,即可,Mycat会从更新此行获得序列号

可选参数targetName 更改序列号服务器

{
	"clazz":"io.mycat.plug.sequence.SequenceMySQLGenerator",
	"name":"db1_travelrecord",
    "targetName": "prototype"
}
Clone this wiki locally