今年夏天气温基本40℃+,想要找个群晖模板监控磁盘温度,发现官方库的群晖模板只有yaml格式。我的Zabbix是2年前官网下VMWare Zabbix Appliance 5.0 LTS镜像,只支持xml格式模板导入。我尝试将yaml转换xml导入,结果碰到各种报错。况且这个5.0 LTS镜像是基于已经EOL的CentOS 8,直接升级6.0 LTS确实有点麻烦。就有了打算部署Ubuntu 22重新安装6.0 LTS然后再迁移数据的念头。
我一开始的想法是导出模板,导出主机配置,导出等等配置再去重新导入。尝试了下发现有各种依赖关系,而且操作起来也十分繁琐,最为关键的是历史数据会全丢了。既然数据库都是mysql,干脆迁移数据库算了。
在Zabbix 5.0 Server上只需要导出zabbix数据库即可。
1
|
mysqldump -u root -p --opt --default-character-set=utf8 --hex-blob zabbix --skip-triggers --skip-lock-tables > /var/tmp/zabbix.sql
|
将zabbix.sql拷贝对/var/tmp目录下,导入Zabbix 6.0 Server数据库。
1
|
cat /var/tmp/zabbix.sql | mysql -uzabbix -p zabbix
|
完事了以后打开Web发现如下报错:
The Zabbix database version does not match current requirements. Your database version: 5010001. Required
version: 6000000. Please contact your system administrator.
这…要不我直接手动改个database version?
得了,改完直接网页都起不来了。所以Zabbix是不能直接迁移数据库么?
那只能去Internet里再遨游一会,直到我在Zabbix官方论坛里发现了这个帖子。
我靠,原来这数据库会自动升级,赶紧瞧瞧升级的怎么样了。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
cat /var/log/zabbix/zabbix_server.log | grep database
1108:20220816:235019.059 current database version (mandatory/optional): 05000000/05000005
1108:20220816:235019.059 starting automatic database upgrade
1108:20220816:235019.084 completed 0% of database upgrade
1108:20220816:235019.145 completed 1% of database upgrade
1108:20220816:235019.244 completed 2% of database upgrade
1108:20220816:235019.320 completed 3% of database upgrade
1108:20220816:235019.398 completed 4% of database upgrade
1108:20220816:235019.477 completed 5% of database upgrade
1108:20220816:235019.577 completed 6% of database upgrade
1108:20220816:235019.603 completed 7% of database upgrade
1108:20220816:235019.807 completed 8% of database upgrade
1108:20220816:235019.959 completed 9% of database upgrade
1108:20220816:235019.960 database upgrade failed
1151:20220816:235030.257 current database version (mandatory/optional): 05010036/05010036
1151:20220816:235030.257 starting automatic database upgrade
1151:20220816:235030.257 database upgrade failed
1164:20220816:235042.550 current database version (mandatory/optional): 05010036/05010036
1164:20220816:235042.550 starting automatic database upgrade
1164:20220816:235042.550 database upgrade failed
1180:20220816:235054.348 current database version (mandatory/optional): 05010036/05010036
1180:20220816:235054.348 starting automatic database upgrade
1180:20220816:235054.348 database upgrade failed
|
😷😷😷为什么就升级失败了?
会不会是安装Zabbix 6.0时在数据库导入过初始架构和数据,6.0和5.0数据库结构还是不一样,不能直接这么导入,那干脆删了重来吧。
1
2
3
|
mysql> drop database zabbix;
mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;
mysql> quit;
|
为了防止影响,这次我把Zabbix服务关了再导入数据。
1
2
3
|
sudo systemctl stop zabbix-agent.service
sudo systemctl stop zabbix-server.service
cat /var/tmp/zabbix.sql | mysql -uzabbix -p zabbix
|
赶紧“插电”瞧瞧升级的怎么样了,想法没有问题,成功点亮,轻松秒杀。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
sudo systemctl start zabbix-agent.service
sudo systemctl start zabbix-server.service
cat /var/log/zabbix/zabbix_server.log | grep database
1108:20220817:004328.912 current database version (mandatory/optional): 05000000/05000005
1108:20220817:004328.912 starting automatic database upgrade
1108:20220817:004328.938 completed 0% of database upgrade
1108:20220817:004328.998 completed 1% of database upgrade
1108:20220817:004329.087 completed 2% of database upgrade
1108:20220817:004329.161 completed 3% of database upgrade
1108:20220817:004329.235 completed 4% of database upgrade
1108:20220817:004329.312 completed 5% of database upgrade
1108:20220817:004329.404 completed 6% of database upgrade
1108:20220817:004329.431 completed 7% of database upgrade
1108:20220817:004329.622 completed 8% of database upgrade
1108:20220817:004329.788 completed 9% of database upgrade
1108:20220817:004329.849 completed 10% of database upgrade
1108:20220817:004330.238 completed 11% of database upgrade
1108:20220817:004330.311 completed 12% of database upgrade
1108:20220817:004330.372 completed 13% of database upgrade
1108:20220817:004330.408 completed 14% of database upgrade
1108:20220817:004330.448 completed 15% of database upgrade
1108:20220817:004330.590 completed 16% of database upgrade
1108:20220817:004330.621 completed 17% of database upgrade
1108:20220817:004330.681 completed 18% of database upgrade
1108:20220817:004330.793 completed 19% of database upgrade
1108:20220817:004331.016 completed 20% of database upgrade
1108:20220817:004331.236 completed 21% of database upgrade
1108:20220817:004331.455 completed 22% of database upgrade
1108:20220817:004331.663 completed 23% of database upgrade
1108:20220817:004331.691 completed 24% of database upgrade
1108:20220817:004331.748 completed 25% of database upgrade
1108:20220817:004331.815 completed 26% of database upgrade
1108:20220817:004331.859 completed 27% of database upgrade
1108:20220817:004331.933 completed 28% of database upgrade
1108:20220817:004332.360 completed 29% of database upgrade
1108:20220817:004332.465 completed 30% of database upgrade
1108:20220817:004332.517 completed 31% of database upgrade
1108:20220817:004332.567 completed 32% of database upgrade
1108:20220817:004332.637 completed 33% of database upgrade
1108:20220817:004332.642 completed 34% of database upgrade
1108:20220817:004332.674 completed 35% of database upgrade
1108:20220817:004332.698 completed 36% of database upgrade
1108:20220817:004332.733 completed 37% of database upgrade
1108:20220817:004332.774 completed 38% of database upgrade
1108:20220817:004332.822 completed 39% of database upgrade
1108:20220817:004332.879 completed 40% of database upgrade
1108:20220817:004332.927 completed 41% of database upgrade
1108:20220817:004332.952 completed 42% of database upgrade
1108:20220817:004332.961 completed 43% of database upgrade
1108:20220817:004332.974 completed 44% of database upgrade
1108:20220817:004333.007 completed 45% of database upgrade
1108:20220817:004333.068 completed 46% of database upgrade
1108:20220817:004333.211 completed 47% of database upgrade
1108:20220817:004333.233 completed 48% of database upgrade
1108:20220817:004333.251 completed 49% of database upgrade
1108:20220817:004333.307 completed 50% of database upgrade
1108:20220817:004333.349 completed 51% of database upgrade
1108:20220817:004333.377 completed 52% of database upgrade
1108:20220817:004333.448 completed 53% of database upgrade
1108:20220817:004333.488 completed 54% of database upgrade
1108:20220817:004333.552 completed 55% of database upgrade
1108:20220817:004333.650 completed 56% of database upgrade
1108:20220817:004347.613 completed 57% of database upgrade
1108:20220817:004347.696 completed 58% of database upgrade
1108:20220817:004347.714 completed 59% of database upgrade
1108:20220817:004347.763 completed 60% of database upgrade
1108:20220817:004348.040 completed 61% of database upgrade
1108:20220817:004348.148 completed 62% of database upgrade
1108:20220817:004348.558 completed 63% of database upgrade
1108:20220817:004348.882 completed 64% of database upgrade
1108:20220817:004349.354 completed 65% of database upgrade
1108:20220817:004349.379 completed 66% of database upgrade
1108:20220817:004349.418 completed 67% of database upgrade
1108:20220817:004349.460 completed 68% of database upgrade
1108:20220817:004349.511 completed 69% of database upgrade
1108:20220817:004349.531 completed 70% of database upgrade
1108:20220817:004349.580 completed 71% of database upgrade
1108:20220817:004349.623 completed 72% of database upgrade
1108:20220817:004349.682 completed 73% of database upgrade
1108:20220817:004349.726 completed 74% of database upgrade
1108:20220817:004349.768 completed 75% of database upgrade
1108:20220817:004349.773 completed 76% of database upgrade
1108:20220817:004349.778 completed 77% of database upgrade
1108:20220817:004349.782 completed 78% of database upgrade
1108:20220817:004349.821 completed 79% of database upgrade
1108:20220817:004349.915 completed 80% of database upgrade
1108:20220817:004349.922 completed 81% of database upgrade
1108:20220817:004349.951 completed 82% of database upgrade
1108:20220817:004349.979 completed 83% of database upgrade
1108:20220817:004350.021 completed 84% of database upgrade
1108:20220817:004350.090 completed 85% of database upgrade
1108:20220817:004350.103 completed 86% of database upgrade
1108:20220817:004350.108 completed 87% of database upgrade
1108:20220817:004350.198 completed 88% of database upgrade
1108:20220817:004350.582 completed 89% of database upgrade
1108:20220817:004350.664 completed 90% of database upgrade
1108:20220817:004350.690 completed 91% of database upgrade
1108:20220817:004350.721 completed 92% of database upgrade
1108:20220817:004350.760 completed 93% of database upgrade
1108:20220817:004350.805 completed 94% of database upgrade
1108:20220817:004350.841 completed 95% of database upgrade
1108:20220817:004350.908 completed 96% of database upgrade
1108:20220817:004350.976 completed 97% of database upgrade
1108:20220817:004350.988 completed 98% of database upgrade
1108:20220817:004350.991 completed 99% of database upgrade
1108:20220817:004350.999 completed 100% of database upgrade
1108:20220817:004350.999 database upgrade fully completed
1108:20220817:004351.002 database could be upgraded to use primary keys in history tables
1103:20220817:010427.831 current database version (mandatory/optional): 06000000/06000004
1103:20220817:010427.836 database could be upgraded to use primary keys in history tables
15608:20220817:092735.931 current database version (mandatory/optional): 06000000/06000004
15608:20220817:092735.938 database could be upgraded to use primary keys in history tables
|
检查一下主机、模板、历史数据都正常,就是原来5.0的聚合图形不见了,这么好用的功能怎么就删了呢?