mirror of
https://gitee.com/wangbin579/cetus.git
synced 2024-11-30 02:47:35 +08:00
emphasize proxy_heart_beat creation
This commit is contained in:
parent
1d393b5cfe
commit
ea29096890
@ -68,12 +68,14 @@ create database if not exists proxy_heart_beat;
|
|||||||
use proxy_heart_beat;
|
use proxy_heart_beat;
|
||||||
CREATE TABLE if not exists `tb_heartbeat` (
|
CREATE TABLE if not exists `tb_heartbeat` (
|
||||||
`p_id` varchar(128) NOT NULL ,
|
`p_id` varchar(128) NOT NULL ,
|
||||||
`p_ts` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
`p_ts` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
|
||||||
PRIMARY KEY (`p_id`)
|
PRIMARY KEY (`p_id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
GRANT ALL ON `proxy_heart_beat`.* TO 'cetus_app'@'192.0.0.1';
|
GRANT ALL ON `proxy_heart_beat`.* TO 'cetus_app'@'192.0.0.1';
|
||||||
|
|
||||||
|
**注意:创建心跳表时p_ts精度必须到小数点后,否则会影响主从延迟检测的准确度**
|
||||||
|
|
||||||
## sharding版MySQL环境准备
|
## sharding版MySQL环境准备
|
||||||
|
|
||||||
若使用sharding功能,则需要根据业务创建业务表,并进行分库设计,若开启主从延迟检测,请参考读写分离版本配置心跳库和心跳表。
|
若使用sharding功能,则需要根据业务创建业务表,并进行分库设计,若开启主从延迟检测,请参考读写分离版本配置心跳库和心跳表。
|
||||||
|
@ -20,7 +20,7 @@ Cetus 读写分离版将前端发来的读请求和写请求分别发送到不
|
|||||||
|
|
||||||
CREATE TABLE tb_heartbeat (
|
CREATE TABLE tb_heartbeat (
|
||||||
p_id varchar(128) NOT NULL,
|
p_id varchar(128) NOT NULL,
|
||||||
p_ts timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
p_ts timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
|
||||||
PRIMARY KEY (p_id)
|
PRIMARY KEY (p_id)
|
||||||
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
|
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ SET FOREIGN_KEY_CHECKS = 0;
|
|||||||
DROP TABLE IF EXISTS `tb_heartbeat`;
|
DROP TABLE IF EXISTS `tb_heartbeat`;
|
||||||
CREATE TABLE `tb_heartbeat` (
|
CREATE TABLE `tb_heartbeat` (
|
||||||
`p_id` varchar(128) NOT NULL,
|
`p_id` varchar(128) NOT NULL,
|
||||||
`p_ts` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
`p_ts` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
|
||||||
PRIMARY KEY (`p_id`)
|
PRIMARY KEY (`p_id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
@ -487,9 +487,9 @@ update_master_timestamp(int fd, short what, void *arg)
|
|||||||
|
|
||||||
/* Catch RW time
|
/* Catch RW time
|
||||||
* Need a table to write from master and read from slave.
|
* Need a table to write from master and read from slave.
|
||||||
* CREATE TABLE `tb_heartbeat` (
|
* CREATE TABLE if not exists `tb_heartbeat` (
|
||||||
* `p_id` varchar(128) NOT NULL,
|
* `p_id` varchar(128) NOT NULL,
|
||||||
* `p_ts` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
* `p_ts` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
|
||||||
* PRIMARY KEY (`p_id`)
|
* PRIMARY KEY (`p_id`)
|
||||||
* ) ENGINE = InnoDB DEFAULT CHARSET = utf8;
|
* ) ENGINE = InnoDB DEFAULT CHARSET = utf8;
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user