Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metrcs中大于255长度的tags无法写入mysql数据库 #19

Closed
liuts opened this issue Dec 24, 2018 · 1 comment
Closed

metrcs中大于255长度的tags无法写入mysql数据库 #19

liuts opened this issue Dec 24, 2018 · 1 comment

Comments

@liuts
Copy link
Contributor

liuts commented Dec 24, 2018

metrcs中大于255长度的tags无法写入mysql数据库

@liuts
Copy link
Contributor Author

liuts commented Dec 24, 2018

1,将metric表中 tags字段改为 text
2,将索引 改为tags(255)
改后的表为:
CREATE TABLE metric (
id int(10) unsigned NOT NULL AUTO_INCREMENT,
host_id char(32) COLLATE utf8_unicode_ci NOT NULL,
metric varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'cpu.idle/cpu=all',
tags text COLLATE utf8_unicode_ci NOT NULL,
dt enum('GAUGE','DERIVE','COUNTER') COLLATE utf8_unicode_ci NOT NULL,
cycle int(10) NOT NULL,
create_at datetime NOT NULL,
update_at datetime NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY idx_name (metric,host_id,tags(255)) USING BTREE,
KEY fk_metric_host (host_id),
CONSTRAINT fk_metric_host FOREIGN KEY (host_id) REFERENCES host (id) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=4989794 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

@liuts liuts closed this as completed Dec 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant