ccfos / nightingale

An all-in-one observability solution which aims to combine the advantages of Prometheus and Grafana. It manages alert rules and visualizes metrics, logs, traces in a beautiful web UI.
https://flashcat.cloud/docs/
Apache License 2.0
9.86k stars 1.43k forks source link

从7.3.4 升级到 7.4.1 后,基础设施下面的机器列表出现报错 #2205

Closed cnkmmk closed 1 month ago

cnkmmk commented 1 month ago

Question and Steps to reproduce

刚才对正在使用的 7.3.4 进行了升级,升级版本为 7.4.1,升级过程为把压缩包解压,把解压后的n9e开头的文件覆盖原有的。 再启动服务后,感觉系统速度比原有慢,看介绍说机器列表有调整,点进去后页面右上角出现报错。

Error 1267: Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8mb4_uca1400_ai_ci,IMPLICIT) for operation '='

Relevant logs and configurations

通过journalctl,在点击机器列表时出现的日志。

Sep 29 14:51:00 Nightingale n9e[2887929]: 2024-09-29 14:51:00.897048 WARNING eval/eval.go:346 rule_eval:alert-0-1 targets not found engineName:default
Sep 29 14:51:01 Nightingale n9e[2887929]: 2024-09-29 14:51:01.520696 ERROR ormx/ormx.go:67 /home/runner/work/nightingale/nightingale/models/common.go:21 Error 1267: Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8mb4_uca1400_ai_ci,IMPLICIT) for operation '='
Sep 29 14:51:01 Nightingale n9e[2887929]: [0.872ms] [rows:0] SELECT count(*) FROM `target` WHERE ident in (SELECT DISTINCT target.ident FROM `target` join target_busi_group on target.ident = target_busi_group.target_ident WHERE target_busi_group.group_id in (1))
Sep 29 14:51:01 Nightingale n9e[2887929]: 2024-09-29 14:51:01.526001 ERROR ormx/ormx.go:67 /home/runner/work/nightingale/nightingale/models/common.go:21 Error 1267: Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8mb4_uca1400_ai_ci,IMPLICIT) for operation '='
Sep 29 14:51:01 Nightingale n9e[2887929]: [0.596ms] [rows:0] SELECT count(*) FROM `target` WHERE ident in (SELECT DISTINCT target.ident FROM `target` join target_busi_group on target.ident = target_busi_group.target_ident WHERE target_busi_group.group_id in (1))
Sep 29 14:51:04 Nightingale n9e[2887929]: 2024-09-29 14:51:04.009870 ERROR ormx/ormx.go:67 /home/runner/work/nightingale/nightingale/models/alert_rule.go:1072 Error 1267: Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8mb4_uca1400_ai_ci,IMPLICIT) for operation '='
Sep 29 14:51:04 Nightingale n9e[2887929]: [0.751ms] [rows:0] SELECT * FROM `target` WHERE ident in (SELECT DISTINCT target.ident FROM `target` left join target_busi_group on target.ident = target_busi_group.target_ident)
Sep 29 14:51:04 Nightingale n9e[2887929]: 2024-09-29 14:51:04.009968 ERROR models/alert_rule.go:1074 failed to query targets: Error 1267: Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8mb4_uca1400_ai_ci,IMPLICIT) for operation '='


### Version

system: debian 12.7
nightingale: 7.4.1
CPU架构:x86-x64
710leo commented 1 month ago

@cnkmmk 这个是因为 target_busi_group 和 target 的表的 COLLATE 不同,可以联到 n9e 的数据库中,执行下下面的sql,就不会再报错了

ALTER TABLE target_busi_group 
CONVERT TO CHARACTER SET utf8mb4 
COLLATE utf8mb4_general_ci;
cnkmmk commented 1 month ago

感谢,已经不再报错了。