mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-12 03:09:25 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3e51722085 | ||
|
|
d5f5287ca3 | ||
|
|
f0f491fa86 | ||
|
|
bbaa00a479 | ||
|
|
6df248ec22 | ||
|
|
eae61c827d | ||
|
|
eed5c91435 | ||
|
|
9e09952471 | ||
|
|
46a3591019 | ||
|
|
5419a01b5c | ||
|
|
3770ebc0f3 | ||
|
|
209ae03e63 | ||
|
|
fc7609874d | ||
|
|
3c99f17158 | ||
|
|
6fb3a52e31 | ||
|
|
4f6a626e3e | ||
|
|
7021015a66 | ||
|
|
185c5cb45b | ||
|
|
011d3dccaa | ||
|
|
a629eeac55 | ||
|
|
d3ce4a1aac | ||
|
|
8ff13fac5b | ||
|
|
d5c232201b | ||
|
|
fb4e16790e | ||
|
|
be4cdd194d | ||
|
|
398165d832 | ||
|
|
7d70fdcd1d | ||
|
|
5c33504582 | ||
|
|
e4223a7a58 | ||
|
|
f2d5e166da | ||
|
|
55d0f2fad8 | ||
|
|
58068a06dd | ||
|
|
01a76ff5de | ||
|
|
53dd0d81e7 | ||
|
|
8d4b5e8403 | ||
|
|
c6e491a9bc | ||
|
|
55f6a3189c | ||
|
|
dfaa041843 | ||
|
|
0bcf0465a6 | ||
|
|
517c65b790 | ||
|
|
4bda6ab1b1 | ||
|
|
5a71ec8d6c | ||
|
|
f622ea6779 | ||
|
|
875db69bcf | ||
|
|
97a07b4955 | ||
|
|
0912360794 | ||
|
|
bfc2a82384 | ||
|
|
6f02ccf6e7 | ||
|
|
36e7085ce0 | ||
|
|
044f130671 | ||
|
|
bf95d50cfd | ||
|
|
63349ce33b | ||
|
|
3618940713 | ||
|
|
f5f9064c52 | ||
|
|
fd8bda7f48 | ||
|
|
5e9b5466a6 | ||
|
|
82a0fde37c | ||
|
|
72367c40fe | ||
|
|
b8502c7459 | ||
|
|
6b33cfe6bb | ||
|
|
81e61a469e | ||
|
|
267213efc1 | ||
|
|
03ca9512a4 | ||
|
|
e77b24a213 | ||
|
|
6118c49335 | ||
|
|
843321dfe5 | ||
|
|
bd13bc8d68 | ||
|
|
9f8af72c70 | ||
|
|
50e3173706 | ||
|
|
a43bfbebab | ||
|
|
ffaac9553e | ||
|
|
f480cbeda4 | ||
|
|
e8a72a0b7a | ||
|
|
b4b14d2c28 | ||
|
|
672ebb013f | ||
|
|
8e5f1ae809 | ||
|
|
1cf77806ba | ||
|
|
d1a6c61bd8 | ||
|
|
e15cb57c27 | ||
|
|
c187c36c51 | ||
|
|
5bec8e0c38 | ||
|
|
ed4a58025b | ||
|
|
67178757c0 | ||
|
|
d4679e2b5c | ||
|
|
7b8ecd520c | ||
|
|
f2c188b245 | ||
|
|
8ca6c32a76 | ||
|
|
e6ac37644b | ||
|
|
048df7e1e7 | ||
|
|
73f0ed73d4 | ||
|
|
4ce9a8cc0f | ||
|
|
3c6538565e | ||
|
|
995fa234d9 | ||
|
|
efa9890019 | ||
|
|
d7f710d3e0 | ||
|
|
552cab5632 | ||
|
|
4d32683e66 | ||
|
|
2cd41b91f5 | ||
|
|
d26f840b68 | ||
|
|
93ddd3c2c4 | ||
|
|
95dcd4c04d | ||
|
|
a886359e94 | ||
|
|
1d48010a0d | ||
|
|
b220628ca1 | ||
|
|
c7a8ca2ec9 | ||
|
|
9720cf7a69 | ||
|
|
4eb33806bf | ||
|
|
3d12bbcdd1 | ||
|
|
fa8b2aefb7 | ||
|
|
e08bea00eb | ||
|
|
8427a0d9be | ||
|
|
79a44f4b15 | ||
|
|
2dba6e6816 | ||
|
|
258576963d | ||
|
|
68e9ffffe3 | ||
|
|
b26717eab3 | ||
|
|
83810a8dd8 | ||
|
|
3ba6d5c3c4 | ||
|
|
c6b5a92e7d | ||
|
|
8a5e2a45dc | ||
|
|
0fd5ef28e2 | ||
|
|
fcb5a44abe | ||
|
|
fb83cb40df | ||
|
|
4211934490 | ||
|
|
4ca64694ff | ||
|
|
75d13f3cc7 | ||
|
|
db14ede309 | ||
|
|
9e2d17f3f3 | ||
|
|
7af56e1c56 | ||
|
|
0c06ae6028 | ||
|
|
c39076dfb7 | ||
|
|
fd81666453 | ||
|
|
2e7afad20b | ||
|
|
c962c6f86a | ||
|
|
277939ba29 | ||
|
|
c7f3445e79 | ||
|
|
c1a1e80185 | ||
|
|
16892d474e | ||
|
|
167977a3d1 | ||
|
|
bc876232f9 | ||
|
|
d529ff596b | ||
|
|
c7cad36fde | ||
|
|
b299d5f74b | ||
|
|
20df24ca80 | ||
|
|
2482a24898 | ||
|
|
9621f112d1 | ||
|
|
82e2ee2aea | ||
|
|
b602ab678f | ||
|
|
03a5f750ec | ||
|
|
e3888244ac | ||
|
|
d0a513d64d | ||
|
|
26817c7e61 | ||
|
|
cad77c69d9 | ||
|
|
ad0b667ed2 | ||
|
|
bc6c1886b9 | ||
|
|
084843586e | ||
|
|
981e320664 | ||
|
|
e57e043edf | ||
|
|
5045af850f | ||
|
|
59f80800c3 | ||
|
|
ae4db462b0 | ||
|
|
ab939aa359 | ||
|
|
e90c4a0e19 | ||
|
|
bed6b7c347 | ||
|
|
f626291e2e | ||
|
|
996e452966 | ||
|
|
d32ccbce0c | ||
|
|
72b44bcceb | ||
|
|
ed02c3bad6 | ||
|
|
86deba3111 | ||
|
|
dbc7fc08a8 | ||
|
|
948dadcf57 | ||
|
|
f0a7ceb255 | ||
|
|
c14bd47ad2 | ||
|
|
0824c0f509 | ||
|
|
0177e3d7bb | ||
|
|
159701e840 | ||
|
|
1c47a4cc2f | ||
|
|
f9caafcb86 | ||
|
|
da6d8aa797 | ||
|
|
88a846aef1 | ||
|
|
6ee0780fec | ||
|
|
116549329c | ||
|
|
11d90b704a | ||
|
|
8bdc60e75a | ||
|
|
7fd3e4e0a7 | ||
|
|
18ed21b36a | ||
|
|
b77801112f | ||
|
|
efb237c783 | ||
|
|
15375c575a | ||
|
|
e5dc00dbd3 | ||
|
|
8d8231f787 | ||
|
|
025ed5aa5a | ||
|
|
b62d228ec8 | ||
|
|
01894ad91e | ||
|
|
ee3258196b | ||
|
|
b1ce9fb05e | ||
|
|
2c996b0a41 | ||
|
|
e4ded8950e | ||
|
|
11a69cfb8b | ||
|
|
85fa8fcbd1 | ||
|
|
68b2bcee33 | ||
|
|
1796eecc9b | ||
|
|
d6b0601f74 | ||
|
|
2c250ee67c | ||
|
|
5b451e211f | ||
|
|
1389f210de | ||
|
|
b0f0706dfd | ||
|
|
8f66e8c39e | ||
|
|
3c788afce6 | ||
|
|
e03ada5191 | ||
|
|
7998177e03 | ||
|
|
aef54656d2 | ||
|
|
9b52fee2a7 | ||
|
|
f89be00419 | ||
|
|
bad4415650 | ||
|
|
e5f3e85f8b | ||
|
|
0c45a5035b | ||
|
|
c3347fcb28 | ||
|
|
a97e8ceee5 | ||
|
|
87da782cc3 | ||
|
|
7416be6680 | ||
|
|
df8eb7f9ef | ||
|
|
8198ea6941 | ||
|
|
6f7513a013 | ||
|
|
5f163b0661 | ||
|
|
11a9bd2ecc | ||
|
|
1e6f143eb7 | ||
|
|
b99bd5fded | ||
|
|
442896eadc | ||
|
|
38c7b2d44e | ||
|
|
662e983f01 | ||
|
|
de402e9996 | ||
|
|
69fc4323f3 | ||
|
|
617a986325 | ||
|
|
c09c7fa1a8 | ||
|
|
2b43680099 | ||
|
|
c1bb8ad7a6 | ||
|
|
f59c68edb8 | ||
|
|
85ae2ff349 | ||
|
|
b52635c747 | ||
|
|
d09c8ac98f | ||
|
|
1921deb7e3 | ||
|
|
a21c7eac02 | ||
|
|
50ab9c21cd | ||
|
|
edd1b34217 | ||
|
|
c1f165bfa3 | ||
|
|
799be0fd3e | ||
|
|
1f8c975c4d | ||
|
|
b10967bfad | ||
|
|
835cf6ad8f | ||
|
|
6b55a4e0ca | ||
|
|
aa3a5a90c4 | ||
|
|
5f34d52542 | ||
|
|
ad49cadfb8 | ||
|
|
b4c00a2d27 | ||
|
|
42dfe63c2f | ||
|
|
4fa2588b66 | ||
|
|
a3227a681a | ||
|
|
1abbaa29ff | ||
|
|
b783a90d81 | ||
|
|
263243ecd4 | ||
|
|
5942c2e822 | ||
|
|
0a87dcc610 | ||
|
|
a80e1db128 | ||
|
|
fad851edea | ||
|
|
4d23d7d354 | ||
|
|
a19fe7b0b5 | ||
|
|
15096e7954 | ||
|
|
2da9b59ae9 | ||
|
|
c4cda94309 | ||
|
|
d32dd19dd0 | ||
|
|
269d0dc57e | ||
|
|
bd221e2c75 | ||
|
|
eb26c7d4e1 | ||
|
|
4de0ecb5cc | ||
|
|
5753e3fb51 | ||
|
|
14cf933487 | ||
|
|
df240ac681 | ||
|
|
cf2d53fe0d | ||
|
|
520f46441e | ||
|
|
be1117ba31 | ||
|
|
e35ff2da63 | ||
|
|
99f91768ad | ||
|
|
d8e6e63b90 | ||
|
|
9f4a3ed53d | ||
|
|
b06dd84f6b | ||
|
|
bf77d84227 | ||
|
|
1ff24a2835 | ||
|
|
a10f31f4fb | ||
|
|
c47dac6731 | ||
|
|
0de883b5b1 | ||
|
|
a160b5bfac | ||
|
|
d7580842a8 | ||
|
|
40dfc60079 | ||
|
|
bfa593ea46 | ||
|
|
68de2d2c5f | ||
|
|
e883ccfb62 | ||
|
|
2f530d8c9e | ||
|
|
43e7363535 | ||
|
|
fbe8a06d0b | ||
|
|
421757e88a | ||
|
|
07340dc68c | ||
|
|
f7559f6a55 | ||
|
|
dd45fb47d6 | ||
|
|
d2ade7aa90 | ||
|
|
7bed4cda8e | ||
|
|
24c37d5b92 | ||
|
|
c03add82a5 | ||
|
|
6f443ef414 | ||
|
|
939b44699f | ||
|
|
db5f979149 | ||
|
|
ded03b5c46 | ||
|
|
f755a39589 | ||
|
|
788c097a50 | ||
|
|
3fe4c80784 | ||
|
|
74ae353761 | ||
|
|
05d62c7105 | ||
|
|
79ffa0b5b1 | ||
|
|
ec68096e52 | ||
|
|
2e79def40d | ||
|
|
c0fbf71a8e | ||
|
|
cb62e367ec | ||
|
|
1608fae975 | ||
|
|
8d1ce42004 | ||
|
|
fd7314b603 | ||
|
|
e2433964e9 | ||
|
|
9ef7b36998 | ||
|
|
9ae7fd716c | ||
|
|
7fbc7bef5e | ||
|
|
43bab2a80e | ||
|
|
b4eaec1ca5 | ||
|
|
c391e54ee5 | ||
|
|
0c226b1fc7 | ||
|
|
b218874a2b | ||
|
|
fce367075d | ||
|
|
f06b5004e2 | ||
|
|
03c5191e89 | ||
|
|
492ac0bb60 | ||
|
|
9ab9330671 | ||
|
|
9851b5406e | ||
|
|
19e10199e0 | ||
|
|
f11b1b3219 | ||
|
|
49c37fa307 | ||
|
|
d7fedc3118 | ||
|
|
0cd9f7f0d6 | ||
|
|
82f6b8cb56 | ||
|
|
1f723ab8e0 | ||
|
|
9496968fbb | ||
|
|
c1e66ac574 | ||
|
|
0b6506885a | ||
|
|
d018163ef2 | ||
|
|
d89ab5c45f | ||
|
|
c3c536632d | ||
|
|
b73070231e | ||
|
|
a9c0c0d1d2 | ||
|
|
f65b16723b | ||
|
|
69f828b169 | ||
|
|
dbf0b963bd | ||
|
|
5c20185426 | ||
|
|
f976b8c315 | ||
|
|
d5fac8bb07 | ||
|
|
c33431a2fc | ||
|
|
23ba7bf636 | ||
|
|
232f992203 | ||
|
|
4438d5a8b4 | ||
|
|
ca213242fd | ||
|
|
360221aa7a | ||
|
|
987f56331b | ||
|
|
8ee23d694f | ||
|
|
0f93997aed | ||
|
|
012bc92042 | ||
|
|
ef6fdfc71c | ||
|
|
150d8e30b0 | ||
|
|
491927a32c | ||
|
|
f5020404df | ||
|
|
d4ddf22e5b | ||
|
|
45b30dc38e | ||
|
|
fed57f1f68 | ||
|
|
6d02d6a85f | ||
|
|
39bc0ff55d | ||
|
|
9e0f045696 | ||
|
|
2d1897fe62 | ||
|
|
b35107016e | ||
|
|
67f5342be4 | ||
|
|
835796a9b1 | ||
|
|
b32fe10047 | ||
|
|
43bdff7af1 | ||
|
|
6628e135fc | ||
|
|
e94dc60f28 | ||
|
|
8a4453ec84 | ||
|
|
1916e4c34a | ||
|
|
f2a54682a1 | ||
|
|
163903cc8a | ||
|
|
6653f0b8ee | ||
|
|
7fa0200889 | ||
|
|
7bf0611d67 | ||
|
|
1cd3c3df17 | ||
|
|
e9ff82f0a3 | ||
|
|
e381309ba7 | ||
|
|
bd6d063a49 | ||
|
|
de1e1401b9 | ||
|
|
52bb6099d7 | ||
|
|
f42ec4973a | ||
|
|
ba8374cc5a | ||
|
|
d1f0ee9c20 | ||
|
|
2a934daf89 | ||
|
|
ac0fab2f2b | ||
|
|
ffab97d4c8 | ||
|
|
f51ed6115d | ||
|
|
f126015e70 | ||
|
|
699f71e636 | ||
|
|
88a7431067 | ||
|
|
bf256c6e60 | ||
|
|
0c718229d1 | ||
|
|
2366a4e551 | ||
|
|
81bddd7eee | ||
|
|
35f2791c72 | ||
|
|
0dbbbf4359 | ||
|
|
04b7e07e90 | ||
|
|
85c84b64c4 | ||
|
|
b0014c0477 | ||
|
|
a53ad5d1b1 | ||
|
|
73a418376d | ||
|
|
437088663e | ||
|
|
9db5188d30 | ||
|
|
53563cb130 | ||
|
|
c989644c6f | ||
|
|
c2a55f2658 | ||
|
|
8ca63c0396 | ||
|
|
3b1fcac0aa | ||
|
|
7c093617f5 | ||
|
|
9e2f1dc172 | ||
|
|
25591dc3e5 | ||
|
|
4596a3a73c | ||
|
|
818ab604e2 | ||
|
|
04e18490fb | ||
|
|
b519bb5522 | ||
|
|
9d8e76faec | ||
|
|
cbdfb1a033 | ||
|
|
8b10a5839a | ||
|
|
905cecc060 | ||
|
|
486cf03c79 | ||
|
|
735b669d44 | ||
|
|
489caa6070 | ||
|
|
f6284ed167 | ||
|
|
a843dd4a87 | ||
|
|
b5c14926df | ||
|
|
8b58c34e5b | ||
|
|
f29d10b0b9 | ||
|
|
ce15f78a56 | ||
|
|
033db86d3b | ||
|
|
7d32309183 | ||
|
|
353290cfa8 | ||
|
|
a7aa34795b | ||
|
|
994bc4aa6a | ||
|
|
9737d65592 | ||
|
|
e9ee66e932 | ||
|
|
42f66a2fb8 | ||
|
|
5aaac1bdec | ||
|
|
57a1721f62 | ||
|
|
8134c3c9c0 | ||
|
|
cdaf64b41b | ||
|
|
5f5384f5aa | ||
|
|
a11e43f9a5 | ||
|
|
b76a9bf13c | ||
|
|
4653667ef1 | ||
|
|
a1cc2f0147 | ||
|
|
d08b97415b | ||
|
|
7fc9045688 | ||
|
|
d9f77537f1 | ||
|
|
bc8a874c68 | ||
|
|
8067c20e5a | ||
|
|
22526d5255 | ||
|
|
83f846eb69 | ||
|
|
61a8bf0275 | ||
|
|
1662c3ff3f | ||
|
|
41a1fa856c | ||
|
|
eee5881ca7 | ||
|
|
3ce92f2477 | ||
|
|
4020ecff80 | ||
|
|
979b86b7cb | ||
|
|
26080ade0e | ||
|
|
4deb9c59ea | ||
|
|
b640515243 | ||
|
|
130da4e311 | ||
|
|
dcca93baef | ||
|
|
92525b0549 | ||
|
|
fa0bca88b3 | ||
|
|
72961e3dca | ||
|
|
7ac4000687 | ||
|
|
3c0d0f9036 | ||
|
|
790fa18e1b | ||
|
|
7b06b5533c | ||
|
|
9301783c3a | ||
|
|
39359ab783 | ||
|
|
a44be32cdc | ||
|
|
d4a4f238f2 | ||
|
|
60584ee79f | ||
|
|
95845663f4 | ||
|
|
d1991b5c0d | ||
|
|
5448ba4611 | ||
|
|
11b59cdc41 | ||
|
|
05234cba77 | ||
|
|
f17c7f3d13 | ||
|
|
546792b733 | ||
|
|
4e38909ef2 | ||
|
|
d411439734 | ||
|
|
599d3ca8fc | ||
|
|
5a2bb0ca5c | ||
|
|
a1492d4f3e | ||
|
|
aee881b302 | ||
|
|
6287dc523d | ||
|
|
a9a48aef39 | ||
|
|
ef861ef28e | ||
|
|
9af9908ab2 | ||
|
|
29fd76fc91 | ||
|
|
b69f978371 | ||
|
|
89cea53d92 | ||
|
|
2a08d91021 | ||
|
|
c726bc48a9 | ||
|
|
69272110fb | ||
|
|
682502ff2b | ||
|
|
345eff8a0b | ||
|
|
dec8135478 | ||
|
|
60f37fa586 | ||
|
|
61849bb14e | ||
|
|
f32a40b53f | ||
|
|
4e2921f3b9 | ||
|
|
8652f3b2d8 | ||
|
|
d4f75fa0f1 | ||
|
|
93accf9ff3 | ||
|
|
22b06b36f9 | ||
|
|
b0a763f972 | ||
|
|
44e4dfb0bd | ||
|
|
80fe60211f | ||
|
|
0a1e47da4d | ||
|
|
a6acecb8c2 | ||
|
|
33cb0149f2 | ||
|
|
ff873d2e2d | ||
|
|
bc184f03cc | ||
|
|
b3147b9a2c | ||
|
|
8a4e64a079 | ||
|
|
24bb36e320 | ||
|
|
285aa45de8 | ||
|
|
b9eee76b6e | ||
|
|
e3bb8e6463 | ||
|
|
e72f33b201 | ||
|
|
22fe247707 | ||
|
|
a3a44e1494 | ||
|
|
9c3dcaf2ec | ||
|
|
2a088241da | ||
|
|
ed8af0728b | ||
|
|
cc01c5cbc1 | ||
|
|
828a079184 | ||
|
|
189f73e522 | ||
|
|
692f51fe44 | ||
|
|
ddacecec9a | ||
|
|
af629be9e0 | ||
|
|
dc76d41369 | ||
|
|
cc65840a1f | ||
|
|
dad72a1fe2 | ||
|
|
e43eff325b | ||
|
|
1a41f2d248 | ||
|
|
58274ba9dc | ||
|
|
aa22501aac | ||
|
|
b74e733252 | ||
|
|
2cc714abf0 | ||
|
|
d86e6dd5c4 | ||
|
|
31f7269ba5 | ||
|
|
f335f08c27 | ||
|
|
7a16486105 | ||
|
|
4a05152adc | ||
|
|
379478b2c2 | ||
|
|
c2b3d4113a | ||
|
|
4655867db0 | ||
|
|
5daf371c65 | ||
|
|
8488f73d7f | ||
|
|
2788d76c00 | ||
|
|
d55a89766e | ||
|
|
df64e00a27 | ||
|
|
4569c20f58 | ||
|
|
d0cdbf48d2 | ||
|
|
24b45afe6f | ||
|
|
a577235ccc | ||
|
|
cc98b3322a | ||
|
|
214d784413 | ||
|
|
c2c02f9c62 | ||
|
|
c4ce555f91 | ||
|
|
5901b1bd33 | ||
|
|
2c65fc65dd | ||
|
|
322141b927 | ||
|
|
9d94b1571a | ||
|
|
ff64f3a70f | ||
|
|
dc0bfd25c8 | ||
|
|
10ccbc0dc2 | ||
|
|
45e46b6826 | ||
|
|
7d20b9e9a2 | ||
|
|
086765090a | ||
|
|
1c49000ec2 | ||
|
|
e9261a1e19 | ||
|
|
796afbdf1d | ||
|
|
3dfe8d2829 | ||
|
|
77368f9908 | ||
|
|
2acad0fa01 | ||
|
|
e0ccb81014 | ||
|
|
93cedaaa41 | ||
|
|
d306bb4f36 | ||
|
|
4c66354c6a | ||
|
|
35ecb54a26 | ||
|
|
e2780ecbdf | ||
|
|
4e4cfb24d6 | ||
|
|
89307534df | ||
|
|
d0e126118d | ||
|
|
7e424691fd | ||
|
|
12fb0067d1 | ||
|
|
f0fd643ef0 | ||
|
|
cd48a580af | ||
|
|
a08ebed065 | ||
|
|
0784b9092d | ||
|
|
6954bb947e | ||
|
|
eafa053e21 | ||
|
|
90900b1589 | ||
|
|
40397e6aaa | ||
|
|
2196c5c70e | ||
|
|
c4d9f13380 | ||
|
|
27fbc15469 | ||
|
|
c96bb414fe | ||
|
|
d428d0ff03 | ||
|
|
d80216ff31 | ||
|
|
adcb4e74fa | ||
|
|
4df1555179 | ||
|
|
4bd78541fc | ||
|
|
2f2a4722f9 | ||
|
|
7ad235bba1 | ||
|
|
c7faaeff62 | ||
|
|
525bcc909f | ||
|
|
aecd605df9 | ||
|
|
f1eac4f309 | ||
|
|
562ab87771 | ||
|
|
26d7aeb401 | ||
|
|
3798ac5e09 | ||
|
|
a2ee74c700 | ||
|
|
1a3aaad591 | ||
|
|
4a5196a5cb | ||
|
|
207062cf1a | ||
|
|
d6291dbcb0 | ||
|
|
7b8737006c | ||
|
|
75818ebb0a | ||
|
|
37f26e0f1b | ||
|
|
3250fc2620 | ||
|
|
cf44358190 | ||
|
|
87a5685fec | ||
|
|
8b6c761812 | ||
|
|
21d86bf57a | ||
|
|
7d892fe298 | ||
|
|
0b16f3541d | ||
|
|
cd1947a445 | ||
|
|
1929e19647 | ||
|
|
31e3c4442f | ||
|
|
c1459377a1 | ||
|
|
2f30f37b7c | ||
|
|
b31924f316 | ||
|
|
efb10c477c | ||
|
|
7adfd7a589 | ||
|
|
87ec027cdb | ||
|
|
d171e28e49 | ||
|
|
9169502512 | ||
|
|
92d42ec297 | ||
|
|
e6457ac82e | ||
|
|
7eb85fc0c3 | ||
|
|
a97de38574 | ||
|
|
b426b66f9e | ||
|
|
d9d66fa6b4 | ||
|
|
ade2809a72 | ||
|
|
0c0f20a75d | ||
|
|
a8b531b08e | ||
|
|
40ce57ba37 | ||
|
|
3488dce7ad | ||
|
|
0af71b83cb | ||
|
|
39a92a56d1 | ||
|
|
e4943fe60a | ||
|
|
1d0c965ff0 | ||
|
|
6d5b5efafa | ||
|
|
665e7454bb | ||
|
|
63056b2d91 | ||
|
|
c995488e68 | ||
|
|
f4f7d7795e | ||
|
|
ddad227ae9 | ||
|
|
0af1308b7d | ||
|
|
e2afed1dc4 | ||
|
|
47de48806f | ||
|
|
7886066fd4 | ||
|
|
db27f0b8b7 | ||
|
|
1d28c83807 | ||
|
|
9f13b4ec5a | ||
|
|
133f8fd9f3 | ||
|
|
757e20c75c | ||
|
|
6b75914c91 | ||
|
|
ae6af8d777 | ||
|
|
770718ba95 | ||
|
|
da4a9f7088 | ||
|
|
bea62f6d3c | ||
|
|
ef960f945e | ||
|
|
9fd8ac426c | ||
|
|
a68a5e6c8b | ||
|
|
f78296c1b0 | ||
|
|
91a3b0d659 | ||
|
|
6fdba85d04 | ||
|
|
c0fd42d5c4 | ||
|
|
4095263c72 | ||
|
|
57558d7241 | ||
|
|
28b64b3819 | ||
|
|
08a0b5e186 | ||
|
|
7d8d34b15e | ||
|
|
d93a1d92f3 | ||
|
|
6a5b63c359 | ||
|
|
5d10c45501 | ||
|
|
28449b5dfd | ||
|
|
e1ea19b54d | ||
|
|
87a18b54ad | ||
|
|
1d36b669b0 | ||
|
|
0d67c6a3ca | ||
|
|
9e2919dc35 | ||
|
|
88219e7802 | ||
|
|
dee06ecf45 | ||
|
|
cc6e4d07b0 | ||
|
|
f824293c96 | ||
|
|
92e48f44dc | ||
|
|
02402eb5dc | ||
|
|
9e9e0d8f35 | ||
|
|
3a955ce107 | ||
|
|
1d22d64558 | ||
|
|
e59f29badf | ||
|
|
8cfb038a0c | ||
|
|
5ba48d965c | ||
|
|
d72a7c4bf8 | ||
|
|
fb20289a80 | ||
|
|
21df235fd5 | ||
|
|
e001e9eb0d | ||
|
|
7ebe575132 | ||
|
|
34951d1058 | ||
|
|
2ccb45bfcb | ||
|
|
0a7945806e | ||
|
|
e3fe8aff79 | ||
|
|
12fdc90536 | ||
|
|
870ee26b60 | ||
|
|
7b84624e81 | ||
|
|
43d7f918a5 | ||
|
|
78e61a7718 | ||
|
|
3e3e3db323 | ||
|
|
335073102e | ||
|
|
c749154fb3 | ||
|
|
752152fb56 | ||
|
|
cb2883646d | ||
|
|
bc6370ad8e | ||
|
|
15ceaa1dbb | ||
|
|
66dfd39757 | ||
|
|
b7b82da73f | ||
|
|
f95946a11b | ||
|
|
1609f189dd | ||
|
|
26de27fc85 | ||
|
|
41a3771efe | ||
|
|
d0ac69832f | ||
|
|
df6c2687af | ||
|
|
8783a619c9 | ||
|
|
573cc3fc47 | ||
|
|
4d1ac42057 | ||
|
|
12dc740f56 | ||
|
|
7b61f433a0 | ||
|
|
0e25a1e87b | ||
|
|
e9ff3b72e1 | ||
|
|
623ec17c29 | ||
|
|
cc1a665f7a | ||
|
|
f092846ece | ||
|
|
b547fef1b9 | ||
|
|
665bc9f8d1 | ||
|
|
c961921be8 | ||
|
|
3f65a92446 | ||
|
|
bfe82cc95d | ||
|
|
85ededc849 | ||
|
|
7efe37c35c | ||
|
|
d394a70f46 | ||
|
|
1db88e3343 | ||
|
|
b9e1e33dc8 | ||
|
|
8af80459a1 | ||
|
|
c2b46f77b7 | ||
|
|
5f5955d51b | ||
|
|
e29d632a78 | ||
|
|
b5845d3881 | ||
|
|
f75c42690b | ||
|
|
18f9ac498b | ||
|
|
865c71ab96 | ||
|
|
2d40e2d84b | ||
|
|
e7e160c8e1 | ||
|
|
a542c95433 | ||
|
|
83a3e0ca24 | ||
|
|
7eeb7c97d2 | ||
|
|
8629224f2f | ||
|
|
76866a46f0 | ||
|
|
3f96854d9a | ||
|
|
92001aadfe | ||
|
|
3473645798 | ||
|
|
47834ea34e | ||
|
|
1329a87a06 | ||
|
|
38217e7571 | ||
|
|
fff22ede33 | ||
|
|
ab3c395f2f | ||
|
|
4a4502a33c | ||
|
|
07b2dcbba0 | ||
|
|
c582d520b7 | ||
|
|
22fcff77c2 | ||
|
|
4b49ca9194 | ||
|
|
95a500f09d | ||
|
|
5f186e0bf2 | ||
|
|
64ac1b2188 | ||
|
|
e60f0b2cf7 | ||
|
|
aeb79cfe57 | ||
|
|
05e74503c5 | ||
|
|
ef34b4b3f1 | ||
|
|
dc22fc81e7 | ||
|
|
2ce73aefad | ||
|
|
a8b37fb5ba | ||
|
|
ee1d3dec38 | ||
|
|
dbdea53fc3 | ||
|
|
cc770cd61b | ||
|
|
5c3f71c2e4 | ||
|
|
6b61fa6136 | ||
|
|
5509a7b3ae | ||
|
|
9d24d7024f | ||
|
|
17405babae | ||
|
|
a61c636455 | ||
|
|
c17f6a3956 | ||
|
|
0042b12ad5 | ||
|
|
bbbf670ec9 | ||
|
|
986685169a | ||
|
|
4d160967bc | ||
|
|
0163c9b728 | ||
|
|
b6b7fa1021 | ||
|
|
6d9d5024a0 | ||
|
|
fbe9937782 | ||
|
|
6b60315036 | ||
|
|
64f15e77bc | ||
|
|
efc4fb9cb2 | ||
|
|
f1f0a0f1a5 | ||
|
|
7f696862ef | ||
|
|
4cf00c1a6b | ||
|
|
2908ffc1c8 | ||
|
|
761cd1f064 | ||
|
|
b2026ce74f | ||
|
|
ee565b22db | ||
|
|
ba34b851e4 | ||
|
|
aadfe8a6e8 | ||
|
|
736677fdc6 | ||
|
|
6870dbf711 | ||
|
|
679a112a2c | ||
|
|
391ca28f46 | ||
|
|
f3e897b6c5 |
@@ -180,3 +180,4 @@ plugins/frp
|
||||
plugins/file_search
|
||||
plugins/proxysql
|
||||
plugins/tidb
|
||||
plugins/gorse
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
- 吹水组 - https://t.me/mdserver_web
|
||||
- 交流论坛 - https://bbs.midoks.icu
|
||||
- discord - https://discord.gg/3zXk4mES
|
||||
|
||||
```
|
||||
如果出现问题,最好私给我面板信息。不要让我猜。如果不提供,不要提出问题,自行解决。 — 座右铭
|
||||
Talk is cheap, show me the code. -- linus
|
||||
@@ -42,7 +42,7 @@ Talk is cheap, show me the code. -- linus
|
||||
### 主要插件介绍
|
||||
|
||||
* OpenResty - 轻量级,占有内存少,并发能力强。
|
||||
* PHP[53-83] - PHP是世界上最好的编程语言。
|
||||
* PHP[53-84] - PHP是世界上最好的编程语言。
|
||||
* MySQL - 一种关系数据库管理系统。
|
||||
* MariaDB - 是MySQL的一个重要分支。
|
||||
* MySQL[APT/YUM] - 一种关系数据库管理系统。
|
||||
@@ -75,10 +75,10 @@ Talk is cheap, show me the code. -- linus
|
||||
|
||||
```
|
||||
phpMyAdmin[4.4.15]支持MySQL[5.5-5.7]
|
||||
phpMyAdmin[5.2.0]支持MySQL[8.0]
|
||||
phpMyAdmin[5.2.1]支持MySQL[8.0+]
|
||||
|
||||
PHP[53-72]支持phpMyAdmin[4.4.15]
|
||||
PHP[72-83]支持phpMyAdmin[5.2.0]
|
||||
PHP[72-84]支持phpMyAdmin[5.2.1]
|
||||
```
|
||||
|
||||
# 郑重声明
|
||||
@@ -110,9 +110,12 @@ docker run -itd --name mw-server --privileged=true -p 7200:7200 -p 80:80 -p 443:
|
||||
```
|
||||
|
||||
|
||||
### 版本更新 0.17.1
|
||||
### 版本更新 0.17.2
|
||||
|
||||
- 任务管理器-插件。
|
||||
- MySQL9.0。
|
||||
- zabbix,zabbix-agent测试。
|
||||
- 正则匹配修复(兼容)。
|
||||
- 常规更新。
|
||||
|
||||
### JSDelivr安装地址
|
||||
|
||||
|
||||
+9
-10
@@ -377,7 +377,7 @@ fi
|
||||
return response
|
||||
except Exception as ex:
|
||||
# self.getError()
|
||||
raise Exception("requestsPost: {}".format(self.getError(str(ex))))
|
||||
raise Exception("异常: {}".format(self.getError(str(ex))))
|
||||
|
||||
def getRequestJson(self, response):
|
||||
try:
|
||||
@@ -1279,7 +1279,7 @@ fullchain.pem 粘贴到证书输入框
|
||||
file = self.getHostConf(siteName)
|
||||
if os.path.exists(file):
|
||||
conf = mw.readFile(file)
|
||||
rep = '\s*root\s*(.+);'
|
||||
rep = r'\s*root\s*(.+);'
|
||||
path = re.search(rep, conf).groups()[0]
|
||||
return path
|
||||
return ''
|
||||
@@ -1391,7 +1391,8 @@ fullchain.pem 粘贴到证书输入框
|
||||
raise Exception("指定订单号不存在,无法续签!")
|
||||
order_index.append(index)
|
||||
else:
|
||||
start_time = time.time() + (30 * 86400)
|
||||
# 测试一天过期
|
||||
now_time = time.time()
|
||||
# print(self.__config)
|
||||
if not 'orders' in self.__config:
|
||||
self.__config['orders'] = {}
|
||||
@@ -1402,16 +1403,14 @@ fullchain.pem 粘贴到证书输入框
|
||||
continue
|
||||
|
||||
if 'cert' in self.__config['orders'][i]:
|
||||
self.__config['orders'][i]['cert_timeout'] = self.__config[
|
||||
'orders'][i]['cert']['cert_timeout']
|
||||
self.__config['orders'][i]['cert_timeout'] = self.__config['orders'][i]['cert']['cert_timeout']
|
||||
|
||||
if not 'cert_timeout' in self.__config['orders'][i]:
|
||||
self.__config['orders'][i][
|
||||
'cert_timeout'] = int(time.time())
|
||||
self.__config['orders'][i]['cert_timeout'] = int(time.time())
|
||||
|
||||
if self.__config['orders'][i]['cert_timeout'] > start_time:
|
||||
msg = "|-本次跳过域名: {},未过期!".format(
|
||||
self.__config['orders'][i]['domains'][0])
|
||||
# print(self.__config['orders'][i]['domains'][0], (self.__config['orders'][i]['cert_timeout'] - now_time)/86400, now_time)
|
||||
if self.__config['orders'][i]['cert_timeout'] - now_time > 83*86400:
|
||||
msg = "|-本次跳过域名: {},未过期!".format(self.__config['orders'][i]['domains'][0])
|
||||
writeLog(msg)
|
||||
continue
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ from flask import request
|
||||
|
||||
class config_api:
|
||||
|
||||
__version = '0.17.1'
|
||||
__version = '0.17.2'
|
||||
__api_addr = 'data/api.json'
|
||||
|
||||
# 统一默认配置文件
|
||||
|
||||
@@ -539,6 +539,10 @@ fi''' % (mw.getRunDir(),)
|
||||
head = head + start_head + source_bin_activate + "\n"
|
||||
log = '.log'
|
||||
|
||||
#所有
|
||||
if param['sname'] == 'ALL':
|
||||
log = ''
|
||||
|
||||
script_dir = mw.getRunDir() + "/scripts"
|
||||
source_stype = 'database'
|
||||
if stype.find('database_') > -1:
|
||||
@@ -575,7 +579,7 @@ fi''' % (mw.getRunDir(),)
|
||||
else:
|
||||
shell = head + param['sbody'].replace("\r\n", "\n")
|
||||
|
||||
shell += '''
|
||||
shell += '''
|
||||
echo "----------------------------------------------------------------------------"
|
||||
endDate=`date +"%Y-%m-%d %H:%M:%S"`
|
||||
END_MW_SHELL_TIME=`date +"%s"`
|
||||
|
||||
+2
-2
@@ -61,8 +61,8 @@ class Sql():
|
||||
self.__DB_FILE = 'data/' + name + '.db'
|
||||
return self
|
||||
|
||||
def dbPos(self, path, name):
|
||||
self.__DB_FILE = path + '/' + name + '.db'
|
||||
def dbPos(self, path, name, suffix_name = 'db'):
|
||||
self.__DB_FILE = path + '/' + name + '.' + suffix_name
|
||||
return self
|
||||
|
||||
def table(self, table):
|
||||
|
||||
+11
-11
@@ -50,7 +50,7 @@ class firewall_api:
|
||||
port = request.form.get('port', '').strip()
|
||||
ps = request.form.get('ps', '').strip()
|
||||
|
||||
rep = "^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(\/\d{1,2})?$"
|
||||
rep = r"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(\/\d{1,2})?$"
|
||||
if not re.search(rep, port):
|
||||
return mw.returnJson(False, '您输入的IP地址不合法!')
|
||||
address = port
|
||||
@@ -97,7 +97,7 @@ class firewall_api:
|
||||
if not self.getFwStatus():
|
||||
self.setFw(0)
|
||||
|
||||
rep = "^\d{1,5}(:\d{1,5})?$"
|
||||
rep = r"^\d{1,5}(:\d{1,5})?$"
|
||||
if not re.search(rep, port):
|
||||
return mw.returnData(False, '端口范围不正确!')
|
||||
|
||||
@@ -217,7 +217,7 @@ class firewall_api:
|
||||
|
||||
file = '/etc/ssh/sshd_config'
|
||||
conf = mw.readFile(file)
|
||||
rep = "#*Port\s+([0-9]+)\s*\n"
|
||||
rep = r"#*Port\s+([0-9]+)\s*\n"
|
||||
port = re.search(rep, conf).groups(0)[0]
|
||||
|
||||
isPing = True
|
||||
@@ -227,7 +227,7 @@ class firewall_api:
|
||||
else:
|
||||
file = '/etc/sysctl.conf'
|
||||
sys_conf = mw.readFile(file)
|
||||
rep = "#*net\.ipv4\.icmp_echo_ignore_all\s*=\s*([0-9]+)"
|
||||
rep = r"#*net\.ipv4\.icmp_echo_ignore_all\s*=\s*([0-9]+)"
|
||||
tmp = re.search(rep, sys_conf).groups(0)[0]
|
||||
if tmp == '1':
|
||||
isPing = False
|
||||
@@ -248,7 +248,7 @@ class firewall_api:
|
||||
|
||||
data['pass_prohibit_status'] = False
|
||||
# 密码登陆配置检查
|
||||
pass_rep = "PasswordAuthentication\s+(\w*)\s*\n"
|
||||
pass_rep = r"PasswordAuthentication\s+(\w*)\s*\n"
|
||||
pass_status = re.search(pass_rep, conf)
|
||||
if pass_status:
|
||||
if pass_status and pass_status.groups(0)[0].strip() == 'no':
|
||||
@@ -277,7 +277,7 @@ class firewall_api:
|
||||
file = '/etc/ssh/sshd_config'
|
||||
conf = mw.readFile(file)
|
||||
|
||||
rep = "#*Port\s+([0-9]+)\s*\n"
|
||||
rep = r"#*Port\s+([0-9]+)\s*\n"
|
||||
conf = re.sub(rep, "Port " + port + "\n", conf)
|
||||
mw.writeFile(file, conf)
|
||||
|
||||
@@ -330,17 +330,17 @@ class firewall_api:
|
||||
|
||||
conf = mw.readFile(file)
|
||||
|
||||
pass_rep = "PasswordAuthentication\s+(\w*)\s*\n"
|
||||
pass_rep = r"PasswordAuthentication\s+(\w*)\s*\n"
|
||||
pass_status = re.search(pass_rep, conf)
|
||||
if not pass_status:
|
||||
rep = "(#)?PasswordAuthentication\s+(\w*)\s*\n"
|
||||
rep = r"(#)?PasswordAuthentication\s+(\w*)\s*\n"
|
||||
conf = re.sub(rep, "PasswordAuthentication yes\n", conf)
|
||||
|
||||
if status == '1':
|
||||
rep = "PasswordAuthentication\s+(\w*)\s*\n"
|
||||
rep = r"PasswordAuthentication\s+(\w*)\s*\n"
|
||||
conf = re.sub(rep, "PasswordAuthentication yes\n", conf)
|
||||
else:
|
||||
rep = "PasswordAuthentication\s+(\w*)\s*\n"
|
||||
rep = r"PasswordAuthentication\s+(\w*)\s*\n"
|
||||
conf = re.sub(rep, "PasswordAuthentication no\n", conf)
|
||||
mw.writeFile(file, conf)
|
||||
mw.execShell("systemctl restart sshd.service")
|
||||
@@ -355,7 +355,7 @@ class firewall_api:
|
||||
filename = '/etc/sysctl.conf'
|
||||
conf = mw.readFile(filename)
|
||||
if conf.find('net.ipv4.icmp_echo') != -1:
|
||||
rep = u"net\.ipv4\.icmp_echo.*"
|
||||
rep = r"net\.ipv4\.icmp_echo.*"
|
||||
conf = re.sub(rep, 'net.ipv4.icmp_echo_ignore_all=' + status, conf)
|
||||
else:
|
||||
conf += "\nnet.ipv4.icmp_echo_ignore_all=" + status
|
||||
|
||||
@@ -124,10 +124,13 @@ class logs_api:
|
||||
if log_suffix[0] in ['gz', 'xz', 'bz2', 'asl']:
|
||||
continue
|
||||
|
||||
if log_file in ['.', '..', 'faillog', 'fontconfig.log', 'unattended-upgrades', 'tallylog']:
|
||||
if log_file in ['.', '..']:
|
||||
continue
|
||||
|
||||
filename = os.path.join(log_dir, log_file)
|
||||
if not os.path.exists(filename):
|
||||
continue
|
||||
|
||||
if os.path.isfile(filename):
|
||||
file_size = os.path.getsize(filename)
|
||||
if not file_size:
|
||||
|
||||
+20
-1
@@ -199,11 +199,27 @@ def getFileSuffix(file):
|
||||
return ext
|
||||
|
||||
|
||||
|
||||
def isAppleSystem():
|
||||
if getOs() == 'darwin':
|
||||
return True
|
||||
return False
|
||||
|
||||
def isDocker():
|
||||
return os.path.exists('/.dockerenv')
|
||||
|
||||
|
||||
def isSupportSystemctl():
|
||||
if isAppleSystem():
|
||||
return False
|
||||
if isDocker():
|
||||
return False
|
||||
|
||||
current_os = getOs()
|
||||
if current_os.startswith("freebsd"):
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def isDebugMode():
|
||||
if isAppleSystem():
|
||||
@@ -1289,7 +1305,10 @@ def getClientIp():
|
||||
def checkDomainPanel():
|
||||
tmp = getHost()
|
||||
domain = readFile('data/bind_domain.pl')
|
||||
port = readFile('data/port.pl').strip()
|
||||
|
||||
port = 7200
|
||||
if os.path.exists('data/port.pl'):
|
||||
port = readFile('data/port.pl').strip()
|
||||
|
||||
scheme = 'http'
|
||||
|
||||
|
||||
@@ -480,7 +480,7 @@ class plugins_api:
|
||||
plugin_path = mw.getPluginDir() + '/' + plugin_name
|
||||
if not os.path.exists(plugin_path):
|
||||
print(mw.execShell('mkdir -p ' + plugin_path))
|
||||
mw.execShell("\cp -rf " + tmp_path + '/* ' + plugin_path + '/')
|
||||
mw.execShell("cp -rf " + tmp_path + '/* ' + plugin_path + '/')
|
||||
mw.execShell('chmod -R 755 ' + plugin_path)
|
||||
p_info = mw.readFile(plugin_path + '/info.json')
|
||||
if p_info:
|
||||
@@ -1090,9 +1090,15 @@ class plugins_api:
|
||||
if not os.path.exists(package):
|
||||
return (False, "插件不存在!")
|
||||
|
||||
sys.path.append(package)
|
||||
if not package in sys.path:
|
||||
sys.path.append(package)
|
||||
eval_str = "__import__('" + script + "')." + func + '(' + args + ')'
|
||||
newRet = eval(eval_str)
|
||||
newRet = None
|
||||
try:
|
||||
newRet = eval(eval_str)
|
||||
except Exception as e:
|
||||
print(mw.getTracebackInfo())
|
||||
|
||||
if mw.isDebugMode():
|
||||
print('callback', eval_str)
|
||||
|
||||
|
||||
@@ -2533,7 +2533,9 @@ location ^~ {from} {\n\
|
||||
|
||||
def getPhpVersion(self):
|
||||
phpVersions = ('00', '52', '53', '54', '55',
|
||||
'56', '70', '71', '72', '73', '74', '80', '81', '82', '83')
|
||||
'56', '70', '71', '72', '73',
|
||||
'74', '80', '81', '82', '83',
|
||||
'84')
|
||||
data = []
|
||||
for val in phpVersions:
|
||||
tmp = {}
|
||||
@@ -2667,10 +2669,8 @@ location ^~ {from} {\n\
|
||||
return mw.returnJson(False, '不要以网站根目录创建站点!')
|
||||
|
||||
siteMenu = json.loads(webname)
|
||||
self.siteName = self.toPunycode(
|
||||
siteMenu['domain'].strip().split(':')[0]).strip()
|
||||
self.sitePath = self.toPunycodePath(
|
||||
self.getPath(path.replace(' ', '')))
|
||||
self.siteName = self.toPunycode(siteMenu['domain'].strip().split(':')[0]).strip()
|
||||
self.sitePath = self.toPunycodePath(self.getPath(path.replace(' ', '')))
|
||||
self.sitePort = port.strip().replace(' ', '')
|
||||
self.phpVersion = version
|
||||
|
||||
@@ -2802,7 +2802,7 @@ location ^~ {from} {\n\
|
||||
add_header Strict-Transport-Security "max-age=63072000";
|
||||
add_header Alt-Svc 'h3=":443";ma=86400';
|
||||
"""
|
||||
if version != '1.25.3.1':
|
||||
if not version.startswith('1.25'):
|
||||
http3Header = '';
|
||||
|
||||
sslStr = """#error_page 404/404.html;
|
||||
@@ -2820,12 +2820,12 @@ location ^~ {from} {\n\
|
||||
|
||||
conf = conf.replace('#error_page 404/404.html;', sslStr)
|
||||
|
||||
rep = "listen\s+([0-9]+)\s*[default_server]*;"
|
||||
rep = "listen\s+([0-9]+)\s*[default_server|reuseport]*;"
|
||||
tmp = re.findall(rep, conf)
|
||||
if not mw.inArray(tmp, '443'):
|
||||
listen = re.search(rep, conf).group()
|
||||
|
||||
if version == '1.25.3.1':
|
||||
if version.startswith('1.25'):
|
||||
http_ssl = "\n\tlisten 443 ssl;"
|
||||
http_ssl = http_ssl + "\n\tlisten [::]:443 ssl;"
|
||||
http_ssl = http_ssl + "\n\tlisten 443 quic;"
|
||||
|
||||
@@ -331,7 +331,7 @@ class ssh_terminal(object):
|
||||
|
||||
def getSshInfo(self, file):
|
||||
rdata = mw.readFile(file)
|
||||
destr = mw.enDoubleCrypt('mdserver-web', rdata)
|
||||
destr = mw.deDoubleCrypt('mdserver-web', rdata)
|
||||
return json.loads(destr)
|
||||
|
||||
def setAttr(self, sid, info):
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ class ORM:
|
||||
__DB_CHARSET = "utf8"
|
||||
|
||||
def __Conn(self):
|
||||
# print(self.__DB_HOST, self.__DB_USER)
|
||||
# print(self.__DB_HOST, self.__DB_USER, self.__DB_PASS, self.__DB_SOCKET)
|
||||
'''连接数据库'''
|
||||
try:
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ class FtpPSClient:
|
||||
default_backup_path = "/backup/"
|
||||
config_file = "cfg.json"
|
||||
|
||||
def __init__(self, load_config=True, timeout=10):
|
||||
def __init__(self, load_config=True, timeout=600):
|
||||
self.timeout = timeout
|
||||
if load_config:
|
||||
data = self.get_config()
|
||||
|
||||
@@ -173,6 +173,15 @@ def deleteFile():
|
||||
return mw.returnJson(True, "删除成功")
|
||||
return mw.returnJson(False, "删除失败")
|
||||
|
||||
def findPathName(path, filename):
|
||||
f = os.scandir(path)
|
||||
l = []
|
||||
for ff in f:
|
||||
t = {}
|
||||
if ff.name.find(filename) > -1:
|
||||
t['filename'] = path + '/' + ff.name
|
||||
l.append(t)
|
||||
return l
|
||||
|
||||
def backupAllFunc(stype):
|
||||
os.chdir(mw.getRunDir())
|
||||
@@ -202,6 +211,7 @@ def backupAllFunc(stype):
|
||||
backups = sql.table('backup').where(
|
||||
'type=? and pid=?', ('1', pid)).field('id,filename').select()
|
||||
if stype == 'path':
|
||||
backup_dir = mw.getBackupDir()
|
||||
backup_path = backup_dir + '/path'
|
||||
_name = 'path_{}'.format(os.path.basename(name))
|
||||
backups = findPathName(backup_path, _name)
|
||||
@@ -237,6 +247,10 @@ def backupAllFunc(stype):
|
||||
bk_name = stype
|
||||
|
||||
find_path = mw.getBackupDir() + '/' + bk_name + '/' + bk_prefix + '_' + name
|
||||
if stype == 'path':
|
||||
_name = 'path_{}'.format(os.path.basename(name))
|
||||
find_path = mw.getBackupDir() + '/path/'+_name
|
||||
|
||||
find_new_file = "ls " + find_path + \
|
||||
"_* | grep '.gz' | cut -d \ -f 1 | awk 'END {print}'"
|
||||
|
||||
@@ -245,7 +259,7 @@ def backupAllFunc(stype):
|
||||
mw.echoInfo("not find upload file!")
|
||||
return ''
|
||||
|
||||
print("|-准备上传文件 {}".format(filename))
|
||||
mw.echoInfo("准备上传文件 {}".format(filename))
|
||||
ftp = FtpPSClient()
|
||||
ftp.uploadFile(filename, stype)
|
||||
|
||||
@@ -259,7 +273,7 @@ def backupAllFunc(stype):
|
||||
fn = os.path.basename(backup['filename'])
|
||||
object_name = ftp.buildDirName(stype, fn)
|
||||
ftp.deleteFile(object_name)
|
||||
mw.echoInfo("---已清理远程过期备份文件:" + object_name)
|
||||
mw.echoInfo("已清理远程过期备份文件:" + object_name)
|
||||
sep -= 1
|
||||
if sep < 0:
|
||||
break
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<div class="bt-w-menu">
|
||||
<p class="bgw" onclick="pluginService('clean');">服务</p>
|
||||
<p onclick="pluginConfig('clean');">配置修改</p>
|
||||
<p onclick="commonFunc();">常用功能</p>
|
||||
<p onclick="pluginLogs('clean',null,'run_log');">运行日志</p>
|
||||
<p onclick="pRead()">说明</p>
|
||||
</div>
|
||||
@@ -12,8 +13,53 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
|
||||
pluginService('clean');
|
||||
|
||||
function cleanPost(method, version, args, callback){
|
||||
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
|
||||
|
||||
var req_data = {};
|
||||
req_data['name'] = 'clean';
|
||||
req_data['func'] = method;
|
||||
req_data['version'] = version;
|
||||
|
||||
if (typeof(args) == 'string'){
|
||||
req_data['args'] = JSON.stringify(toArrayObject(args));
|
||||
} else {
|
||||
req_data['args'] = JSON.stringify(args);
|
||||
}
|
||||
|
||||
$.post('/plugins/run', req_data, function(data) {
|
||||
layer.close(loadT);
|
||||
if (!data.status){
|
||||
layer.msg(data.msg,{icon:0,time:2000,shade: [10, '#000']});
|
||||
return;
|
||||
}
|
||||
|
||||
if(typeof(callback) == 'function'){
|
||||
callback(data);
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
|
||||
function cleanRun(){
|
||||
cleanPost('clean_run', '', {}, function(rdata){
|
||||
// var rdata = $.parseJSON(rdata.data);
|
||||
// layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
|
||||
});
|
||||
|
||||
layer.msg("执行成功!", { icon: 1});
|
||||
}
|
||||
|
||||
function commonFunc(){
|
||||
|
||||
con = '<hr/><p class="conf_p" style="text-align:center;">\
|
||||
<button class="btn btn-default btn-sm" onclick="cleanRun()">手动执行</button> \
|
||||
</p>';
|
||||
|
||||
$(".soft-man-con").html(con);
|
||||
}
|
||||
|
||||
function pRead(){
|
||||
var readme = '<ul class="help-info-text c7">';
|
||||
|
||||
+38
-1
@@ -74,7 +74,6 @@ def initConf():
|
||||
content = ""
|
||||
|
||||
clog = [
|
||||
"/var/spool/clientmqueue/*",
|
||||
"/var/log/cron-*",
|
||||
"/var/log/maillog-*",
|
||||
"/var/log/secure-*",
|
||||
@@ -82,9 +81,36 @@ def initConf():
|
||||
"/var/log/yum.log-*",
|
||||
"/var/log/messages-*",
|
||||
"/var/log/btmp-*",
|
||||
"/var/log/auth.*",
|
||||
"/var/log/messages.*",
|
||||
"/var/log/debug.*",
|
||||
"/var/log/syslog.*",
|
||||
"/var/log/btmp.*",
|
||||
"/var/log/sa/sa*",
|
||||
"/var/log/sysstat/sa*",
|
||||
"/var/log/atop/atop*",
|
||||
"/var/log/anaconda/*.log",
|
||||
|
||||
"/var/log/dpkg.log.*",
|
||||
"/var/log/alternatives.log.*",
|
||||
"/var/log/user.log.*",
|
||||
"/var/log/kern.log.*",
|
||||
"/var/log/daemon.log.*",
|
||||
|
||||
"/var/log/*.gz",
|
||||
"/var/log/*.xz",
|
||||
"/var/log/*.log.*",
|
||||
|
||||
"/var/log/audit/audit.log.*",
|
||||
"/var/log/hawkey.log-*",
|
||||
"/var/log/apt/*.gz",
|
||||
"/var/log/apt/*.xz",
|
||||
"/var/log/rhsm/rhsm.log-*",
|
||||
"/var/log/rhsm/rhsmcertd.log-*",
|
||||
"/var/log/exim4/*.gz",
|
||||
"/var/log/journal/*",
|
||||
"/var/spool/clientmqueue/*",
|
||||
|
||||
"/tmp/yum_save_*",
|
||||
"/tmp/tmp.*",
|
||||
]
|
||||
@@ -99,6 +125,7 @@ def initConf():
|
||||
"/var/log/secure",
|
||||
"/var/log/lastlog",
|
||||
"/var/log/cron",
|
||||
"/www/wwwlogs",
|
||||
"/www/server/rsyncd",
|
||||
"/www/server/sphinx/index",
|
||||
"/www/server/mongodb/logs",
|
||||
@@ -201,6 +228,13 @@ def cleanDirLog(path):
|
||||
cleanDirLog(abspath)
|
||||
|
||||
|
||||
def cleanRun():
|
||||
plugin_dir = getPluginDir()
|
||||
log_file = getServerDir()+'/clean.log'
|
||||
cmd = 'python3 '+plugin_dir+'/index.py clean > '+log_file
|
||||
os.system(cmd)
|
||||
return mw.returnJson(True, '执行成功!')
|
||||
|
||||
def cleanLog():
|
||||
conf = getConf()
|
||||
clist = mw.readFile(conf).strip()
|
||||
@@ -225,6 +259,7 @@ def cleanLog():
|
||||
cleanDirLog(abspath)
|
||||
continue
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
func = sys.argv[1]
|
||||
if func == 'status':
|
||||
@@ -243,5 +278,7 @@ if __name__ == "__main__":
|
||||
print(runLog())
|
||||
elif func == 'clean':
|
||||
cleanLog()
|
||||
elif func == 'clean_run':
|
||||
print(cleanRun())
|
||||
else:
|
||||
print('error')
|
||||
|
||||
@@ -115,7 +115,7 @@ def removeBgTask():
|
||||
data = api.delete(cfg["task_id"])
|
||||
if data[0]:
|
||||
cfg["task_id"] = -1
|
||||
mw.writeFile(getTaskConf(), json.loads(cfg))
|
||||
mw.writeFile(getTaskConf(), json.dumps(cfg))
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
@@ -17,6 +17,27 @@ if [ -f ${rootPath}/bin/activate ];then
|
||||
source ${rootPath}/bin/activate
|
||||
fi
|
||||
|
||||
# {
|
||||
# "registry-mirrors": [
|
||||
# "http://hub-mirror.c.163.com",
|
||||
# "https://docker.mirrors.ustc.edu.cn",
|
||||
# "https://registry.docker-cn.com"
|
||||
# ]
|
||||
# }
|
||||
|
||||
# sudo mkdir -p /etc/docker
|
||||
# sudo tee /etc/docker/daemon.json <<-'EOF'
|
||||
# {
|
||||
# "registry-mirrors": [
|
||||
# "http://hub-mirror.c.163.com",
|
||||
# "https://docker.mirrors.ustc.edu.cn",
|
||||
# "https://registry.docker-cn.com"
|
||||
# ]
|
||||
# }
|
||||
# EOF
|
||||
# sudo systemctl daemon-reload
|
||||
# sudo systemctl restart docker
|
||||
|
||||
Install_Docker()
|
||||
{
|
||||
# which docker
|
||||
|
||||
@@ -9,3 +9,14 @@ serverPath=$(dirname "$rootPath")
|
||||
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
SYS_ARCH=`arch`
|
||||
|
||||
# export GOPROXY=https://goproxy.io
|
||||
# export GO111MODULE=on
|
||||
|
||||
|
||||
apt -y install build-essential git make libelf-dev strace tar bpfcc-tools libbpf-dev
|
||||
|
||||
# clang -v
|
||||
apt -y install clang llvm
|
||||
|
||||
apt -y install golang
|
||||
|
||||
@@ -170,12 +170,12 @@ def initDreplace():
|
||||
|
||||
def getRootUrl():
|
||||
content = mw.readFile(getConf())
|
||||
rep = 'ROOT_URL\s*=\s*(.*)'
|
||||
rep = r'ROOT_URL\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
if tmp:
|
||||
return tmp.groups()[0]
|
||||
|
||||
rep = 'EXTERNAL_URL\s*=\s*(.*)'
|
||||
rep = r'EXTERNAL_URL\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
if tmp:
|
||||
return tmp.groups()[0]
|
||||
@@ -184,7 +184,7 @@ def getRootUrl():
|
||||
|
||||
def getSshPort():
|
||||
content = mw.readFile(getConf())
|
||||
rep = 'SSH_PORT\s*=\s*(.*)'
|
||||
rep = r'SSH_PORT\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
if not tmp:
|
||||
return ''
|
||||
@@ -193,7 +193,7 @@ def getSshPort():
|
||||
|
||||
def getHttpPort():
|
||||
content = mw.readFile(getConf())
|
||||
rep = 'HTTP_PORT\s*=\s*(.*)'
|
||||
rep = r'HTTP_PORT\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
if not tmp:
|
||||
return ''
|
||||
@@ -202,7 +202,7 @@ def getHttpPort():
|
||||
|
||||
def getRootPath():
|
||||
content = mw.readFile(getConf())
|
||||
rep = 'ROOT\s*=\s*(.*)'
|
||||
rep = r'ROOT\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
if not tmp:
|
||||
return ''
|
||||
@@ -215,7 +215,7 @@ def getDbConfValue():
|
||||
return {}
|
||||
|
||||
content = mw.readFile(conf)
|
||||
rep_scope = "\[database\](.*?)\["
|
||||
rep_scope = r"\[database\](.*?)\["
|
||||
tmp = re.findall(rep_scope, content, re.S)
|
||||
|
||||
rep = '(\w*)\s*=\s*(.*)'
|
||||
|
||||
@@ -173,12 +173,12 @@ def initDreplace():
|
||||
|
||||
def getRootUrl():
|
||||
content = mw.readFile(getConf())
|
||||
rep = 'ROOT_URL\s*=\s*(.*)'
|
||||
rep = r'ROOT_URL\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
if tmp:
|
||||
return tmp.groups()[0]
|
||||
|
||||
rep = 'EXTERNAL_URL\s*=\s*(.*)'
|
||||
rep = r'EXTERNAL_URL\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
if tmp:
|
||||
return tmp.groups()[0]
|
||||
@@ -187,7 +187,7 @@ def getRootUrl():
|
||||
|
||||
def getSshPort():
|
||||
content = mw.readFile(getConf())
|
||||
rep = 'SSH_PORT\s*=\s*(.*)'
|
||||
rep = r'SSH_PORT\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
if not tmp:
|
||||
return ''
|
||||
@@ -196,7 +196,7 @@ def getSshPort():
|
||||
|
||||
def getHttpPort():
|
||||
content = mw.readFile(getConf())
|
||||
rep = 'HTTP_PORT\s*=\s*(.*)'
|
||||
rep = r'HTTP_PORT\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
if not tmp:
|
||||
return ''
|
||||
@@ -205,7 +205,7 @@ def getHttpPort():
|
||||
|
||||
def getRootPath():
|
||||
content = mw.readFile(getConf())
|
||||
rep = 'ROOT\s*=\s*(.*)'
|
||||
rep = r'ROOT\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
if not tmp:
|
||||
return ''
|
||||
@@ -218,10 +218,10 @@ def getDbConfValue():
|
||||
return {}
|
||||
|
||||
content = mw.readFile(conf)
|
||||
rep_scope = "\[database\](.*?)\["
|
||||
rep_scope = r"\[database\](.*?)\["
|
||||
tmp = re.findall(rep_scope, content, re.S)
|
||||
|
||||
rep = '(\w*)\s*=\s*(.*)'
|
||||
rep = r'(\w*)\s*=\s*(.*)'
|
||||
tmp = re.findall(rep, tmp[0])
|
||||
r = {}
|
||||
for x in range(len(tmp)):
|
||||
|
||||
@@ -253,7 +253,7 @@ def getPort():
|
||||
conf = getServerDir() + '/keepalived.conf'
|
||||
content = mw.readFile(conf)
|
||||
|
||||
rep = "^(" + 'port' + ')\s*([.0-9A-Za-z_& ~]+)'
|
||||
rep = r"^(" + 'port' + r')\s*([.0-9A-Za-z_& ~]+)'
|
||||
tmp = re.search(rep, content, re.M)
|
||||
if tmp:
|
||||
return tmp.groups()[1]
|
||||
|
||||
@@ -50,6 +50,7 @@ CREATE TABLE IF NOT EXISTS `slave_sync_user` (
|
||||
`pass` TEXT,
|
||||
`mode` TEXT,
|
||||
`cmd` TEXT,
|
||||
`db` TEXT,
|
||||
`addtime` TEXT
|
||||
);
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ max_connections = 500
|
||||
max_connect_errors = 100
|
||||
open_files_limit = 65535
|
||||
|
||||
skip-name-resolve = on
|
||||
skip-name-resolve = 1
|
||||
#skip-networking
|
||||
#skip-external-locking
|
||||
#loose-skip-innodb
|
||||
|
||||
+177
-26
@@ -86,21 +86,21 @@ def getConf():
|
||||
def getDataDir():
|
||||
file = getConf()
|
||||
content = mw.readFile(file)
|
||||
rep = 'datadir\s*=\s*(.*)'
|
||||
rep = r'datadir\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
def getLogBinName():
|
||||
file = getConf()
|
||||
content = mw.readFile(file)
|
||||
rep = 'log-bin\s*=\s*(.*)'
|
||||
rep = r'log-bin\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
def getPidFile():
|
||||
file = getConf()
|
||||
content = mw.readFile(file)
|
||||
rep = 'pid-file\s*=\s*(.*)'
|
||||
rep = r'pid-file\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
@@ -108,7 +108,7 @@ def getPidFile():
|
||||
def getDbPort():
|
||||
file = getConf()
|
||||
content = mw.readFile(file)
|
||||
rep = 'port\s*=\s*(.*)'
|
||||
rep = r'port\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
@@ -116,7 +116,7 @@ def getDbPort():
|
||||
def getDbServerId():
|
||||
file = getConf()
|
||||
content = mw.readFile(file)
|
||||
rep = 'server-id\s*=\s*(.*)'
|
||||
rep = r'server-id\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
@@ -124,7 +124,7 @@ def getDbServerId():
|
||||
def getSocketFile():
|
||||
file = getConf()
|
||||
content = mw.readFile(file)
|
||||
rep = 'socket\s*=\s*(.*)'
|
||||
rep = r'socket\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
@@ -378,7 +378,7 @@ def getErrorLog():
|
||||
def getShowLogFile():
|
||||
file = getConf()
|
||||
content = mw.readFile(file)
|
||||
rep = 'slow-query-log-file\s*=\s*(.*)'
|
||||
rep = r'slow-query-log-file\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
@@ -547,7 +547,7 @@ def initdUinstall():
|
||||
def getMyDbPos():
|
||||
file = getConf()
|
||||
content = mw.readFile(file)
|
||||
rep = 'datadir\s*=\s*(.*)'
|
||||
rep = r'datadir\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
@@ -597,7 +597,7 @@ def setMyDbPos():
|
||||
def getMyPort():
|
||||
file = getConf()
|
||||
content = mw.readFile(file)
|
||||
rep = 'port\s*=\s*(.*)'
|
||||
rep = r'port\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
@@ -611,7 +611,7 @@ def setMyPort():
|
||||
port = args['port']
|
||||
file = getConf()
|
||||
content = mw.readFile(file)
|
||||
rep = "port\s*=\s*([0-9]+)\s*\n"
|
||||
rep = r"port\s*=\s*([0-9]+)\s*\n"
|
||||
content = re.sub(rep, 'port = ' + port + '\n', content)
|
||||
mw.writeFile(file, content)
|
||||
restart()
|
||||
@@ -688,7 +688,7 @@ def setDbStatus():
|
||||
s = 'K'
|
||||
if g in emptys:
|
||||
s = ''
|
||||
rep = '\s*' + g + '\s*=\s*\d+(M|K|k|m|G)?\n'
|
||||
rep = r'\s*' + g + r'\s*=\s*\d+(M|K|k|m|G)?\n'
|
||||
c = g + ' = ' + args[g] + s + '\n'
|
||||
if content.find(g) != -1:
|
||||
content = re.sub(rep, '\n' + c, content, 1)
|
||||
@@ -867,6 +867,81 @@ def importDbExternal():
|
||||
|
||||
return mw.returnJson(True, 'ok')
|
||||
|
||||
def importDbExternalProgress():
|
||||
args = getArgs()
|
||||
data = checkArgs(args, ['file', 'name'])
|
||||
if not data[0]:
|
||||
return data[1]
|
||||
|
||||
file = args['file']
|
||||
name = args['name']
|
||||
|
||||
cmd = 'cd '+mw.getServerDir()+'/mdserver-web && source bin/activate && '
|
||||
cmd += 'python3 '+mw.getServerDir()+'/mdserver-web/plugins/mariadb/index.py import_db_external_progress_bar {"file":"'+file+'","name":"'+name+'"}'
|
||||
return mw.returnJson(True, 'ok',cmd)
|
||||
|
||||
def importDbExternalProgressBar():
|
||||
args = getArgs()
|
||||
data = checkArgs(args, ['file', 'name'])
|
||||
if not data[0]:
|
||||
return data[1]
|
||||
|
||||
file = args['file']
|
||||
name = args['name']
|
||||
|
||||
import_dir = mw.getRootDir() + '/backup/import/'
|
||||
|
||||
file_path = import_dir + file
|
||||
if not os.path.exists(file_path):
|
||||
return mw.returnJson(False, '文件突然消失?')
|
||||
|
||||
exts = ['sql', 'gz', 'zip']
|
||||
ext = mw.getFileSuffix(file)
|
||||
if ext not in exts:
|
||||
return mw.returnJson(False, '导入数据库格式不对!')
|
||||
|
||||
tmp = file.split('/')
|
||||
tmpFile = tmp[len(tmp) - 1]
|
||||
tmpFile = tmpFile.replace('.sql.' + ext, '.sql')
|
||||
tmpFile = tmpFile.replace('.' + ext, '.sql')
|
||||
tmpFile = tmpFile.replace('tar.', '')
|
||||
|
||||
# print(tmpFile)
|
||||
import_sql = ""
|
||||
if file.find("sql.gz") > -1:
|
||||
cmd = 'cd ' + import_dir + ' && gzip -dc ' + \
|
||||
file + " > " + import_dir + tmpFile
|
||||
info = mw.execShell(cmd)
|
||||
if info[1] == "":
|
||||
import_sql = import_dir + tmpFile
|
||||
|
||||
if file.find(".zip") > -1:
|
||||
cmd = 'cd ' + import_dir + ' && unzip -o ' + file
|
||||
mw.execShell(cmd)
|
||||
import_sql = import_dir + tmpFile
|
||||
|
||||
if file.find("tar.gz") > -1:
|
||||
cmd = 'cd ' + import_dir + ' && tar -zxvf ' + file
|
||||
mw.execShell(cmd)
|
||||
import_sql = import_dir + tmpFile
|
||||
|
||||
if file.find(".sql") > -1 and file.find(".sql.gz") == -1:
|
||||
import_sql = import_dir + file
|
||||
|
||||
if import_sql == "":
|
||||
return mw.returnJson(False, '未找SQL文件')
|
||||
|
||||
pwd = pSqliteDb('config').where('id=?', (1,)).getField('mysql_root')
|
||||
sock = getSocketFile()
|
||||
|
||||
my_cnf = getConf()
|
||||
mysql_cmd = getServerDir() + '/bin/mariadb --defaults-file=' + my_cnf + \
|
||||
' -uroot -p"' + pwd + '" -f ' + name
|
||||
mysql_cmd_progress_bar = "pv -t -p " + import_sql + '|'+ mysql_cmd
|
||||
print(mysql_cmd_progress_bar)
|
||||
rdata = os.system(mysql_cmd_progress_bar)
|
||||
return ""
|
||||
|
||||
|
||||
def deleteDbBackup():
|
||||
args = getArgs()
|
||||
@@ -1205,7 +1280,7 @@ def addDb():
|
||||
dataAccess = args['dataAccess'].strip()
|
||||
ps = args['ps'].strip()
|
||||
|
||||
reg = "^[\w\.-]+$"
|
||||
reg = r"^[\w\.-]+$"
|
||||
if not re.match(reg, args['name']):
|
||||
return mw.returnJson(False, '数据库名称不能带有特殊符号!')
|
||||
checks = ['root', 'mysql', 'test', 'sys', 'panel_logs']
|
||||
@@ -1771,8 +1846,7 @@ def setDbMaster(version):
|
||||
|
||||
if not isHas:
|
||||
prefix = '#binlog-do-db'
|
||||
con = con.replace(
|
||||
prefix, prefix + "\nbinlog-do-db=" + args['name'])
|
||||
con = con.replace(prefix, prefix + "\nbinlog-do-db=" + args['name'])
|
||||
mw.writeFile(conf, con)
|
||||
|
||||
restart(version)
|
||||
@@ -1801,8 +1875,7 @@ def setDbSlave(version):
|
||||
|
||||
if not isHas:
|
||||
prefix = '#replicate-do-db'
|
||||
con = con.replace(
|
||||
prefix, prefix + "\nreplicate-do-db=" + args['name'])
|
||||
con = con.replace(prefix, prefix + "\nreplicate-do-db=" + args['name'])
|
||||
mw.writeFile(conf, con)
|
||||
|
||||
restart(version)
|
||||
@@ -1922,7 +1995,7 @@ def addMasterRepSlaveUser(version=''):
|
||||
# address = args['address'].strip()
|
||||
# dataAccess = args['dataAccess'].strip()
|
||||
|
||||
reg = "^[\w-]+$"
|
||||
reg = r"^[\w-]+$"
|
||||
if not re.match(reg, username):
|
||||
return mw.returnJson(False, '用户名不能带有特殊符号!')
|
||||
checks = ['root', 'mysql', 'test', 'sys', 'panel_logs']
|
||||
@@ -1958,6 +2031,64 @@ def addMasterRepSlaveUser(version=''):
|
||||
return mw.returnJson(True, '添加成功!')
|
||||
|
||||
|
||||
def getMasterRepSlaveUserCmdSsh(version):
|
||||
|
||||
args = getArgs()
|
||||
data = checkArgs(args, ['username', 'db'])
|
||||
if not data[0]:
|
||||
return data[1]
|
||||
|
||||
psdb = pSqliteDb('master_replication_user')
|
||||
f = 'username,password'
|
||||
username = args['username']
|
||||
if username == '':
|
||||
count = psdb.count()
|
||||
if count == 0:
|
||||
return mw.returnJson(False, '请添加同步账户!')
|
||||
|
||||
clist = psdb.field(f).limit('1').order('id desc').select()
|
||||
else:
|
||||
clist = psdb.field(f).where("username=?", (username,)).limit(
|
||||
'1').order('id desc').select()
|
||||
|
||||
if len(clist) == 0:
|
||||
return mw.returnJson(False, '错误同步账户!')
|
||||
|
||||
ip = mw.getLocalIp()
|
||||
port = getMyPort()
|
||||
db = pMysqlDb()
|
||||
|
||||
mstatus = db.query('show master status')
|
||||
if len(mstatus) == 0:
|
||||
return mw.returnJson(False, '未开启!')
|
||||
|
||||
mode = recognizeDbMode()
|
||||
|
||||
# 查找同步点
|
||||
# SELECT BINLOG_GTID_POS('master1-bin.000002', 561866201);
|
||||
|
||||
sid = getDbServerId()
|
||||
connection_name = ""
|
||||
if sid != '':
|
||||
connection_name = "'r{}' ".format(sid)
|
||||
|
||||
# MASTER_USE_GTID={current_pos|slave_pos|no}
|
||||
# current_pos 依赖-> select @@global.gtid_current_pos;
|
||||
# slave_pos 依赖-> select @@global.gtid_slave_pos;
|
||||
# no -> 啥都不依赖,保证多主同步成功。同步出现问题,根据日志查找问题。
|
||||
|
||||
base_sql = "CHANGE MASTER " + connection_name + "TO MASTER_HOST='" + ip + "', MASTER_PORT=" + port + ", MASTER_USER='" + \
|
||||
clist[0]['username'] + "', MASTER_PASSWORD='" + \
|
||||
clist[0]['password'];
|
||||
sql = ''
|
||||
sql += base_sql + "', MASTER_LOG_FILE='" + mstatus[0]["File"] + \
|
||||
"',MASTER_LOG_POS=" + str(mstatus[0]["Position"])
|
||||
data = {}
|
||||
data['cmd'] = sql
|
||||
data["info"] = clist[0]
|
||||
data['mode'] = mode
|
||||
return mw.returnJson(True, 'ok!', data)
|
||||
|
||||
def getMasterRepSlaveUserCmd(version):
|
||||
|
||||
args = getArgs()
|
||||
@@ -2004,16 +2135,15 @@ def getMasterRepSlaveUserCmd(version):
|
||||
# slave_pos 依赖-> select @@global.gtid_slave_pos;
|
||||
# no -> 啥都不依赖,保证多主同步成功。同步出现问题,根据日志查找问题。
|
||||
|
||||
if mode == "gtid":
|
||||
sql = "CHANGE MASTER " + connection_name + "TO MASTER_HOST='" + ip + "', MASTER_PORT=" + port + ", MASTER_USER='" + \
|
||||
clist[0]['username'] + "', MASTER_PASSWORD='" + \
|
||||
clist[0]['password'] + "',MASTER_USE_GTID=no,MASTER_CONNECT_RETRY=10;"
|
||||
else:
|
||||
sql = "CHANGE MASTER " + connection_name + "TO MASTER_HOST='" + ip + "', MASTER_PORT=" + port + ", MASTER_USER='" + \
|
||||
base_sql = "CHANGE MASTER " + connection_name + "TO MASTER_HOST='" + ip + "', MASTER_PORT=" + port + ", MASTER_USER='" + \
|
||||
clist[0]['username'] + "', MASTER_PASSWORD='" + \
|
||||
clist[0]['password'] + \
|
||||
"', MASTER_LOG_FILE='" + mstatus[0]["File"] + \
|
||||
clist[0]['password'];
|
||||
sql = ''
|
||||
sql += base_sql + "', MASTER_LOG_FILE='" + mstatus[0]["File"] + \
|
||||
"',MASTER_LOG_POS=" + str(mstatus[0]["Position"])
|
||||
sql += "<br/><hr/>";
|
||||
sql += base_sql + "',MASTER_USE_GTID=slave_pos,MASTER_CONNECT_RETRY=10;";
|
||||
sql += "<br/>";
|
||||
|
||||
data = {}
|
||||
data['cmd'] = sql
|
||||
@@ -2469,7 +2599,7 @@ def initSlaveStatusSSH(version=''):
|
||||
username='root', pkey=key)
|
||||
|
||||
db_user = data['db_user']
|
||||
cmd = 'cd /www/server/mdserver-web && source bin/activate && python3 plugins/mariadb/index.py get_master_rep_slave_user_cmd {"username":"' + db_user + '","db":""}'
|
||||
cmd = 'cd /www/server/mdserver-web && source bin/activate && python3 plugins/mariadb/index.py get_master_rep_slave_user_cmd_ssh {"username":"' + db_user + '","db":""}'
|
||||
stdin, stdout, stderr = ssh.exec_command(cmd)
|
||||
result = stdout.read()
|
||||
result = result.decode('utf-8')
|
||||
@@ -2920,6 +3050,19 @@ def fullSync(version=''):
|
||||
return json.dumps({'code': 0, 'msg': '点击开始,开始同步!', 'progress': 0})
|
||||
|
||||
|
||||
def fullSyncCmd():
|
||||
time_all_s = time.time()
|
||||
args = getArgs()
|
||||
data = checkArgs(args, ['db', 'sign'])
|
||||
if not data[0]:
|
||||
return data[1]
|
||||
|
||||
db = args['db']
|
||||
sign = args['sign']
|
||||
|
||||
cmd = 'cd '+mw.getServerDir()+'/mdserver-web && source bin/activate && python3 plugins/mariadb/index.py do_full_sync {"db":"'+db+'","sign":"'+sign+'"}'
|
||||
return mw.returnJson(True,'ok',cmd)
|
||||
|
||||
# python3 plugins/mariadb/index.py do_full_sync {"db":"demo1","sign":"","beigin":"1"}
|
||||
def doFullSync(version=''):
|
||||
mode_file = getSyncModeFile()
|
||||
@@ -3258,6 +3401,10 @@ if __name__ == "__main__":
|
||||
print(importDbBackup())
|
||||
elif func == 'import_db_external':
|
||||
print(importDbExternal())
|
||||
elif func == 'import_db_external_progress':
|
||||
print(importDbExternalProgress())
|
||||
elif func == 'import_db_external_progress_bar':
|
||||
print(importDbExternalProgressBar())
|
||||
elif func == 'delete_db_backup':
|
||||
print(deleteDbBackup())
|
||||
elif func == 'get_db_backup_list':
|
||||
@@ -3322,6 +3469,8 @@ if __name__ == "__main__":
|
||||
print(delMasterRepSlaveUser(version))
|
||||
elif func == 'update_master_rep_slave_user':
|
||||
print(updateMasterRepSlaveUser(version))
|
||||
elif func == 'get_master_rep_slave_user_cmd_ssh':
|
||||
print(getMasterRepSlaveUserCmdSsh(version))
|
||||
elif func == 'get_master_rep_slave_user_cmd':
|
||||
print(getMasterRepSlaveUserCmd(version))
|
||||
elif func == 'get_slave_list':
|
||||
@@ -3362,6 +3511,8 @@ if __name__ == "__main__":
|
||||
print(fullSync(version))
|
||||
elif func == 'do_full_sync':
|
||||
print(doFullSync(version))
|
||||
elif func == 'full_sync_cmd':
|
||||
print(fullSyncCmd())
|
||||
elif func == 'dump_mysql_data':
|
||||
print(dumpMysqlData(version))
|
||||
elif func == 'sync_database_repair':
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"uninstall_pre_inspection":true,
|
||||
"checks": "server/mariadb",
|
||||
"path": "server/mariadb",
|
||||
"versions":["10.6","10.7","10.8","10.9","10.11","11.0","11.1","11.2","11.3"],
|
||||
"versions":["10.6","10.7","10.8","10.9","10.11","11.0","11.1","11.2","11.3","11.4"],
|
||||
"shell":"install.sh",
|
||||
"checks":"server/mariadb",
|
||||
"path":"server/mariadb",
|
||||
|
||||
@@ -20,13 +20,21 @@ install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
action=$1
|
||||
type=$2
|
||||
|
||||
if id mysql &> /dev/null ;then
|
||||
echo "mysql UID is `id -u mysql`"
|
||||
echo "mysql Shell is `grep "^mysql:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd mysql
|
||||
useradd -g mysql -s /usr/sbin/nologin mysql
|
||||
fi
|
||||
|
||||
if [ "${2}" == "" ];then
|
||||
echo '缺少安装脚本...' > $install_tmp
|
||||
echo '缺少安装脚本...'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ ! -d $curPath/versions/$2 ];then
|
||||
echo '缺少安装脚本2...' > $install_tmp
|
||||
echo '缺少安装脚本2...'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
@@ -938,6 +938,31 @@ function importDbExternal(file,name){
|
||||
});
|
||||
}
|
||||
|
||||
function importDbExternalProgress(file,name){
|
||||
myPost('import_db_external_progress',{file:file,name:name}, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
layer.open({
|
||||
title: "手动导入命令CMD【显示进度】",
|
||||
area: ['600px', '180px'],
|
||||
type:1,
|
||||
closeBtn: 1,
|
||||
shadeClose: false,
|
||||
btn:["复制","取消"],
|
||||
content: '<div class="pd15">\
|
||||
<div class="divtable">\
|
||||
<pre class="layui-code">'+rdata.data+'</pre>\
|
||||
</div>\
|
||||
</div>',
|
||||
success:function(){
|
||||
copyText(rdata.data);
|
||||
},
|
||||
yes:function(){
|
||||
copyText(rdata.data);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function setLocalImport(db_name){
|
||||
|
||||
//上传文件
|
||||
@@ -993,6 +1018,7 @@ function setLocalImport(db_name){
|
||||
<td><span> ' + file_list[i]['time'] + '</span></td>\
|
||||
<td style="text-align: right;">\
|
||||
<a class="btlink" onclick="importDbExternal(\'' + file_list[i]['name'] + '\',\'' +db_name+ '\')">导入</a> | \
|
||||
<a class="btlink" onclick="importDbExternalProgress(\'' + file_list[i]['name'] + '\',\'' +db_name+ '\')">导入进度</a> | \
|
||||
<a class="btlink del" index="'+i+'">删除</a>\
|
||||
</td>\
|
||||
</tr>';
|
||||
@@ -1016,7 +1042,7 @@ function setLocalImport(db_name){
|
||||
var layerIndex = layer.open({
|
||||
type: 1,
|
||||
title: "从文件导入数据",
|
||||
area: ['600px', '380px'],
|
||||
area: ['700px', '380px'],
|
||||
closeBtn: 1,
|
||||
shadeClose: false,
|
||||
content: '<div class="pd15">\
|
||||
@@ -1655,7 +1681,7 @@ function addMasterRepSlaveUser(){
|
||||
|
||||
|
||||
|
||||
function updateMasterRepSlaveUser(username){
|
||||
function updateMasterRepSlaveUser(username, password){
|
||||
|
||||
var index = layer.open({
|
||||
type: 1,
|
||||
@@ -1668,7 +1694,7 @@ function updateMasterRepSlaveUser(username){
|
||||
<div class='line'><span class='tname'>用户名</span><div class='info-r'><input name='username' readonly='readonly' class='bt-input-text mr5' placeholder='用户名' type='text' style='width:330px;' value='"+username+"'></div></div>\
|
||||
<div class='line'>\
|
||||
<span class='tname'>密码</span>\
|
||||
<div class='info-r'><input class='bt-input-text mr5' type='text' name='password' id='MyPassword' style='width:330px' value='"+(randomStrPwd(16))+"' /><span title='随机密码' class='glyphicon glyphicon-repeat cursor' onclick='repeatPwd(16)'></span></div>\
|
||||
<div class='info-r'><input class='bt-input-text mr5' type='text' name='password' id='MyPassword' style='width:330px' value='"+password+"' /><span title='随机密码' class='glyphicon glyphicon-repeat cursor' onclick='repeatPwd(16)'></span></div>\
|
||||
</div>\
|
||||
<input type='hidden' name='ps' value='' />\
|
||||
<div class='bt-form-submit-btn'>\
|
||||
@@ -1710,17 +1736,12 @@ function getMasterRepSlaveUserCmd(username, db=''){
|
||||
area: '500px',
|
||||
content:"<form class='bt-form pd20 pb70' id='add_master'>\
|
||||
<div class='line' style='word-wrap: break-word;word-break: normal;'>"+cmd+"</div>\
|
||||
<div class='bt-form-submit-btn'>\
|
||||
<button type='button' class='btn btn-success btn-sm btn-title class-copy-cmd'>复制</button>\
|
||||
<div class='bt-form-submit-btn' style='text-align:center;'>\
|
||||
<button type='button' class='btn btn-success btn-sm btn-title'>选择其中一个复制</button>\
|
||||
</div>\
|
||||
</form>",
|
||||
});
|
||||
|
||||
|
||||
copyPass(cmd);
|
||||
$('.class-copy-cmd').click(function(){
|
||||
copyPass(cmd);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1844,10 +1865,11 @@ function getMasterRepSlaveList(){
|
||||
for (i in user_list) {
|
||||
// console.log(i);
|
||||
var name = user_list[i]['username'];
|
||||
var password = user_list[i]['password'];
|
||||
list += '<tr><td>'+name+'</td>\
|
||||
<td>'+user_list[i]['password']+'</td>\
|
||||
<td>'+password+'</td>\
|
||||
<td>\
|
||||
<a class="btlink" onclick="updateMasterRepSlaveUser(\''+name+'\');">修改</a> | \
|
||||
<a class="btlink" onclick="updateMasterRepSlaveUser(\''+name+'\',\''+password+'\');">修改</a> | \
|
||||
<a class="btlink" onclick="delMasterRepSlaveUser(\''+name+'\');">删除</a> | \
|
||||
<a class="btlink" onclick="setDbMasterAccess(\''+name+'\');">权限</a> | \
|
||||
<a class="btlink" onclick="getMasterRepSlaveUserCmd(\''+name+'\');">从库同步命令</a>\
|
||||
@@ -1935,6 +1957,7 @@ function getFullSyncStatus(db){
|
||||
</div>\
|
||||
<div class='table_toolbar' style='left:0px;'>\
|
||||
<span data-status='init' class='sync btn btn-default btn-sm' id='begin_full_sync'>开始</span>\
|
||||
<span data-status='init' class='btn btn-default btn-sm' id='full_sync_cmd'>手动命令</span>\
|
||||
</div>\
|
||||
</div>",
|
||||
cancel: function(){
|
||||
@@ -1957,6 +1980,31 @@ function getFullSyncStatus(db){
|
||||
layer.msg("正在同步中..",{icon:0});
|
||||
}
|
||||
});
|
||||
|
||||
$('#full_sync_cmd').click(function(){
|
||||
myPostN('full_sync_cmd', {'db':db,'sign':''}, function(rdata){
|
||||
var rdata = $.parseJSON(rdata.data);
|
||||
layer.open({
|
||||
title: "手动执行命令CMD",
|
||||
area: ['600px', '180px'],
|
||||
type:1,
|
||||
closeBtn: 1,
|
||||
shadeClose: false,
|
||||
btn:["复制","取消"],
|
||||
content: '<div class="pd15">\
|
||||
<div class="divtable">\
|
||||
<pre class="layui-code">'+rdata.data+'</pre>\
|
||||
</div>\
|
||||
</div>',
|
||||
success:function(){
|
||||
copyText(rdata.data);
|
||||
},
|
||||
yes:function(){
|
||||
copyText(rdata.data);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -2210,7 +2258,7 @@ function addSlaveSyncUser(ip=''){
|
||||
|
||||
var index = layer.open({
|
||||
type: 1,
|
||||
area: ['500px','470px'],
|
||||
area: ['500px','510px'],
|
||||
title: '同步账户',
|
||||
closeBtn: 1,
|
||||
shift: 5,
|
||||
@@ -2221,6 +2269,15 @@ function addSlaveSyncUser(ip=''){
|
||||
<div class='line'><span class='tname'>端口</span><div class='info-r'><input name='port' class='bt-input-text mr5' type='number' style='width:330px;' value='"+port+"'></div></div>\
|
||||
<div class='line'><span class='tname'>同步账户</span><div class='info-r'><input name='user' class='bt-input-text mr5' type='text' style='width:330px;' value='"+user+"'></div></div>\
|
||||
<div class='line'><span class='tname'>同步密码</span><div class='info-r'><input name='pass' class='bt-input-text mr5' type='text' style='width:330px;' value='"+pass+"'></div></div>\
|
||||
<div class='line'>\
|
||||
<span class='tname'>同步模式</span>\
|
||||
<div class='info-r'>\
|
||||
<select class='bt-input-text mr5' name='mode'>\
|
||||
<option value='0' "+( mode == '0' ? 'selected="selected"' : '')+">经典</option>\
|
||||
<option value='1' "+( mode == '1' ? 'selected="selected"' : '')+">GTID</option>\
|
||||
</select>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class='line'>\
|
||||
<span class='tname'>CMD[必填]</span>\
|
||||
<div class='info-r'><textarea class='bt-input-text mr5' row='20' cols='30' name='cmd' style='width:330px;height:150px;'></textarea></div>\
|
||||
|
||||
@@ -14,21 +14,13 @@ sysName=`uname`
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
mariadbDir=${serverPath}/source/mariadb
|
||||
|
||||
MY_VER=10.11.7
|
||||
MY_VER=10.11.8
|
||||
|
||||
Install_app()
|
||||
{
|
||||
mkdir -p ${mariadbDir}
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
|
||||
if id mysql &> /dev/null ;then
|
||||
echo "mysql uid is `id -u www`"
|
||||
echo "mysql shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd mysql
|
||||
useradd -g mysql mysql
|
||||
fi
|
||||
|
||||
if [ "$sysName" != "Darwin" ];then
|
||||
mkdir -p /var/log/mariadb
|
||||
touch /var/log/mariadb/mariadb.log
|
||||
|
||||
@@ -13,21 +13,13 @@ sysName=`uname`
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
mariadbDir=${serverPath}/source/mariadb
|
||||
|
||||
MY_VER=10.6.17
|
||||
MY_VER=10.6.18
|
||||
|
||||
Install_app()
|
||||
{
|
||||
mkdir -p ${mariadbDir}
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
|
||||
if id mysql &> /dev/null ;then
|
||||
echo "mysql uid is `id -u www`"
|
||||
echo "mysql shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd mysql
|
||||
useradd -g mysql mysql
|
||||
fi
|
||||
|
||||
if [ "$sysName" != "Darwin" ];then
|
||||
mkdir -p /var/log/mariadb
|
||||
touch /var/log/mariadb/mariadb.log
|
||||
|
||||
@@ -21,14 +21,6 @@ Install_app()
|
||||
mkdir -p ${mariadbDir}
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
|
||||
if id mysql &> /dev/null ;then
|
||||
echo "mysql uid is `id -u www`"
|
||||
echo "mysql shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd mysql
|
||||
useradd -g mysql mysql
|
||||
fi
|
||||
|
||||
if [ "$sysName" != "Darwin" ];then
|
||||
mkdir -p /var/log/mariadb
|
||||
touch /var/log/mariadb/mariadb.log
|
||||
|
||||
@@ -21,14 +21,6 @@ Install_app()
|
||||
mkdir -p ${mariadbDir}
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
|
||||
if id mysql &> /dev/null ;then
|
||||
echo "mysql uid is `id -u www`"
|
||||
echo "mysql shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd mysql
|
||||
useradd -g mysql mysql
|
||||
fi
|
||||
|
||||
if [ "$sysName" != "Darwin" ];then
|
||||
mkdir -p /var/log/mariadb
|
||||
touch /var/log/mariadb/mariadb.log
|
||||
|
||||
@@ -21,14 +21,6 @@ Install_app()
|
||||
mkdir -p ${mariadbDir}
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
|
||||
if id mysql &> /dev/null ;then
|
||||
echo "mysql uid is `id -u www`"
|
||||
echo "mysql shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd mysql
|
||||
useradd -g mysql mysql
|
||||
fi
|
||||
|
||||
if [ "$sysName" != "Darwin" ];then
|
||||
mkdir -p /var/log/mariadb
|
||||
touch /var/log/mariadb/mariadb.log
|
||||
|
||||
@@ -21,14 +21,6 @@ Install_app()
|
||||
mkdir -p ${mariadbDir}
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
|
||||
if id mysql &> /dev/null ;then
|
||||
echo "mysql uid is `id -u www`"
|
||||
echo "mysql shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd mysql
|
||||
useradd -g mysql mysql
|
||||
fi
|
||||
|
||||
if [ "$sysName" != "Darwin" ];then
|
||||
mkdir -p /var/log/mariadb
|
||||
touch /var/log/mariadb/mariadb.log
|
||||
|
||||
@@ -21,14 +21,6 @@ Install_app()
|
||||
mkdir -p ${mariadbDir}
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
|
||||
if id mysql &> /dev/null ;then
|
||||
echo "mysql uid is `id -u www`"
|
||||
echo "mysql shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd mysql
|
||||
useradd -g mysql mysql
|
||||
fi
|
||||
|
||||
if [ "$sysName" != "Darwin" ];then
|
||||
mkdir -p /var/log/mariadb
|
||||
touch /var/log/mariadb/mariadb.log
|
||||
|
||||
@@ -14,21 +14,13 @@ sysName=`uname`
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
mariadbDir=${serverPath}/source/mariadb
|
||||
|
||||
MY_VER=11.2.3
|
||||
MY_VER=11.2.4
|
||||
|
||||
Install_app()
|
||||
{
|
||||
mkdir -p ${mariadbDir}
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
|
||||
if id mysql &> /dev/null ;then
|
||||
echo "mysql uid is `id -u www`"
|
||||
echo "mysql shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd mysql
|
||||
useradd -g mysql mysql
|
||||
fi
|
||||
|
||||
if [ "$sysName" != "Darwin" ];then
|
||||
mkdir -p /var/log/mariadb
|
||||
touch /var/log/mariadb/mariadb.log
|
||||
|
||||
@@ -21,14 +21,6 @@ Install_app()
|
||||
mkdir -p ${mariadbDir}
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
|
||||
if id mysql &> /dev/null ;then
|
||||
echo "mysql uid is `id -u www`"
|
||||
echo "mysql shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd mysql
|
||||
useradd -g mysql mysql
|
||||
fi
|
||||
|
||||
if [ "$sysName" != "Darwin" ];then
|
||||
mkdir -p /var/log/mariadb
|
||||
touch /var/log/mariadb/mariadb.log
|
||||
|
||||
Executable
+121
@@ -0,0 +1,121 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
|
||||
export PATH
|
||||
|
||||
#https://dev.mysql.com/downloads/mysql/5.5.html#downloads
|
||||
#https://dev.mysql.com/downloads/file/?id=480541
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
sysName=`uname`
|
||||
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
mariadbDir=${serverPath}/source/mariadb
|
||||
|
||||
MY_VER=11.4.2
|
||||
|
||||
Install_app()
|
||||
{
|
||||
mkdir -p ${mariadbDir}
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
|
||||
if [ "$sysName" != "Darwin" ];then
|
||||
mkdir -p /var/log/mariadb
|
||||
touch /var/log/mariadb/mariadb.log
|
||||
fi
|
||||
|
||||
# ----- cpu start ------
|
||||
if [ -z "${cpuCore}" ]; then
|
||||
cpuCore="1"
|
||||
fi
|
||||
|
||||
if [ -f /proc/cpuinfo ];then
|
||||
cpuCore=`cat /proc/cpuinfo | grep "processor" | wc -l`
|
||||
fi
|
||||
|
||||
MEM_INFO=$(free -m|grep Mem|awk '{printf("%.f",($2)/1024)}')
|
||||
if [ "${cpuCore}" != "1" ] && [ "${MEM_INFO}" != "0" ];then
|
||||
if [ "${cpuCore}" -gt "${MEM_INFO}" ];then
|
||||
cpuCore="${MEM_INFO}"
|
||||
fi
|
||||
else
|
||||
cpuCore="1"
|
||||
fi
|
||||
|
||||
if [ "$cpuCore" -gt "2" ];then
|
||||
cpuCore=`echo "$cpuCore" | awk '{printf("%.f",($1)*0.8)}'`
|
||||
else
|
||||
cpuCore="1"
|
||||
fi
|
||||
# ----- cpu end ------
|
||||
|
||||
# if [ ! -f ${mariadbDir}/mariadb-${MY_VER}.tar.gz ];then
|
||||
# wget --no-check-certificate -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://mirrors.aliyun.com/mariadb/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
# fi
|
||||
|
||||
# https://downloads.mariadb.org/interstitial/mariadb-10.9.1/source/mariadb-10.9.1.tar.gz
|
||||
if [ ! -f ${mariadbDir}/mariadb-${MY_VER}.tar.gz ];then
|
||||
wget --no-check-certificate -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://archive.mariadb.org/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
fi
|
||||
|
||||
if [ ! -d ${mariadbDir}/mariadb-${MY_VER} ];then
|
||||
cd ${mariadbDir} && tar -zxvf ${mariadbDir}/mariadb-${MY_VER}.tar.gz
|
||||
fi
|
||||
|
||||
INSTALL_CMD=cmake
|
||||
# check cmake version
|
||||
CMAKE_VERSION=`cmake -version | grep version | awk '{print $3}' | awk -F '.' '{print $1}'`
|
||||
if [ "$CMAKE_VERSION" -eq "2" ];then
|
||||
mkdir -p /var/log/mariadb
|
||||
touch /var/log/mariadb/mariadb.log
|
||||
INSTALL_CMD=cmake3
|
||||
fi
|
||||
|
||||
if [ ! -d $serverPath/mariadb ];then
|
||||
cd ${mariadbDir}/mariadb-${MY_VER} && ${INSTALL_CMD} \
|
||||
-DCMAKE_INSTALL_PREFIX=$serverPath/mariadb \
|
||||
-DMYSQL_DATADIR=$serverPath/mariadb/data/ \
|
||||
-DMYSQL_USER=mysql \
|
||||
-DMYSQL_UNIX_ADDR=$serverPath/mariadb/mysql.sock \
|
||||
-DWITH_MYISAM_STORAGE_ENGINE=1 \
|
||||
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
|
||||
-DWITH_MEMORY_STORAGE_ENGINE=1 \
|
||||
-DENABLED_LOCAL_INFILE=1 \
|
||||
-DWITH_PARTITION_STORAGE_ENGINE=1 \
|
||||
-DEXTRA_CHARSETS=all \
|
||||
-DDEFAULT_CHARSET=utf8mb4 \
|
||||
-DDEFAULT_COLLATION=utf8mb4_general_ci \
|
||||
-DCMAKE_C_COMPILER=/usr/bin/gcc \
|
||||
-DCMAKE_CXX_COMPILER=/usr/bin/g++
|
||||
make -j${cpuCore} && make install && make clean
|
||||
|
||||
if [ -d $serverPath/mariadb ];then
|
||||
echo '11.4' > $serverPath/mariadb/version.pl
|
||||
echo '安装完成'
|
||||
else
|
||||
echo '安装失败'
|
||||
echo 'install fail'>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -d ${mariadbDir}/mariadb-${MY_VER} ];then
|
||||
rm -rf ${mariadbDir}/mariadb-${MY_VER}
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
Uninstall_app()
|
||||
{
|
||||
rm -rf $serverPath/mariadb
|
||||
echo '卸载完成' > $install_tmp
|
||||
}
|
||||
|
||||
action=$1
|
||||
if [ "${1}" == 'install' ];then
|
||||
Install_app
|
||||
else
|
||||
Uninstall_app
|
||||
fi
|
||||
@@ -59,7 +59,7 @@ def getConfTpl():
|
||||
def getMemPort():
|
||||
path = getServerDir() + '/memcached.env'
|
||||
content = mw.readFile(path)
|
||||
rep = 'PORT\s*=\s*(\d*)'
|
||||
rep = r'PORT\s*=\s*(\d*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0]
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ serverPath=$(dirname "$rootPath")
|
||||
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
sys_os=`uname`
|
||||
VERSION=1.6.22
|
||||
VERSION=1.6.29
|
||||
|
||||
echo $sys_os
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ socket = {$SERVER_APP_PATH}/mysql.sock
|
||||
datadir = {$SERVER_APP_PATH}/data
|
||||
log-error = {$SERVER_APP_PATH}/data/error.log
|
||||
server-id = {$SERVER_ID}
|
||||
sql-mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
|
||||
|
||||
default_storage_engine = InnoDB
|
||||
|
||||
@@ -45,7 +44,6 @@ max_allowed_packet = 128M
|
||||
#skip-name-resolve
|
||||
|
||||
log-bin=mysql-bin
|
||||
binlog_format=mixed
|
||||
slow_query_log=1
|
||||
slow-query-log-file={$SERVER_APP_PATH}/data/mysql-slow.log
|
||||
long_query_time=3
|
||||
@@ -66,15 +64,12 @@ binlog-ignore-db = performance_schema
|
||||
#slave
|
||||
log_replica_updates
|
||||
#replicate-do-db
|
||||
slave_skip_errors=1062,1396
|
||||
replica_skip_errors=1062,1396
|
||||
replicate-ignore-db = information_schema
|
||||
replicate-ignore-db = performance_schema
|
||||
replicate-ignore-db = mysql
|
||||
replicate-ignore-db = test
|
||||
|
||||
master_info_repository = table
|
||||
relay_log_info_repository = table
|
||||
|
||||
default_storage_engine = InnoDB
|
||||
innodb_data_home_dir = {$SERVER_APP_PATH}/data
|
||||
innodb_data_file_path = ibdata1:10M:autoextend
|
||||
|
||||
@@ -8,7 +8,7 @@ default-character-set = UTF8MB4
|
||||
[mysqld]
|
||||
!include {$SERVER_APP_PATH}/etc/mode/classic.cnf
|
||||
|
||||
authentication_policy=mysql_native_password
|
||||
authentication_policy=caching_sha2_password
|
||||
pid-file = {$SERVER_APP_PATH}/data/mysql.pid
|
||||
user = mysql
|
||||
port = 33206
|
||||
@@ -17,7 +17,6 @@ socket = {$SERVER_APP_PATH}/mysql.sock
|
||||
datadir = {$SERVER_APP_PATH}/data
|
||||
log-error = {$SERVER_APP_PATH}/data/error.log
|
||||
server-id = {$SERVER_ID}
|
||||
sql-mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
|
||||
|
||||
default_storage_engine = InnoDB
|
||||
|
||||
@@ -45,7 +44,6 @@ max_allowed_packet = 128M
|
||||
#skip-name-resolve
|
||||
|
||||
log-bin=mysql-bin
|
||||
binlog_format=mixed
|
||||
slow_query_log=1
|
||||
slow-query-log-file={$SERVER_APP_PATH}/data/mysql-slow.log
|
||||
long_query_time=3
|
||||
@@ -66,15 +64,12 @@ binlog-ignore-db = performance_schema
|
||||
#slave
|
||||
log_replica_updates
|
||||
#replicate-do-db
|
||||
slave_skip_errors=1062,1396
|
||||
replica_skip_errors=1062,1396
|
||||
replicate-ignore-db = information_schema
|
||||
replicate-ignore-db = performance_schema
|
||||
replicate-ignore-db = mysql
|
||||
replicate-ignore-db = test
|
||||
|
||||
master_info_repository = table
|
||||
relay_log_info_repository = table
|
||||
|
||||
default_storage_engine = InnoDB
|
||||
innodb_data_home_dir = {$SERVER_APP_PATH}/data
|
||||
innodb_data_file_path = ibdata1:10M:autoextend
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
[client]
|
||||
user = root
|
||||
#password = your_password
|
||||
port = 33206
|
||||
socket = {$SERVER_APP_PATH}/mysql.sock
|
||||
default-character-set = UTF8MB4
|
||||
|
||||
[mysqld]
|
||||
!include {$SERVER_APP_PATH}/etc/mode/classic.cnf
|
||||
|
||||
authentication_policy=caching_sha2_password
|
||||
pid-file = {$SERVER_APP_PATH}/data/mysql.pid
|
||||
user = mysql
|
||||
port = 33206
|
||||
mysqlx_port = 33260
|
||||
socket = {$SERVER_APP_PATH}/mysql.sock
|
||||
datadir = {$SERVER_APP_PATH}/data
|
||||
log-error = {$SERVER_APP_PATH}/data/error.log
|
||||
server-id = {$SERVER_ID}
|
||||
|
||||
default_storage_engine = InnoDB
|
||||
|
||||
key_buffer_size = 8M
|
||||
table_open_cache = 32
|
||||
sort_buffer_size = 256K
|
||||
net_buffer_length = 4K
|
||||
read_buffer_size = 128K
|
||||
read_rnd_buffer_size = 256K
|
||||
myisam_sort_buffer_size = 4M
|
||||
thread_cache_size = 4
|
||||
lower_case_table_names=1
|
||||
tmp_table_size = 8M
|
||||
character-set-server = UTF8MB4
|
||||
|
||||
max_connections = 500
|
||||
max_connect_errors = 100
|
||||
open_files_limit = 2560
|
||||
max_allowed_packet = 128M
|
||||
|
||||
#skip-external-locking
|
||||
#skip-grant-tables
|
||||
#loose-skip-innodb
|
||||
#skip-networking
|
||||
#skip-name-resolve
|
||||
|
||||
log-bin=mysql-bin
|
||||
slow_query_log=1
|
||||
slow-query-log-file={$SERVER_APP_PATH}/data/mysql-slow.log
|
||||
long_query_time=3
|
||||
#log_queries_not_using_indexes=on
|
||||
|
||||
relay-log=mdserver
|
||||
relay-log-index=mdserver
|
||||
|
||||
#master
|
||||
#sync_binlog=1
|
||||
|
||||
#binlog-do-db
|
||||
binlog-ignore-db = test
|
||||
binlog-ignore-db = mysql
|
||||
binlog-ignore-db = information_schema
|
||||
binlog-ignore-db = performance_schema
|
||||
|
||||
#slave
|
||||
log_replica_updates
|
||||
#replicate-do-db
|
||||
replica_skip_errors=1062,1396
|
||||
replicate-ignore-db = information_schema
|
||||
replicate-ignore-db = performance_schema
|
||||
replicate-ignore-db = mysql
|
||||
replicate-ignore-db = test
|
||||
|
||||
default_storage_engine = InnoDB
|
||||
innodb_data_home_dir = {$SERVER_APP_PATH}/data
|
||||
innodb_data_file_path = ibdata1:10M:autoextend
|
||||
innodb_log_group_home_dir = {$SERVER_APP_PATH}/data
|
||||
innodb_buffer_pool_size = 16M
|
||||
innodb_redo_log_capacity=10485760
|
||||
innodb_log_buffer_size = 8M
|
||||
innodb_flush_log_at_trx_commit = 1
|
||||
innodb_lock_wait_timeout = 120
|
||||
innodb_max_dirty_pages_pct = 90
|
||||
innodb_read_io_threads = 1
|
||||
innodb_write_io_threads = 1
|
||||
innodb_file_per_table=1
|
||||
binlog_expire_logs_seconds=2592000
|
||||
|
||||
secure-file-priv={$SERVER_APP_PATH}/tmp
|
||||
|
||||
[mysqldump]
|
||||
quick
|
||||
|
||||
[mysql]
|
||||
no-auto-rehash
|
||||
|
||||
[myisamchk]
|
||||
key_buffer_size = 20M
|
||||
sort_buffer_size = 20M
|
||||
read_buffer = 2M
|
||||
write_buffer = 2M
|
||||
|
||||
[mysqlhotcopy]
|
||||
interactive-timeout
|
||||
@@ -0,0 +1,103 @@
|
||||
[client]
|
||||
user = root
|
||||
#password = your_password
|
||||
port = 33206
|
||||
socket = {$SERVER_APP_PATH}/mysql.sock
|
||||
default-character-set = UTF8MB4
|
||||
|
||||
[mysqld]
|
||||
!include {$SERVER_APP_PATH}/etc/mode/classic.cnf
|
||||
|
||||
authentication_policy=caching_sha2_password
|
||||
pid-file = {$SERVER_APP_PATH}/data/mysql.pid
|
||||
user = mysql
|
||||
port = 33206
|
||||
mysqlx_port = 33260
|
||||
socket = {$SERVER_APP_PATH}/mysql.sock
|
||||
datadir = {$SERVER_APP_PATH}/data
|
||||
log-error = {$SERVER_APP_PATH}/data/error.log
|
||||
server-id = {$SERVER_ID}
|
||||
|
||||
default_storage_engine = InnoDB
|
||||
|
||||
key_buffer_size = 8M
|
||||
table_open_cache = 32
|
||||
sort_buffer_size = 256K
|
||||
net_buffer_length = 4K
|
||||
read_buffer_size = 128K
|
||||
read_rnd_buffer_size = 256K
|
||||
myisam_sort_buffer_size = 4M
|
||||
thread_cache_size = 4
|
||||
lower_case_table_names=1
|
||||
tmp_table_size = 8M
|
||||
character-set-server = UTF8MB4
|
||||
|
||||
max_connections = 500
|
||||
max_connect_errors = 100
|
||||
open_files_limit = 2560
|
||||
max_allowed_packet = 128M
|
||||
|
||||
#skip-external-locking
|
||||
#skip-grant-tables
|
||||
#loose-skip-innodb
|
||||
#skip-networking
|
||||
#skip-name-resolve
|
||||
|
||||
log-bin=mysql-bin
|
||||
slow_query_log=1
|
||||
slow-query-log-file={$SERVER_APP_PATH}/data/mysql-slow.log
|
||||
long_query_time=3
|
||||
#log_queries_not_using_indexes=on
|
||||
|
||||
relay-log=mdserver
|
||||
relay-log-index=mdserver
|
||||
|
||||
#master
|
||||
#sync_binlog=1
|
||||
|
||||
#binlog-do-db
|
||||
binlog-ignore-db = test
|
||||
binlog-ignore-db = mysql
|
||||
binlog-ignore-db = information_schema
|
||||
binlog-ignore-db = performance_schema
|
||||
|
||||
#slave
|
||||
log_replica_updates
|
||||
#replicate-do-db
|
||||
replica_skip_errors=1062,1396
|
||||
replicate-ignore-db = information_schema
|
||||
replicate-ignore-db = performance_schema
|
||||
replicate-ignore-db = mysql
|
||||
replicate-ignore-db = test
|
||||
|
||||
default_storage_engine = InnoDB
|
||||
innodb_data_home_dir = {$SERVER_APP_PATH}/data
|
||||
innodb_data_file_path = ibdata1:10M:autoextend
|
||||
innodb_log_group_home_dir = {$SERVER_APP_PATH}/data
|
||||
innodb_buffer_pool_size = 16M
|
||||
innodb_redo_log_capacity=10485760
|
||||
innodb_log_buffer_size = 8M
|
||||
innodb_flush_log_at_trx_commit = 1
|
||||
innodb_lock_wait_timeout = 120
|
||||
innodb_max_dirty_pages_pct = 90
|
||||
innodb_read_io_threads = 1
|
||||
innodb_write_io_threads = 1
|
||||
innodb_file_per_table=1
|
||||
binlog_expire_logs_seconds=2592000
|
||||
|
||||
secure-file-priv={$SERVER_APP_PATH}/tmp
|
||||
|
||||
[mysqldump]
|
||||
quick
|
||||
|
||||
[mysql]
|
||||
no-auto-rehash
|
||||
|
||||
[myisamchk]
|
||||
key_buffer_size = 20M
|
||||
sort_buffer_size = 20M
|
||||
read_buffer = 2M
|
||||
write_buffer = 2M
|
||||
|
||||
[mysqlhotcopy]
|
||||
interactive-timeout
|
||||
@@ -0,0 +1,103 @@
|
||||
[client]
|
||||
user = root
|
||||
#password = your_password
|
||||
port = 33206
|
||||
socket = {$SERVER_APP_PATH}/mysql.sock
|
||||
default-character-set = UTF8MB4
|
||||
|
||||
[mysqld]
|
||||
!include {$SERVER_APP_PATH}/etc/mode/classic.cnf
|
||||
|
||||
authentication_policy=caching_sha2_password
|
||||
pid-file = {$SERVER_APP_PATH}/data/mysql.pid
|
||||
user = mysql
|
||||
port = 33206
|
||||
mysqlx_port = 33260
|
||||
socket = {$SERVER_APP_PATH}/mysql.sock
|
||||
datadir = {$SERVER_APP_PATH}/data
|
||||
log-error = {$SERVER_APP_PATH}/data/error.log
|
||||
server-id = {$SERVER_ID}
|
||||
|
||||
default_storage_engine = InnoDB
|
||||
|
||||
key_buffer_size = 8M
|
||||
table_open_cache = 32
|
||||
sort_buffer_size = 256K
|
||||
net_buffer_length = 4K
|
||||
read_buffer_size = 128K
|
||||
read_rnd_buffer_size = 256K
|
||||
myisam_sort_buffer_size = 4M
|
||||
thread_cache_size = 4
|
||||
lower_case_table_names=1
|
||||
tmp_table_size = 8M
|
||||
character-set-server = UTF8MB4
|
||||
|
||||
max_connections = 500
|
||||
max_connect_errors = 100
|
||||
open_files_limit = 2560
|
||||
max_allowed_packet = 128M
|
||||
|
||||
#skip-external-locking
|
||||
#skip-grant-tables
|
||||
#loose-skip-innodb
|
||||
#skip-networking
|
||||
#skip-name-resolve
|
||||
|
||||
log-bin=mysql-bin
|
||||
slow_query_log=1
|
||||
slow-query-log-file={$SERVER_APP_PATH}/data/mysql-slow.log
|
||||
long_query_time=3
|
||||
#log_queries_not_using_indexes=on
|
||||
|
||||
relay-log=mdserver
|
||||
relay-log-index=mdserver
|
||||
|
||||
#master
|
||||
#sync_binlog=1
|
||||
|
||||
#binlog-do-db
|
||||
binlog-ignore-db = test
|
||||
binlog-ignore-db = mysql
|
||||
binlog-ignore-db = information_schema
|
||||
binlog-ignore-db = performance_schema
|
||||
|
||||
#slave
|
||||
log_replica_updates
|
||||
#replicate-do-db
|
||||
replica_skip_errors=1062,1396
|
||||
replicate-ignore-db = information_schema
|
||||
replicate-ignore-db = performance_schema
|
||||
replicate-ignore-db = mysql
|
||||
replicate-ignore-db = test
|
||||
|
||||
default_storage_engine = InnoDB
|
||||
innodb_data_home_dir = {$SERVER_APP_PATH}/data
|
||||
innodb_data_file_path = ibdata1:10M:autoextend
|
||||
innodb_log_group_home_dir = {$SERVER_APP_PATH}/data
|
||||
innodb_buffer_pool_size = 16M
|
||||
innodb_redo_log_capacity=10485760
|
||||
innodb_log_buffer_size = 8M
|
||||
innodb_flush_log_at_trx_commit = 1
|
||||
innodb_lock_wait_timeout = 120
|
||||
innodb_max_dirty_pages_pct = 90
|
||||
innodb_read_io_threads = 1
|
||||
innodb_write_io_threads = 1
|
||||
innodb_file_per_table=1
|
||||
binlog_expire_logs_seconds=2592000
|
||||
|
||||
secure-file-priv={$SERVER_APP_PATH}/tmp
|
||||
|
||||
[mysqldump]
|
||||
quick
|
||||
|
||||
[mysql]
|
||||
no-auto-rehash
|
||||
|
||||
[myisamchk]
|
||||
key_buffer_size = 20M
|
||||
sort_buffer_size = 20M
|
||||
read_buffer = 2M
|
||||
write_buffer = 2M
|
||||
|
||||
[mysqlhotcopy]
|
||||
interactive-timeout
|
||||
@@ -50,7 +50,9 @@ CREATE TABLE IF NOT EXISTS `slave_sync_user` (
|
||||
`pass` TEXT,
|
||||
`mode` TEXT,
|
||||
`cmd` TEXT,
|
||||
`db` TEXT,
|
||||
`addtime` TEXT
|
||||
);
|
||||
ALTER TABLE `slave_sync_user` ADD COLUMN `db` TEXT DEFAULT '';
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class='plugin_version'></div>
|
||||
<div class="bt-w-main">
|
||||
<div class="bt-w-menu">
|
||||
<script type="text/javascript">console.log($('.plugin_version').attr('version'));</script>
|
||||
<!-- <script type="text/javascript">console.log($('.plugin_version').attr('version'));</script> -->
|
||||
<p class="bgw" onclick="pluginService('mysql-apt', $('.plugin_version').attr('version'));">服务</p>
|
||||
<p onclick="pluginInitD('mysql-apt', $('.plugin_version').attr('version'));">自启动</p>
|
||||
<p onclick="pluginConfig('mysql-apt', $('.plugin_version').attr('version'));">配置文件</p>
|
||||
|
||||
+660
-95
File diff suppressed because it is too large
Load Diff
@@ -6,9 +6,10 @@
|
||||
"type":"运行环境",
|
||||
"ps":"一种关系数据库管理系统[debian,ubuntu](极速安装)",
|
||||
"todo_versions":["5.7","8.0"],
|
||||
"versions":["5.7","8.0","8.2"],
|
||||
"versions":["5.7","8.0","8.2","8.3","8.4","9.0"],
|
||||
"shell":"install.sh",
|
||||
"install_pre_inspection":true,
|
||||
"uninstall_pre_inspection":true,
|
||||
"checks":"server/mysql-apt",
|
||||
"path":"server/mysql-apt",
|
||||
"author":"mysql",
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
# Copyright (c) 2015, 2022, Oracle and/or its affiliates.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2.0,
|
||||
# as published by the Free Software Foundation.
|
||||
#
|
||||
# This program is also distributed with certain software (including
|
||||
# but not limited to OpenSSL) that is licensed under separate terms,
|
||||
# as designated in a particular file or component or in included license
|
||||
# documentation. The authors of MySQL hereby grant you an additional
|
||||
# permission to link the program and your derivative works with the
|
||||
# separately licensed software that they have included with MySQL.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License, version 2.0, for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# MySQL systemd service file
|
||||
|
||||
[Unit]
|
||||
Description=MySQL Community Server
|
||||
Documentation=man:mysqld(8)
|
||||
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
|
||||
After=network.target
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
[Service]
|
||||
User=mysql
|
||||
Group=mysql
|
||||
Type=notify
|
||||
#ExecStartPre=+/usr/share/mysql-8.0/mysql-systemd-start pre
|
||||
ExecStart={$SERVER_PATH}/mysql-apt/bin/usr/sbin/mysqld --defaults-file={$SERVER_PATH}/mysql-apt/etc/my.cnf
|
||||
TimeoutSec=0
|
||||
LimitNOFILE = 10000
|
||||
Restart=on-failure
|
||||
RestartPreventExitStatus=1
|
||||
|
||||
# Always restart when mysqld exits with exit code of 16. This special exit code
|
||||
# is used by mysqld for RESTART SQL.
|
||||
RestartForceExitStatus=16
|
||||
|
||||
# Set enviroment variable MYSQLD_PARENT_PID. This is required for restart.
|
||||
Environment=MYSQLD_PARENT_PID=1
|
||||
@@ -0,0 +1,50 @@
|
||||
# Copyright (c) 2015, 2022, Oracle and/or its affiliates.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2.0,
|
||||
# as published by the Free Software Foundation.
|
||||
#
|
||||
# This program is also distributed with certain software (including
|
||||
# but not limited to OpenSSL) that is licensed under separate terms,
|
||||
# as designated in a particular file or component or in included license
|
||||
# documentation. The authors of MySQL hereby grant you an additional
|
||||
# permission to link the program and your derivative works with the
|
||||
# separately licensed software that they have included with MySQL.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License, version 2.0, for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# MySQL systemd service file
|
||||
|
||||
[Unit]
|
||||
Description=MySQL Community Server
|
||||
Documentation=man:mysqld(8)
|
||||
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
|
||||
After=network.target
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
[Service]
|
||||
User=mysql
|
||||
Group=mysql
|
||||
Type=notify
|
||||
#ExecStartPre=+/usr/share/mysql-8.0/mysql-systemd-start pre
|
||||
ExecStart={$SERVER_PATH}/mysql-apt/bin/usr/sbin/mysqld --defaults-file={$SERVER_PATH}/mysql-apt/etc/my.cnf
|
||||
TimeoutSec=0
|
||||
LimitNOFILE = 10000
|
||||
Restart=on-failure
|
||||
RestartPreventExitStatus=1
|
||||
|
||||
# Always restart when mysqld exits with exit code of 16. This special exit code
|
||||
# is used by mysqld for RESTART SQL.
|
||||
RestartForceExitStatus=16
|
||||
|
||||
# Set enviroment variable MYSQLD_PARENT_PID. This is required for restart.
|
||||
Environment=MYSQLD_PARENT_PID=1
|
||||
@@ -0,0 +1,50 @@
|
||||
# Copyright (c) 2015, 2022, Oracle and/or its affiliates.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2.0,
|
||||
# as published by the Free Software Foundation.
|
||||
#
|
||||
# This program is also distributed with certain software (including
|
||||
# but not limited to OpenSSL) that is licensed under separate terms,
|
||||
# as designated in a particular file or component or in included license
|
||||
# documentation. The authors of MySQL hereby grant you an additional
|
||||
# permission to link the program and your derivative works with the
|
||||
# separately licensed software that they have included with MySQL.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License, version 2.0, for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# MySQL systemd service file
|
||||
|
||||
[Unit]
|
||||
Description=MySQL Community Server
|
||||
Documentation=man:mysqld(8)
|
||||
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
|
||||
After=network.target
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
[Service]
|
||||
User=mysql
|
||||
Group=mysql
|
||||
Type=notify
|
||||
#ExecStartPre=+/usr/share/mysql-8.0/mysql-systemd-start pre
|
||||
ExecStart={$SERVER_PATH}/mysql-apt/bin/usr/sbin/mysqld --defaults-file={$SERVER_PATH}/mysql-apt/etc/my.cnf
|
||||
TimeoutSec=0
|
||||
LimitNOFILE = 10000
|
||||
Restart=on-failure
|
||||
RestartPreventExitStatus=1
|
||||
|
||||
# Always restart when mysqld exits with exit code of 16. This special exit code
|
||||
# is used by mysqld for RESTART SQL.
|
||||
RestartForceExitStatus=16
|
||||
|
||||
# Set enviroment variable MYSQLD_PARENT_PID. This is required for restart.
|
||||
Environment=MYSQLD_PARENT_PID=1
|
||||
@@ -0,0 +1,49 @@
|
||||
# Copyright (c) 2015, 2022, Oracle and/or its affiliates.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2.0,
|
||||
# as published by the Free Software Foundation.
|
||||
#
|
||||
# This program is also distributed with certain software (including
|
||||
# but not limited to OpenSSL) that is licensed under separate terms,
|
||||
# as designated in a particular file or component or in included license
|
||||
# documentation. The authors of MySQL hereby grant you an additional
|
||||
# permission to link the program and your derivative works with the
|
||||
# separately licensed software that they have included with MySQL.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License, version 2.0, for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# MySQL systemd service file
|
||||
|
||||
[Unit]
|
||||
Description=MySQL Community Server
|
||||
Documentation=man:mysqld(8)
|
||||
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
|
||||
After=network.target
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
[Service]
|
||||
User=mysql
|
||||
Group=mysql
|
||||
Type=notify
|
||||
ExecStart={$SERVER_PATH}/mysql-apt/bin/usr/sbin/mysqld --defaults-file={$SERVER_PATH}/mysql-apt/etc/my.cnf
|
||||
TimeoutSec=0
|
||||
LimitNOFILE = 10000
|
||||
Restart=on-failure
|
||||
RestartPreventExitStatus=1
|
||||
|
||||
# Always restart when mysqld exits with exit code of 16. This special exit code
|
||||
# is used by mysqld for RESTART SQL.
|
||||
RestartForceExitStatus=16
|
||||
|
||||
# Set enviroment variable MYSQLD_PARENT_PID. This is required for restart.
|
||||
Environment=MYSQLD_PARENT_PID=1
|
||||
@@ -0,0 +1,49 @@
|
||||
# Copyright (c) 2015, 2022, Oracle and/or its affiliates.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License, version 2.0,
|
||||
# as published by the Free Software Foundation.
|
||||
#
|
||||
# This program is also distributed with certain software (including
|
||||
# but not limited to OpenSSL) that is licensed under separate terms,
|
||||
# as designated in a particular file or component or in included license
|
||||
# documentation. The authors of MySQL hereby grant you an additional
|
||||
# permission to link the program and your derivative works with the
|
||||
# separately licensed software that they have included with MySQL.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License, version 2.0, for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# MySQL systemd service file
|
||||
|
||||
[Unit]
|
||||
Description=MySQL Community Server
|
||||
Documentation=man:mysqld(8)
|
||||
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
|
||||
After=network.target
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
[Service]
|
||||
User=mysql
|
||||
Group=mysql
|
||||
Type=notify
|
||||
ExecStart={$SERVER_PATH}/mysql-apt/bin/usr/sbin/mysqld --defaults-file={$SERVER_PATH}/mysql-apt/etc/my.cnf
|
||||
TimeoutSec=0
|
||||
LimitNOFILE = 10000
|
||||
Restart=on-failure
|
||||
RestartPreventExitStatus=1
|
||||
|
||||
# Always restart when mysqld exits with exit code of 16. This special exit code
|
||||
# is used by mysqld for RESTART SQL.
|
||||
RestartForceExitStatus=16
|
||||
|
||||
# Set enviroment variable MYSQLD_PARENT_PID. This is required for restart.
|
||||
Environment=MYSQLD_PARENT_PID=1
|
||||
@@ -11,8 +11,9 @@ serverPath=$(dirname "$rootPath")
|
||||
|
||||
# cd /www/server/mdserver-web/plugins/mysql-apt && bash install.sh install 8.0
|
||||
# cd /www/server/mdserver-web/plugins/mysql-apt && bash install.sh uninstall 8.0
|
||||
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql-apt/index.py start 8.0
|
||||
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql-apt/index.py start 5.7
|
||||
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql-apt/index.py fix_db_access
|
||||
# cd /www/server/mdserver-web && source bin/activate && python3 plugins/mysql/index.py do_full_sync {"db":"xxx","sign":"","begin":1}
|
||||
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
@@ -20,14 +21,22 @@ install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
action=$1
|
||||
type=$2
|
||||
|
||||
if id mysql &> /dev/null ;then
|
||||
echo "mysql UID is `id -u mysql`"
|
||||
echo "mysql Shell is `grep "^mysql:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd mysql
|
||||
useradd -g mysql -s /usr/sbin/nologin mysql
|
||||
fi
|
||||
|
||||
|
||||
if [ "${2}" == "" ];then
|
||||
echo '缺少安装脚本...' > $install_tmp
|
||||
echo '缺少安装脚本...'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ ! -d $curPath/versions/$2 ];then
|
||||
echo '缺少安装脚本2...' > $install_tmp
|
||||
echo '缺少安装脚本2...'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
@@ -59,11 +59,12 @@ function myAsyncPost(method,args){
|
||||
return syncPost('/plugins/run', {name:'mysql-apt', func:method, args:_args});
|
||||
}
|
||||
|
||||
|
||||
function myPostCallbak(method, version, args,callback){
|
||||
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
|
||||
|
||||
var req_data = {};
|
||||
req_data['name'] = 'mysql';
|
||||
req_data['name'] = 'mysql-apt';
|
||||
req_data['func'] = method;
|
||||
req_data['script']='index_mysql_apt';
|
||||
args['version'] = version;
|
||||
@@ -91,7 +92,7 @@ function myPostCallbak(method, version, args,callback){
|
||||
function myPostCallbakN(method, version, args,callback){
|
||||
|
||||
var req_data = {};
|
||||
req_data['name'] = 'mysql';
|
||||
req_data['name'] = 'mysql-apt';
|
||||
req_data['func'] = method;
|
||||
req_data['script']='index_mysql_apt';
|
||||
args['version'] = version;
|
||||
@@ -160,7 +161,7 @@ function runInfo(){
|
||||
<tr><th>活动/峰值连接数</th><td>' + rdata.Threads_running + '/' + rdata.Max_used_connections + '</td><td colspan="2">若值过大,增加max_connections</td></tr>\
|
||||
<tr><th>线程缓存命中率</th><td>' + ((1 - rdata.Threads_created / rdata.Connections) * 100).toFixed(2) + '%</td><td colspan="2">若过低,增加thread_cache_size</td></tr>\
|
||||
<tr><th>索引命中率</th><td>' + ((1 - rdata.Key_reads / rdata.Key_read_requests) * 100).toFixed(2) + '%</td><td colspan="2">若过低,增加key_buffer_size</td></tr>\
|
||||
<tr><th>Innodb索引命中率</th><td>' + ((1 - rdata.Innodb_buffer_pool_reads / rdata.Innodb_buffer_pool_read_requests) * 100).toFixed(2) + '%</td><td colspan="2">若过低,增加innodb_buffer_pool_size</td></tr>\
|
||||
<tr><th>Innodb索引命中率</th><td>' + (rdata.Innodb_buffer_pool_read_requests / (rdata.Innodb_buffer_pool_read_requests+rdata.Innodb_buffer_pool_reads)).toFixed(2) + '%</td><td colspan="2">若过低,增加innodb_buffer_pool_size</td></tr>\
|
||||
<tr><th>查询缓存命中率</th><td>' + cache_size + '</td><td colspan="2">' + lan.soft.mysql_status_ps5 + '</td></tr>\
|
||||
<tr><th>创建临时表到磁盘</th><td>' + ((rdata.Created_tmp_disk_tables / rdata.Created_tmp_tables) * 100).toFixed(2) + '%</td><td colspan="2">若过大,尝试增加tmp_table_size</td></tr>\
|
||||
<tr><th>已打开的表</th><td>' + rdata.Open_tables + '</td><td colspan="2">若过大,增加table_cache_size</td></tr>\
|
||||
@@ -199,7 +200,7 @@ function myPort(){
|
||||
myPost('my_port','',function(data){
|
||||
var con = '<div class="line ">\
|
||||
<div class="info-r ml0">\
|
||||
<input name="port" class="bt-input-text mr5 port" type="text" style="width:100px" value="'+data.data+'">\
|
||||
<input name="port" class="bt-input-text mr5 port" type="number" style="width:100px" value="'+data.data+'">\
|
||||
<button id="btn_change_port" name="btn_change_port" class="btn btn-success btn-sm mr5 ml5 btn_change_port">修改</button>\
|
||||
</div></div>';
|
||||
$(".soft-man-con").html(con);
|
||||
@@ -700,7 +701,7 @@ function setDbPass(id, username, password){
|
||||
<span title='随机密码' class='glyphicon glyphicon-repeat cursor' onclick='repeatPwd(16)'></span></div>\
|
||||
</div>\
|
||||
<input type='hidden' name='id' value='"+id+"'>\
|
||||
</form>",
|
||||
</form>",
|
||||
yes:function(index){
|
||||
// var data = $("#mod_pwd").serialize();
|
||||
var data = {};
|
||||
@@ -794,7 +795,7 @@ function addDatabase(type){
|
||||
|
||||
function delDb(id, name){
|
||||
safeMessage('删除['+name+']','您真的要删除['+name+']吗?',function(){
|
||||
var data='id='+id+'&name='+name
|
||||
var data='id='+id+'&name='+name;
|
||||
myPost('del_db', data, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
showMsg(rdata.msg,function(){
|
||||
@@ -870,7 +871,7 @@ function openPhpmyadmin(name,username,password){
|
||||
}
|
||||
|
||||
if (rdata.data['cfg']['choose'] != 'mysql-apt'){
|
||||
layer.msg('当前为['+rdata.choose+']模式,若要使用请修改phpMyAdmin访问切换.',{icon:2,shade: [0.3, '#000']});
|
||||
layer.msg('当前为['+rdata.data['cfg']['choose'] + ']模式,若要使用请修改phpMyAdmin访问切换.',{icon:2,shade: [0.3, '#000']});
|
||||
return;
|
||||
}
|
||||
var home_page = rdata.data['home_page'];
|
||||
@@ -928,6 +929,31 @@ function importBackup(file,name){
|
||||
});
|
||||
}
|
||||
|
||||
function importBackupProgress(file,name){
|
||||
myPost('import_db_backup_progress',{file:file,name:name}, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
layer.open({
|
||||
title: "手动导入命令CMD【显示进度】",
|
||||
area: ['600px', '180px'],
|
||||
type:1,
|
||||
closeBtn: 1,
|
||||
shadeClose: false,
|
||||
btn:["复制","取消"],
|
||||
content: '<div class="pd15">\
|
||||
<div class="divtable">\
|
||||
<pre class="layui-code">'+rdata.data+'</pre>\
|
||||
</div>\
|
||||
</div>',
|
||||
success:function(){
|
||||
copyText(rdata.data);
|
||||
},
|
||||
yes:function(){
|
||||
copyText(rdata.data);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function importDbExternal(file,name){
|
||||
myPost('import_db_external',{file:file,name:name}, function(data){
|
||||
@@ -935,6 +961,31 @@ function importDbExternal(file,name){
|
||||
});
|
||||
}
|
||||
|
||||
function importDbExternalProgress(file,name){
|
||||
myPost('import_db_external_progress',{file:file,name:name}, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
layer.open({
|
||||
title: "手动导入命令CMD【显示进度】",
|
||||
area: ['600px', '180px'],
|
||||
type:1,
|
||||
closeBtn: 1,
|
||||
shadeClose: false,
|
||||
btn:["复制","取消"],
|
||||
content: '<div class="pd15">\
|
||||
<div class="divtable">\
|
||||
<pre class="layui-code">'+rdata.data+'</pre>\
|
||||
</div>\
|
||||
</div>',
|
||||
success:function(){
|
||||
copyText(rdata.data);
|
||||
},
|
||||
yes:function(){
|
||||
copyText(rdata.data);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function setLocalImport(db_name){
|
||||
|
||||
//上传文件
|
||||
@@ -990,6 +1041,7 @@ function setLocalImport(db_name){
|
||||
<td><span> ' + file_list[i]['time'] + '</span></td>\
|
||||
<td style="text-align: right;">\
|
||||
<a class="btlink" onclick="importDbExternal(\'' + file_list[i]['name'] + '\',\'' +db_name+ '\')">导入</a> | \
|
||||
<a class="btlink" onclick="importDbExternalProgress(\'' + file_list[i]['name'] + '\',\'' +db_name+ '\')">导入进度</a> | \
|
||||
<a class="btlink del" index="'+i+'">删除</a>\
|
||||
</td>\
|
||||
</tr>';
|
||||
@@ -1013,7 +1065,7 @@ function setLocalImport(db_name){
|
||||
var layerIndex = layer.open({
|
||||
type: 1,
|
||||
title: "从文件导入数据",
|
||||
area: ['600px', '380px'],
|
||||
area: ['700px', '380px'],
|
||||
closeBtn: 1,
|
||||
shadeClose: false,
|
||||
content: '<div class="pd15">\
|
||||
@@ -1059,7 +1111,7 @@ function setBackup(db_name){
|
||||
var layerIndex = layer.open({
|
||||
type: 1,
|
||||
title: "数据库备份详情",
|
||||
area: ['600px', '280px'],
|
||||
area: ['700px', '280px'],
|
||||
closeBtn: 1,
|
||||
shadeClose: false,
|
||||
content: '<div class="pd15">\
|
||||
@@ -1113,6 +1165,7 @@ function setBackupReq(db_name, obj){
|
||||
<td><span> ' + rdata.data[i]['time'] + '</span></td>\
|
||||
<td style="text-align: right;">\
|
||||
<a class="btlink" onclick="importBackup(\'' + rdata.data[i]['name'] + '\',\'' +db_name+ '\')">导入</a> | \
|
||||
<a class="btlink" onclick="importBackupProgress(\'' + rdata.data[i]['name'] + '\',\'' +db_name+ '\')">导入进度</a> | \
|
||||
<a class="btlink" onclick="downloadBackup(\'' + rdata.data[i]['file'] + '\')">下载</a> | \
|
||||
<a class="btlink" onclick="delBackup(\'' + rdata.data[i]['name'] + '\',\'' +db_name+ '\')">删除</a>\
|
||||
</td>\
|
||||
@@ -1230,6 +1283,7 @@ function dbList(page, search){
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function myBinRollingLogs(_name, func, _args, line){
|
||||
|
||||
var file_line = 100;
|
||||
@@ -1653,7 +1707,7 @@ function addMasterRepSlaveUser(){
|
||||
|
||||
|
||||
|
||||
function updateMasterRepSlaveUser(username){
|
||||
function updateMasterRepSlaveUser(username, password){
|
||||
|
||||
var index = layer.open({
|
||||
type: 1,
|
||||
@@ -1666,7 +1720,7 @@ function updateMasterRepSlaveUser(username){
|
||||
<div class='line'><span class='tname'>用户名</span><div class='info-r'><input name='username' readonly='readonly' class='bt-input-text mr5' placeholder='用户名' type='text' style='width:330px;' value='"+username+"'></div></div>\
|
||||
<div class='line'>\
|
||||
<span class='tname'>密码</span>\
|
||||
<div class='info-r'><input class='bt-input-text mr5' type='text' name='password' id='MyPassword' style='width:330px' value='"+(randomStrPwd(16))+"' /><span title='随机密码' class='glyphicon glyphicon-repeat cursor' onclick='repeatPwd(16)'></span></div>\
|
||||
<div class='info-r'><input class='bt-input-text mr5' type='text' name='password' id='MyPassword' style='width:330px' value='"+password+"' /><span title='随机密码' class='glyphicon glyphicon-repeat cursor' onclick='repeatPwd(16)'></span></div>\
|
||||
</div>\
|
||||
<input type='hidden' name='ps' value='' />\
|
||||
<div class='bt-form-submit-btn'>\
|
||||
@@ -1708,17 +1762,11 @@ function getMasterRepSlaveUserCmd(username, db=''){
|
||||
area: '500px',
|
||||
content:"<form class='bt-form pd20 pb70' id='add_master'>\
|
||||
<div class='line'>"+cmd+"</div>\
|
||||
<div class='bt-form-submit-btn'>\
|
||||
<button type='button' class='btn btn-success btn-sm btn-title class-copy-cmd'>复制</button>\
|
||||
<div class='bt-form-submit-btn' style='text-align:center;'>\
|
||||
<button type='button' class='btn btn-success btn-sm btn-title'>选择其中一个复制</button>\
|
||||
</div>\
|
||||
</form>",
|
||||
});
|
||||
|
||||
|
||||
copyPass(cmd);
|
||||
$('.class-copy-cmd').click(function(){
|
||||
copyPass(cmd);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1809,6 +1857,7 @@ function setDbMasterAccess(username){
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function resetMaster(){
|
||||
myPost('reset_master', '', function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
@@ -1839,10 +1888,11 @@ function getMasterRepSlaveList(){
|
||||
for (i in user_list) {
|
||||
// console.log(i);
|
||||
var name = user_list[i]['username'];
|
||||
var password = user_list[i]['password'];
|
||||
list += '<tr><td>'+name+'</td>\
|
||||
<td>'+user_list[i]['password']+'</td>\
|
||||
<td>'+password+'</td>\
|
||||
<td>\
|
||||
<a class="btlink" onclick="updateMasterRepSlaveUser(\''+name+'\');">修改</a> | \
|
||||
<a class="btlink" onclick="updateMasterRepSlaveUser(\''+name+'\',\''+password+'\');">修改</a> | \
|
||||
<a class="btlink" onclick="delMasterRepSlaveUser(\''+name+'\');">删除</a> | \
|
||||
<a class="btlink" onclick="setDbMasterAccess(\''+name+'\');">权限</a> | \
|
||||
<a class="btlink" onclick="getMasterRepSlaveUserCmd(\''+name+'\');">从库同步命令</a>\
|
||||
@@ -1930,6 +1980,7 @@ function getFullSyncStatus(db){
|
||||
</div>\
|
||||
<div class='table_toolbar' style='left:0px;'>\
|
||||
<span data-status='init' class='sync btn btn-default btn-sm' id='begin_full_sync'>开始</span>\
|
||||
<span data-status='init' class='btn btn-default btn-sm' id='full_sync_cmd'>手动命令</span>\
|
||||
</div>\
|
||||
</div>",
|
||||
cancel: function(){
|
||||
@@ -1948,10 +1999,36 @@ function getFullSyncStatus(db){
|
||||
fullSync(db,sign,0);
|
||||
}, 1000);
|
||||
$(this).data('status','starting');
|
||||
$('#begin_full_sync').text("同步中");
|
||||
} else {
|
||||
layer.msg("正在同步中..",{icon:0});
|
||||
}
|
||||
});
|
||||
|
||||
$('#full_sync_cmd').click(function(){
|
||||
myPostN('full_sync_cmd', {'db':db,'sign':''}, function(rdata){
|
||||
var rdata = $.parseJSON(rdata.data);
|
||||
layer.open({
|
||||
title: "手动执行命令CMD",
|
||||
area: ['600px', '180px'],
|
||||
type:1,
|
||||
closeBtn: 1,
|
||||
shadeClose: false,
|
||||
btn:["复制","取消"],
|
||||
content: '<div class="pd15">\
|
||||
<div class="divtable">\
|
||||
<pre class="layui-code">'+rdata.data+'</pre>\
|
||||
</div>\
|
||||
</div>',
|
||||
success:function(){
|
||||
copyText(rdata.data);
|
||||
},
|
||||
yes:function(){
|
||||
copyText(rdata.data);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1967,12 +2044,91 @@ function getFullSyncStatus(db){
|
||||
if (rdata['code']==6 ||rdata['code']<0){
|
||||
layer.msg(rdata['msg']);
|
||||
clearInterval(timeId);
|
||||
$("#begin_full_sync").data('data','init');
|
||||
$('#begin_full_sync').text("同步结束,再次同步?");
|
||||
$("#begin_full_sync").attr('data-status','init');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function dataSyncVerify(db){
|
||||
var reqTimer = null;
|
||||
|
||||
function requestLogs(layerIndex){
|
||||
myPostN('sync_database_repair_log', {db:db, sign:'',op:'get'}, function(rdata){
|
||||
var rdata = $.parseJSON(rdata.data);
|
||||
|
||||
if(!rdata.status) {
|
||||
layer.close(layerIndex);
|
||||
layer.msg(rdata.msg,{icon:2, time:2000});
|
||||
clearInterval(reqTimer);
|
||||
return;
|
||||
};
|
||||
|
||||
if (rdata.msg == ''){
|
||||
rdata.msg = '暂无数据!';
|
||||
}
|
||||
|
||||
$("#data_verify_log").html(rdata.msg);
|
||||
//滚动到最低
|
||||
var ob = document.getElementById('data_verify_log');
|
||||
ob.scrollTop = ob.scrollHeight;
|
||||
});
|
||||
}
|
||||
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: '同步数据库['+db+']数据校验',
|
||||
area: '500px',
|
||||
btn:[ "开始","取消","手动"],
|
||||
content:"<div class='bt-form'>\
|
||||
"+'<pre id="data_verify_log" style="overflow: auto; border: 0px none; line-height:23px;padding: 5px; margin: 0px; white-space: pre-wrap; height: 395px; background-color: rgb(51,51,51);color:#f1f1f1;border-radius:0px;font-family:"></pre>'+"\
|
||||
</div>",
|
||||
cancel: function(){
|
||||
if (reqTimer){
|
||||
clearInterval(reqTimer);
|
||||
}
|
||||
},
|
||||
yes:function(index,layer_index){
|
||||
myPostN('sync_database_repair_log', {db:db, sign:'',op:'do'}, function(data){});
|
||||
layer.msg("执行成功");
|
||||
|
||||
requestLogs(layer_index);
|
||||
reqTimer = setInterval(function(){
|
||||
requestLogs(layer_index);
|
||||
},3000);
|
||||
},
|
||||
success:function(){
|
||||
},
|
||||
btn3: function(){
|
||||
myPostN('sync_database_repair_log', {db:db, sign:'',op:'cmd'}, function(rdata){
|
||||
var rdata = $.parseJSON(rdata.data);
|
||||
layer.open({
|
||||
title: "手动执行命令CMD",
|
||||
area: ['600px', '180px'],
|
||||
type:1,
|
||||
closeBtn: 1,
|
||||
shadeClose: false,
|
||||
btn:["复制","取消"],
|
||||
content: '<div class="pd15">\
|
||||
<div class="divtable">\
|
||||
<pre class="layui-code">'+rdata.data+'</pre>\
|
||||
</div>\
|
||||
</div>',
|
||||
success:function(){
|
||||
copyText(rdata.data);
|
||||
},
|
||||
yes:function(){
|
||||
copyText(rdata.data);
|
||||
}
|
||||
});
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function addSlaveSSH(ip=''){
|
||||
|
||||
myPost('get_slave_ssh_by_ip', {ip:ip}, function(rdata){
|
||||
@@ -2128,7 +2284,7 @@ function addSlaveSyncUser(ip=''){
|
||||
|
||||
var index = layer.open({
|
||||
type: 1,
|
||||
area: ['500px','470px'],
|
||||
area: ['500px','510px'],
|
||||
title: '同步账户',
|
||||
closeBtn: 1,
|
||||
shift: 5,
|
||||
@@ -2140,7 +2296,16 @@ function addSlaveSyncUser(ip=''){
|
||||
<div class='line'><span class='tname'>同步账户</span><div class='info-r'><input name='user' class='bt-input-text mr5' type='text' style='width:330px;' value='"+user+"'></div></div>\
|
||||
<div class='line'><span class='tname'>同步密码</span><div class='info-r'><input name='pass' class='bt-input-text mr5' type='text' style='width:330px;' value='"+pass+"'></div></div>\
|
||||
<div class='line'>\
|
||||
<span class='tname'>CMD[必须填写]</span>\
|
||||
<span class='tname'>同步模式</span>\
|
||||
<div class='info-r'>\
|
||||
<select class='bt-input-text mr5' name='mode'>\
|
||||
<option value='0' "+( mode == '0' ? 'selected="selected"' : '')+">经典</option>\
|
||||
<option value='1' "+( mode == '1' ? 'selected="selected"' : '')+">GTID</option>\
|
||||
</select>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class='line'>\
|
||||
<span class='tname'>CMD[必填]</span>\
|
||||
<div class='info-r'><textarea class='bt-input-text mr5' row='20' cols='30' name='cmd' style='width:330px;height:150px;'></textarea></div>\
|
||||
</div>\
|
||||
<input type='hidden' name='mode' value='"+mode+"' />\
|
||||
@@ -2149,6 +2314,7 @@ function addSlaveSyncUser(ip=''){
|
||||
$('textarea[name="cmd"]').html(cmd);
|
||||
$('textarea[name="cmd"]').change(function(){
|
||||
var val = $(this).val();
|
||||
val = val.replace(';','');
|
||||
var a = {};
|
||||
if (val.toLowerCase().indexOf('for')>0){
|
||||
cmd_tmp = val.split('for');
|
||||
@@ -2171,15 +2337,18 @@ function addSlaveSyncUser(ip=''){
|
||||
a[kv[0]] = kv[1].replace("'",'').replace("'",'');
|
||||
}
|
||||
|
||||
$('input[name="ip"]').val(a['MASTER_HOST']);
|
||||
$('input[name="port"]').val(a['MASTER_PORT']);
|
||||
$('input[name="user"]').val(a['MASTER_USER']);
|
||||
$('input[name="pass"]').val(a['MASTER_PASSWORD']);
|
||||
|
||||
console.log(a['MASTER_AUTO_POSITION'],typeof(a['MASTER_AUTO_POSITION']));
|
||||
if (typeof(a['MASTER_AUTO_POSITION']) != 'undefined' ){
|
||||
$('input[name="mode"]').val('1');
|
||||
if ('MASTER_HOST' in a){
|
||||
$('input[name="ip"]').val(a['MASTER_HOST']);
|
||||
$('input[name="port"]').val(a['MASTER_PORT']);
|
||||
$('input[name="user"]').val(a['MASTER_USER']);
|
||||
$('input[name="pass"]').val(a['MASTER_PASSWORD']);
|
||||
} else {
|
||||
$('input[name="ip"]').val(a['SOURCE_HOST']);
|
||||
$('input[name="port"]').val(a['SOURCE_PORT']);
|
||||
$('input[name="user"]').val(a['SOURCE_USER']);
|
||||
$('input[name="pass"]').val(a['SOURCE_PASSWORD']);
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
yes:function(index){
|
||||
@@ -2188,7 +2357,7 @@ function addSlaveSyncUser(ip=''){
|
||||
var user = $('input[name="user"]').val();
|
||||
var pass = $('input[name="pass"]').val();
|
||||
var cmd = $('textarea[name="cmd"]').val();
|
||||
var mode = $('input[name="mode"]').val();
|
||||
var mode = $('select[name="mode"]').val();
|
||||
|
||||
var data = {ip:ip,port:port,cmd:cmd,user:user,pass:pass,mode:mode};
|
||||
myPost('add_slave_sync_user', data, function(ret_data){
|
||||
@@ -2458,6 +2627,8 @@ function masterOrSlaveConf(version=''){
|
||||
_data['page'] = page;
|
||||
_data['page_size'] = 10;
|
||||
|
||||
var mdb_ver = $('.plugin_version').attr('version');
|
||||
|
||||
myPost('get_slave_list', _data, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
var list = '';
|
||||
@@ -2466,22 +2637,39 @@ function masterOrSlaveConf(version=''){
|
||||
for(i in rdata.data){
|
||||
|
||||
var v = rdata.data[i];
|
||||
if ('Channel_Name' in v){
|
||||
if ('Channel_Name' in v && v['Channel_Name'] !=''){
|
||||
isHasSign = true;
|
||||
}
|
||||
|
||||
var status = "<a data-id="+i+" class='btlink db_error'>异常</>";
|
||||
if (v['Slave_SQL_Running'] == 'Yes' && v['Slave_IO_Running'] == 'Yes'){
|
||||
status = "正常";
|
||||
}
|
||||
if (mdb_ver >= 8){
|
||||
|
||||
list += '<tr>';
|
||||
list += '<td>' + rdata.data[i]['Master_Host'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Master_Port'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Master_User'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Master_Log_File'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Slave_IO_Running'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Slave_SQL_Running'] +'</td>';
|
||||
if (v['Replica_SQL_Running'] == 'Yes' && v['Replica_IO_Running'] == 'Yes'){
|
||||
status = "正常";
|
||||
}
|
||||
|
||||
list += '<tr>';
|
||||
list += '<td>' + rdata.data[i]['Source_Host'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Source_Port'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Source_User'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Relay_Source_Log_File'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Replica_IO_Running'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Replica_SQL_Running'] +'</td>';
|
||||
|
||||
} else {
|
||||
if (v['Slave_SQL_Running'] == 'Yes' && v['Slave_IO_Running'] == 'Yes'){
|
||||
status = "正常";
|
||||
}
|
||||
|
||||
list += '<tr>';
|
||||
list += '<td>' + rdata.data[i]['Master_Host'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Master_Port'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Master_User'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Master_Log_File'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Slave_IO_Running'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Slave_SQL_Running'] +'</td>';
|
||||
}
|
||||
|
||||
|
||||
if (isHasSign){
|
||||
list += '<td>' + v['Channel_Name'] +'</td>';
|
||||
@@ -2553,6 +2741,7 @@ function masterOrSlaveConf(version=''){
|
||||
<td>"+(info['Slave_SQL_Running_State'] == '' ? '无':info['Slave_SQL_Running_State']) +"</td>\
|
||||
</tr>";
|
||||
|
||||
|
||||
var btn_list = ['复制错误',"取消"];
|
||||
if (info['Last_IO_Error'].search(/1236/i)>0){
|
||||
btn_list = ['复制错误',"取消","尝试修复"];
|
||||
@@ -2636,7 +2825,8 @@ function masterOrSlaveConf(version=''){
|
||||
list += '<td>' + rdata.data[i]['name'] +'</td>';
|
||||
list += '<td style="text-align:right">' +
|
||||
'<a href="javascript:;" class="btlink" onclick="setDbSlave(\''+rdata.data[i]['name']+'\')" title="加入|退出">'+(rdata.data[i]['slave']?'退出':'加入')+'</a> | ' +
|
||||
'<a href="javascript:;" class="btlink" onclick="getFullSyncStatus(\''+rdata.data[i]['name']+'\')" title="同步">同步</a>' +
|
||||
'<a href="javascript:;" class="btlink" onclick="getFullSyncStatus(\''+rdata.data[i]['name']+'\')" title="同步">同步</a> | ' +
|
||||
'<a href="javascript:;" class="btlink" onclick="dataSyncVerify(\''+rdata.data[i]['name']+'\')" title="数据校验">数据校验</a>' +
|
||||
'</td>';
|
||||
list += '</tr>';
|
||||
}
|
||||
@@ -2684,7 +2874,7 @@ function masterOrSlaveConf(version=''){
|
||||
<p class="conf_p">\
|
||||
<span class="f14 c6 mr20">Master[主]配置</span><span class="f14 c6 mr20"></span>\
|
||||
<button class="btn '+(!rdata.status ? 'btn-danger' : 'btn-success')+' btn-xs btn-master">'+(!rdata.status ? '未开启' : '已开启') +'</button>\
|
||||
<button class="btn btn-success btn-xs" onclick="resetMaster()" >重置</button>\
|
||||
<button class="btn btn-success btn-xs" onclick="resetMaster()">重置</button>\
|
||||
</p>\
|
||||
<hr/>\
|
||||
<!-- master list -->\
|
||||
|
||||
@@ -63,7 +63,7 @@ class backupTools:
|
||||
if len(mycnf) > 100:
|
||||
mw.writeFile(db_path + '/etc/my.cnf', mycnf)
|
||||
|
||||
cmd = db_path + "/bin/usr/bin/mysqldump --defaults-file=" + my_conf_path + " --single-transaction -q --default-character-set=utf8 " + \
|
||||
cmd = db_path + "/bin/usr/bin/mysqldump --defaults-file=" + my_conf_path + " --single-transaction -q --default-character-set=utf8mb4 " + \
|
||||
name + " | gzip > " + filename
|
||||
mw.execShell(cmd)
|
||||
|
||||
|
||||
@@ -96,14 +96,6 @@ rm -rf $myDir
|
||||
Install_mysql()
|
||||
{
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
if id mysql &> /dev/null ;then
|
||||
echo "mysql uid is `id -u mysql`"
|
||||
echo "mysql shell is `grep "^mysql:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd mysql
|
||||
useradd -g mysql mysql
|
||||
fi
|
||||
|
||||
|
||||
isApt=`which apt`
|
||||
if [ "$isApt" != "" ];then
|
||||
|
||||
@@ -23,10 +23,10 @@ VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -
|
||||
# cd /www/server/mdserver-web/plugins/mysql-apt && bash install.sh install 8.0
|
||||
|
||||
# 暂时debian12没有标准版,先用11使用
|
||||
if [ "$OSNAME" == 'debian' ] && [ "$VERSION_ID" == '12' ] ;then
|
||||
echo "暂时不支持该${OSNAME}${VERSION_ID}" > $install_tmp
|
||||
exit 1
|
||||
fi
|
||||
# if [ "$OSNAME" == 'debian' ] && [ "$VERSION_ID" == '12' ] ;then
|
||||
# echo "暂时不支持该${OSNAME}${VERSION_ID}" > $install_tmp
|
||||
# exit 1
|
||||
# fi
|
||||
|
||||
|
||||
ARCH="amd64"
|
||||
@@ -45,7 +45,7 @@ if [ "$ARCH" != "amd64" ];then
|
||||
fi
|
||||
|
||||
|
||||
MYSQL_VER=8.0.33
|
||||
MYSQL_VER=8.0.36
|
||||
SUFFIX_NAME=${MYSQL_VER}-1${OSNAME}${VERSION_ID}_${ARCH}
|
||||
|
||||
|
||||
@@ -58,6 +58,10 @@ APT_INSTALL()
|
||||
mkdir -p $myDir
|
||||
mkdir -p $serverPath/mysql-apt/bin
|
||||
|
||||
|
||||
mkdir -p /var/run/mysqld
|
||||
chown mysql -R /var/run/mysqld
|
||||
|
||||
wget --no-check-certificate -O ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar https://cdn.mysql.com/archives/mysql-8.0/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
|
||||
chmod +x ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
|
||||
cd ${myDir} && tar vxf ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
|
||||
@@ -97,13 +101,6 @@ rm -rf $myDir
|
||||
Install_mysql()
|
||||
{
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
if id mysql &> /dev/null ;then
|
||||
echo "mysql uid is `id -u mysql`"
|
||||
echo "mysql shell is `grep "^mysql:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd mysql
|
||||
useradd -g mysql mysql
|
||||
fi
|
||||
|
||||
isApt=`which apt`
|
||||
if [ "$isApt" != "" ];then
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
#!/bin/bash
|
||||
|
||||
@@ -21,12 +22,13 @@ OSNAME=`cat ${rootPath}/data/osname.pl`
|
||||
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
|
||||
# cd /www/server/mdserver-web/plugins/mysql-apt && bash install.sh install 8.0
|
||||
# cd /www/server/mdserver-web && source bin/activate && python3 plugins/mysql-apt/index.py start
|
||||
|
||||
# 暂时debian12没有标准版,先用11使用
|
||||
if [ "$OSNAME" == 'debian' ] && [ "$VERSION_ID" == '12' ] ;then
|
||||
echo "暂时不支持该${OSNAME}${VERSION_ID}" > $install_tmp
|
||||
exit 1
|
||||
fi
|
||||
# if [ "$OSNAME" == 'debian' ] && [ "$VERSION_ID" == '12' ] ;then
|
||||
# echo "暂时不支持该${OSNAME}${VERSION_ID}" > $install_tmp
|
||||
# exit 1
|
||||
# fi
|
||||
|
||||
|
||||
ARCH="amd64"
|
||||
@@ -58,6 +60,9 @@ APT_INSTALL()
|
||||
mkdir -p $myDir
|
||||
mkdir -p $serverPath/mysql-apt/bin
|
||||
|
||||
mkdir -p /var/run/mysqld
|
||||
chown mysql -R /var/run/mysqld
|
||||
|
||||
wget --no-check-certificate -O ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar https://cdn.mysql.com/archives/mysql-8.2/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
|
||||
chmod +x ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
|
||||
cd ${myDir} && tar vxf ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
|
||||
@@ -97,13 +102,6 @@ rm -rf $myDir
|
||||
Install_mysql()
|
||||
{
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
if id mysql &> /dev/null ;then
|
||||
echo "mysql uid is `id -u mysql`"
|
||||
echo "mysql shell is `grep "^mysql:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd mysql
|
||||
useradd -g mysql mysql
|
||||
fi
|
||||
|
||||
isApt=`which apt`
|
||||
if [ "$isApt" != "" ];then
|
||||
|
||||
Executable
+136
@@ -0,0 +1,136 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#!/bin/bash
|
||||
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# https://downloads.mysql.com/archives/community/
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
sysName=`uname`
|
||||
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
myDir=${serverPath}/source/mysql-apt
|
||||
|
||||
bash ${rootPath}/scripts/getos.sh
|
||||
OSNAME=`cat ${rootPath}/data/osname.pl`
|
||||
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
|
||||
# cd /www/server/mdserver-web/plugins/mysql-apt && bash install.sh install 8.0
|
||||
|
||||
# 暂时debian12没有标准版,先用11使用
|
||||
# if [ "$OSNAME" == 'debian' ] && [ "$VERSION_ID" == '12' ] ;then
|
||||
# echo "暂时不支持该${OSNAME}${VERSION_ID}" > $install_tmp
|
||||
# exit 1
|
||||
# fi
|
||||
|
||||
|
||||
ARCH="amd64"
|
||||
TMP_ARCH=`arch`
|
||||
if [ "$TMP_ARCH" == "x86_64" ];then
|
||||
ARCH="amd64"
|
||||
elif [ "$TMP_ARCH" == "aarch64" ];then
|
||||
ARCH="arm64"
|
||||
else
|
||||
ARCH="amd64"
|
||||
fi
|
||||
|
||||
if [ "$ARCH" != "amd64" ];then
|
||||
echo "暂时不支持该${ARCH}" > $install_tmp
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
MYSQL_VER=8.3.0
|
||||
SUFFIX_NAME=${MYSQL_VER}-1${OSNAME}${VERSION_ID}_${ARCH}
|
||||
|
||||
|
||||
# /lib/systemd/system/mysql.service
|
||||
# /etc/mysql/my.cnf
|
||||
|
||||
APT_INSTALL()
|
||||
{
|
||||
########
|
||||
mkdir -p $myDir
|
||||
mkdir -p $serverPath/mysql-apt/bin
|
||||
|
||||
mkdir -p /var/run/mysqld
|
||||
chown mysql -R /var/run/mysqld
|
||||
|
||||
wget --no-check-certificate -O ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar https://cdn.mysql.com/archives/mysql-8.3/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
|
||||
chmod +x ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
|
||||
cd ${myDir} && tar vxf ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
|
||||
|
||||
apt update -y
|
||||
apt install -y libnuma1 libaio1 libmecab2
|
||||
|
||||
# 安装
|
||||
dpkg -X mysql-common_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
|
||||
|
||||
|
||||
|
||||
dpkg -X mysql-community-client-plugins_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
|
||||
dpkg -X mysql-community-client-core_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
|
||||
dpkg -X mysql-community-client_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
|
||||
dpkg -X mysql-client_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
|
||||
|
||||
dpkg -X mysql-community-server-core_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
|
||||
|
||||
dpkg -X mysql-community-server_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
|
||||
dpkg -X mysql-server_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
|
||||
|
||||
# 测试时可关闭
|
||||
rm -rf $myDir
|
||||
#######
|
||||
}
|
||||
|
||||
APT_UNINSTALL()
|
||||
{
|
||||
###
|
||||
rm -rf $myDir
|
||||
# apt remove -y mysql-server
|
||||
###
|
||||
}
|
||||
|
||||
|
||||
Install_mysql()
|
||||
{
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
|
||||
isApt=`which apt`
|
||||
if [ "$isApt" != "" ];then
|
||||
APT_INSTALL
|
||||
fi
|
||||
|
||||
if [ "$?" == "0" ];then
|
||||
mkdir -p $serverPath/mysql-apt
|
||||
echo '8.3' > $serverPath/mysql-apt/version.pl
|
||||
echo '安装完成' > $install_tmp
|
||||
else
|
||||
echo '8.3' > $serverPath/mysql-apt/version.pl
|
||||
echo "暂时不支持该系统" > $install_tmp
|
||||
fi
|
||||
}
|
||||
|
||||
Uninstall_mysql()
|
||||
{
|
||||
|
||||
isApt=`which apt`
|
||||
if [ "$isApt" != "" ];then
|
||||
APT_UNINSTALL
|
||||
fi
|
||||
|
||||
rm -rf $serverPath/mysql-apt
|
||||
echo '卸载完成' > $install_tmp
|
||||
}
|
||||
|
||||
action=$1
|
||||
if [ "${1}" == 'install' ];then
|
||||
Install_mysql
|
||||
else
|
||||
Uninstall_mysql
|
||||
fi
|
||||
Executable
+139
@@ -0,0 +1,139 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#!/bin/bash
|
||||
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# https://downloads.mysql.com/archives/community/
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
sysName=`uname`
|
||||
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
myDir=${serverPath}/source/mysql-apt
|
||||
|
||||
bash ${rootPath}/scripts/getos.sh
|
||||
OSNAME=`cat ${rootPath}/data/osname.pl`
|
||||
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
|
||||
# cd /www/server/mdserver-web/plugins/mysql-apt && bash install.sh install 8.0
|
||||
|
||||
# 暂时debian12没有标准版,先用11使用
|
||||
# if [ "$OSNAME" == 'debian' ] && [ "$VERSION_ID" == '12' ] ;then
|
||||
# echo "暂时不支持该${OSNAME}${VERSION_ID}" > $install_tmp
|
||||
# exit 1
|
||||
# fi
|
||||
|
||||
|
||||
ARCH="amd64"
|
||||
TMP_ARCH=`arch`
|
||||
if [ "$TMP_ARCH" == "x86_64" ];then
|
||||
ARCH="amd64"
|
||||
elif [ "$TMP_ARCH" == "aarch64" ];then
|
||||
ARCH="arm64"
|
||||
else
|
||||
ARCH="amd64"
|
||||
fi
|
||||
|
||||
if [ "$ARCH" != "amd64" ];then
|
||||
echo "暂时不支持该${ARCH}" > $install_tmp
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
MYSQL_VER=8.4.2
|
||||
SUFFIX_NAME=${MYSQL_VER}-1${OSNAME}${VERSION_ID}_${ARCH}
|
||||
|
||||
|
||||
# /lib/systemd/system/mysql.service
|
||||
# /etc/mysql/my.cnf
|
||||
|
||||
APT_INSTALL()
|
||||
{
|
||||
########
|
||||
mkdir -p $myDir
|
||||
mkdir -p $serverPath/mysql-apt/bin
|
||||
|
||||
mkdir -p /var/run/mysqld
|
||||
chown mysql -R /var/run/mysqld
|
||||
|
||||
# https://cdn.mysql.com/archives/mysql-8.4/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
|
||||
# https://dev.mysql.com/get/Downloads/MySQL-8.4/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
|
||||
|
||||
wget --no-check-certificate -O ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar https://dev.mysql.com/get/Downloads/MySQL-8.4/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
|
||||
chmod +x ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
|
||||
cd ${myDir} && tar vxf ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
|
||||
|
||||
apt update -y
|
||||
apt install -y libnuma1 libaio1 libmecab2
|
||||
|
||||
# 安装
|
||||
dpkg -X mysql-common_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
|
||||
|
||||
|
||||
|
||||
dpkg -X mysql-community-client-plugins_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
|
||||
dpkg -X mysql-community-client-core_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
|
||||
dpkg -X mysql-community-client_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
|
||||
dpkg -X mysql-client_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
|
||||
|
||||
dpkg -X mysql-community-server-core_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
|
||||
|
||||
dpkg -X mysql-community-server_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
|
||||
dpkg -X mysql-server_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
|
||||
|
||||
# 测试时可关闭
|
||||
rm -rf $myDir
|
||||
#######
|
||||
}
|
||||
|
||||
APT_UNINSTALL()
|
||||
{
|
||||
###
|
||||
rm -rf $myDir
|
||||
# apt remove -y mysql-server
|
||||
###
|
||||
}
|
||||
|
||||
|
||||
Install_mysql()
|
||||
{
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
|
||||
isApt=`which apt`
|
||||
if [ "$isApt" != "" ];then
|
||||
APT_INSTALL
|
||||
fi
|
||||
|
||||
if [ "$?" == "0" ];then
|
||||
mkdir -p $serverPath/mysql-apt
|
||||
echo '8.4' > $serverPath/mysql-apt/version.pl
|
||||
echo '安装完成' >
|
||||
else
|
||||
echo '8.4' > $serverPath/mysql-apt/version.pl
|
||||
echo "暂时不支持该系统"
|
||||
fi
|
||||
}
|
||||
|
||||
Uninstall_mysql()
|
||||
{
|
||||
|
||||
isApt=`which apt`
|
||||
if [ "$isApt" != "" ];then
|
||||
APT_UNINSTALL
|
||||
fi
|
||||
|
||||
rm -rf $serverPath/mysql-apt
|
||||
echo '卸载完成' > $install_tmp
|
||||
}
|
||||
|
||||
action=$1
|
||||
if [ "${1}" == 'install' ];then
|
||||
Install_mysql
|
||||
else
|
||||
Uninstall_mysql
|
||||
fi
|
||||
Executable
+139
@@ -0,0 +1,139 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#!/bin/bash
|
||||
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# https://downloads.mysql.com/archives/community/
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
sysName=`uname`
|
||||
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
myDir=${serverPath}/source/mysql-apt
|
||||
|
||||
bash ${rootPath}/scripts/getos.sh
|
||||
OSNAME=`cat ${rootPath}/data/osname.pl`
|
||||
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
|
||||
# cd /www/server/mdserver-web/plugins/mysql-apt && bash install.sh install 9.0
|
||||
|
||||
# 暂时debian12没有标准版,先用11使用
|
||||
# if [ "$OSNAME" == 'debian' ] && [ "$VERSION_ID" == '12' ] ;then
|
||||
# echo "暂时不支持该${OSNAME}${VERSION_ID}" > $install_tmp
|
||||
# exit 1
|
||||
# fi
|
||||
|
||||
|
||||
ARCH="amd64"
|
||||
TMP_ARCH=`arch`
|
||||
if [ "$TMP_ARCH" == "x86_64" ];then
|
||||
ARCH="amd64"
|
||||
elif [ "$TMP_ARCH" == "aarch64" ];then
|
||||
ARCH="arm64"
|
||||
else
|
||||
ARCH="amd64"
|
||||
fi
|
||||
|
||||
if [ "$ARCH" != "amd64" ];then
|
||||
echo "暂时不支持该${ARCH}" > $install_tmp
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
MYSQL_VER=9.0.1
|
||||
SUFFIX_NAME=${MYSQL_VER}-1${OSNAME}${VERSION_ID}_${ARCH}
|
||||
|
||||
|
||||
# /lib/systemd/system/mysql.service
|
||||
# /etc/mysql/my.cnf
|
||||
|
||||
APT_INSTALL()
|
||||
{
|
||||
########
|
||||
mkdir -p $myDir
|
||||
mkdir -p $serverPath/mysql-apt/bin
|
||||
|
||||
mkdir -p /var/run/mysqld
|
||||
chown mysql -R /var/run/mysqld
|
||||
|
||||
# https://cdn.mysql.com/archives/mysql-8.4/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
|
||||
# https://dev.mysql.com/get/Downloads/MySQL-8.4/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
|
||||
|
||||
wget --no-check-certificate -O ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar https://dev.mysql.com/get/Downloads/MySQL-8.4/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
|
||||
chmod +x ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
|
||||
cd ${myDir} && tar vxf ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar
|
||||
|
||||
apt update -y
|
||||
apt install -y libnuma1 libaio1 libmecab2
|
||||
|
||||
# 安装
|
||||
dpkg -X mysql-common_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
|
||||
|
||||
|
||||
|
||||
dpkg -X mysql-community-client-plugins_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
|
||||
dpkg -X mysql-community-client-core_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
|
||||
dpkg -X mysql-community-client_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
|
||||
dpkg -X mysql-client_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
|
||||
|
||||
dpkg -X mysql-community-server-core_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
|
||||
|
||||
dpkg -X mysql-community-server_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
|
||||
dpkg -X mysql-server_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin
|
||||
|
||||
# 测试时可关闭
|
||||
rm -rf $myDir
|
||||
#######
|
||||
}
|
||||
|
||||
APT_UNINSTALL()
|
||||
{
|
||||
###
|
||||
rm -rf $myDir
|
||||
# apt remove -y mysql-server
|
||||
###
|
||||
}
|
||||
|
||||
|
||||
Install_mysql()
|
||||
{
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
|
||||
isApt=`which apt`
|
||||
if [ "$isApt" != "" ];then
|
||||
APT_INSTALL
|
||||
fi
|
||||
|
||||
if [ "$?" == "0" ];then
|
||||
mkdir -p $serverPath/mysql-apt
|
||||
echo '9.0' > $serverPath/mysql-apt/version.pl
|
||||
echo '安装完成'
|
||||
else
|
||||
echo '9.0' > $serverPath/mysql-apt/version.pl
|
||||
echo "暂时不支持该系统"
|
||||
fi
|
||||
}
|
||||
|
||||
Uninstall_mysql()
|
||||
{
|
||||
|
||||
isApt=`which apt`
|
||||
if [ "$isApt" != "" ];then
|
||||
APT_UNINSTALL
|
||||
fi
|
||||
|
||||
rm -rf $serverPath/mysql-apt
|
||||
echo '卸载完成'
|
||||
}
|
||||
|
||||
action=$1
|
||||
if [ "${1}" == 'install' ];then
|
||||
Install_mysql
|
||||
else
|
||||
Uninstall_mysql
|
||||
fi
|
||||
@@ -17,7 +17,6 @@ socket = {$SERVER_APP_PATH}/mysql.sock
|
||||
datadir = {$SERVER_APP_PATH}/data
|
||||
log-error = {$SERVER_APP_PATH}/data/error.log
|
||||
server-id = {$SERVER_ID}
|
||||
sql-mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
|
||||
|
||||
default_storage_engine = InnoDB
|
||||
|
||||
@@ -45,7 +44,6 @@ max_allowed_packet = 128M
|
||||
#skip-name-resolve
|
||||
|
||||
log-bin=mysql-bin
|
||||
binlog_format=mixed
|
||||
slow_query_log=1
|
||||
slow-query-log-file={$SERVER_APP_PATH}/data/mysql-slow.log
|
||||
long_query_time=3
|
||||
@@ -66,15 +64,12 @@ binlog-ignore-db = performance_schema
|
||||
#slave
|
||||
log_replica_updates
|
||||
#replicate-do-db
|
||||
slave_skip_errors=1062,1396
|
||||
replica_skip_errors=1062,1396
|
||||
replicate-ignore-db = information_schema
|
||||
replicate-ignore-db = performance_schema
|
||||
replicate-ignore-db = mysql
|
||||
replicate-ignore-db = test
|
||||
|
||||
master_info_repository = table
|
||||
relay_log_info_repository = table
|
||||
|
||||
default_storage_engine = InnoDB
|
||||
innodb_data_home_dir = {$SERVER_APP_PATH}/data
|
||||
innodb_data_file_path = ibdata1:10M:autoextend
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
[client]
|
||||
user = root
|
||||
#password = your_password
|
||||
port = 33206
|
||||
socket = {$SERVER_APP_PATH}/mysql.sock
|
||||
default-character-set = UTF8MB4
|
||||
|
||||
[mysqld]
|
||||
!include {$SERVER_APP_PATH}/etc/mode/classic.cnf
|
||||
|
||||
authentication_policy=caching_sha2_password
|
||||
pid-file = {$SERVER_APP_PATH}/data/mysql.pid
|
||||
user = mysql
|
||||
port = 33206
|
||||
mysqlx_port = 33260
|
||||
socket = {$SERVER_APP_PATH}/mysql.sock
|
||||
datadir = {$SERVER_APP_PATH}/data
|
||||
log-error = {$SERVER_APP_PATH}/data/error.log
|
||||
server-id = {$SERVER_ID}
|
||||
sql-mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
|
||||
|
||||
default_storage_engine = InnoDB
|
||||
|
||||
key_buffer_size = 8M
|
||||
table_open_cache = 32
|
||||
sort_buffer_size = 256K
|
||||
net_buffer_length = 4K
|
||||
read_buffer_size = 128K
|
||||
read_rnd_buffer_size = 256K
|
||||
myisam_sort_buffer_size = 4M
|
||||
thread_cache_size = 4
|
||||
lower_case_table_names=1
|
||||
tmp_table_size = 8M
|
||||
character-set-server = UTF8MB4
|
||||
|
||||
max_connections = 500
|
||||
max_connect_errors = 100
|
||||
open_files_limit = 2560
|
||||
max_allowed_packet = 128M
|
||||
|
||||
#skip-external-locking
|
||||
#skip-grant-tables
|
||||
#loose-skip-innodb
|
||||
#skip-networking
|
||||
#skip-name-resolve
|
||||
|
||||
log-bin=mysql-bin
|
||||
slow_query_log=1
|
||||
slow-query-log-file={$SERVER_APP_PATH}/data/mysql-slow.log
|
||||
long_query_time=3
|
||||
#log_queries_not_using_indexes=on
|
||||
|
||||
relay-log=mdserver
|
||||
relay-log-index=mdserver
|
||||
|
||||
#master
|
||||
#binlog-do-db
|
||||
#sync_binlog=1
|
||||
|
||||
binlog-ignore-db = test
|
||||
binlog-ignore-db = mysql
|
||||
binlog-ignore-db = information_schema
|
||||
binlog-ignore-db = performance_schema
|
||||
|
||||
#slave
|
||||
log_replica_updates
|
||||
#replicate-do-db
|
||||
replica_skip_errors=1062,1396
|
||||
replicate-ignore-db = information_schema
|
||||
replicate-ignore-db = performance_schema
|
||||
replicate-ignore-db = mysql
|
||||
replicate-ignore-db = test
|
||||
|
||||
|
||||
default_storage_engine = InnoDB
|
||||
innodb_data_home_dir = {$SERVER_APP_PATH}/data
|
||||
innodb_data_file_path = ibdata1:10M:autoextend
|
||||
innodb_log_group_home_dir = {$SERVER_APP_PATH}/data
|
||||
innodb_buffer_pool_size = 16M
|
||||
innodb_redo_log_capacity=10485760
|
||||
innodb_log_buffer_size = 8M
|
||||
innodb_flush_log_at_trx_commit = 1
|
||||
innodb_lock_wait_timeout = 120
|
||||
innodb_max_dirty_pages_pct = 90
|
||||
innodb_read_io_threads = 1
|
||||
innodb_write_io_threads = 1
|
||||
innodb_file_per_table=1
|
||||
binlog_expire_logs_seconds=2592000
|
||||
|
||||
secure-file-priv={$SERVER_APP_PATH}/tmp
|
||||
|
||||
[mysqldump]
|
||||
quick
|
||||
|
||||
[mysql]
|
||||
no-auto-rehash
|
||||
|
||||
[myisamchk]
|
||||
key_buffer_size = 20M
|
||||
sort_buffer_size = 20M
|
||||
read_buffer = 2M
|
||||
write_buffer = 2M
|
||||
|
||||
[mysqlhotcopy]
|
||||
interactive-timeout
|
||||
@@ -0,0 +1,105 @@
|
||||
[client]
|
||||
user = root
|
||||
#password = your_password
|
||||
port = 33206
|
||||
socket = {$SERVER_APP_PATH}/mysql.sock
|
||||
default-character-set = UTF8MB4
|
||||
|
||||
[mysqld]
|
||||
!include {$SERVER_APP_PATH}/etc/mode/classic.cnf
|
||||
|
||||
authentication_policy=caching_sha2_password
|
||||
pid-file = {$SERVER_APP_PATH}/data/mysql.pid
|
||||
user = mysql
|
||||
port = 33206
|
||||
mysqlx_port = 33260
|
||||
socket = {$SERVER_APP_PATH}/mysql.sock
|
||||
datadir = {$SERVER_APP_PATH}/data
|
||||
log-error = {$SERVER_APP_PATH}/data/error.log
|
||||
server-id = {$SERVER_ID}
|
||||
sql-mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
|
||||
|
||||
default_storage_engine = InnoDB
|
||||
|
||||
key_buffer_size = 8M
|
||||
table_open_cache = 32
|
||||
sort_buffer_size = 256K
|
||||
net_buffer_length = 4K
|
||||
read_buffer_size = 128K
|
||||
read_rnd_buffer_size = 256K
|
||||
myisam_sort_buffer_size = 4M
|
||||
thread_cache_size = 4
|
||||
lower_case_table_names=1
|
||||
tmp_table_size = 8M
|
||||
character-set-server = UTF8MB4
|
||||
|
||||
max_connections = 500
|
||||
max_connect_errors = 100
|
||||
open_files_limit = 2560
|
||||
max_allowed_packet = 128M
|
||||
|
||||
#skip-external-locking
|
||||
#skip-grant-tables
|
||||
#loose-skip-innodb
|
||||
#skip-networking
|
||||
#skip-name-resolve
|
||||
|
||||
log-bin=mysql-bin
|
||||
slow_query_log=1
|
||||
slow-query-log-file={$SERVER_APP_PATH}/data/mysql-slow.log
|
||||
long_query_time=3
|
||||
#log_queries_not_using_indexes=on
|
||||
|
||||
relay-log=mdserver
|
||||
relay-log-index=mdserver
|
||||
|
||||
#master
|
||||
#binlog-do-db
|
||||
#sync_binlog=1
|
||||
|
||||
binlog-ignore-db = test
|
||||
binlog-ignore-db = mysql
|
||||
binlog-ignore-db = information_schema
|
||||
binlog-ignore-db = performance_schema
|
||||
|
||||
#slave
|
||||
log_replica_updates
|
||||
#replicate-do-db
|
||||
replica_skip_errors=1062,1396
|
||||
replicate-ignore-db = information_schema
|
||||
replicate-ignore-db = performance_schema
|
||||
replicate-ignore-db = mysql
|
||||
replicate-ignore-db = test
|
||||
|
||||
|
||||
default_storage_engine = InnoDB
|
||||
innodb_data_home_dir = {$SERVER_APP_PATH}/data
|
||||
innodb_data_file_path = ibdata1:10M:autoextend
|
||||
innodb_log_group_home_dir = {$SERVER_APP_PATH}/data
|
||||
innodb_buffer_pool_size = 16M
|
||||
innodb_redo_log_capacity=10485760
|
||||
innodb_log_buffer_size = 8M
|
||||
innodb_flush_log_at_trx_commit = 1
|
||||
innodb_lock_wait_timeout = 120
|
||||
innodb_max_dirty_pages_pct = 90
|
||||
innodb_read_io_threads = 1
|
||||
innodb_write_io_threads = 1
|
||||
innodb_file_per_table=1
|
||||
binlog_expire_logs_seconds=2592000
|
||||
|
||||
secure-file-priv={$SERVER_APP_PATH}/tmp
|
||||
|
||||
[mysqldump]
|
||||
quick
|
||||
|
||||
[mysql]
|
||||
no-auto-rehash
|
||||
|
||||
[myisamchk]
|
||||
key_buffer_size = 20M
|
||||
sort_buffer_size = 20M
|
||||
read_buffer = 2M
|
||||
write_buffer = 2M
|
||||
|
||||
[mysqlhotcopy]
|
||||
interactive-timeout
|
||||
@@ -0,0 +1,104 @@
|
||||
[client]
|
||||
user = root
|
||||
#password = your_password
|
||||
port = 33206
|
||||
socket = {$SERVER_APP_PATH}/mysql.sock
|
||||
default-character-set = UTF8MB4
|
||||
|
||||
[mysqld]
|
||||
!include {$SERVER_APP_PATH}/etc/mode/classic.cnf
|
||||
#mysql_native_password=ON
|
||||
authentication_policy=caching_sha2_password
|
||||
pid-file = {$SERVER_APP_PATH}/data/mysql.pid
|
||||
user = mysql
|
||||
port = 33206
|
||||
#mysqlx_port = 33260
|
||||
socket = {$SERVER_APP_PATH}/mysql.sock
|
||||
datadir = {$SERVER_APP_PATH}/data
|
||||
log-error = {$SERVER_APP_PATH}/data/error.log
|
||||
server-id = {$SERVER_ID}
|
||||
|
||||
default_storage_engine = InnoDB
|
||||
|
||||
key_buffer_size = 8M
|
||||
table_open_cache = 32
|
||||
sort_buffer_size = 256K
|
||||
net_buffer_length = 4K
|
||||
read_buffer_size = 128K
|
||||
read_rnd_buffer_size = 256K
|
||||
myisam_sort_buffer_size = 4M
|
||||
thread_cache_size = 4
|
||||
lower_case_table_names=1
|
||||
tmp_table_size = 8M
|
||||
character-set-server = UTF8MB4
|
||||
|
||||
max_connections = 500
|
||||
max_connect_errors = 100
|
||||
open_files_limit = 2560
|
||||
max_allowed_packet = 128M
|
||||
|
||||
#skip-external-locking
|
||||
#skip-grant-tables
|
||||
#loose-skip-innodb
|
||||
#skip-networking
|
||||
#skip-name-resolve
|
||||
|
||||
log-bin=mysql-bin
|
||||
slow_query_log=1
|
||||
slow-query-log-file={$SERVER_APP_PATH}/data/mysql-slow.log
|
||||
long_query_time=3
|
||||
#log_queries_not_using_indexes=on
|
||||
|
||||
relay-log=mdserver
|
||||
relay-log-index=mdserver
|
||||
|
||||
#master
|
||||
#binlog-do-db
|
||||
#sync_binlog=1
|
||||
|
||||
binlog-ignore-db = test
|
||||
binlog-ignore-db = mysql
|
||||
binlog-ignore-db = information_schema
|
||||
binlog-ignore-db = performance_schema
|
||||
|
||||
#slave
|
||||
log_replica_updates
|
||||
#replicate-do-db
|
||||
replica_skip_errors=1062,1396
|
||||
replicate-ignore-db = information_schema
|
||||
replicate-ignore-db = performance_schema
|
||||
replicate-ignore-db = mysql
|
||||
replicate-ignore-db = test
|
||||
|
||||
|
||||
default_storage_engine = InnoDB
|
||||
innodb_data_home_dir = {$SERVER_APP_PATH}/data
|
||||
innodb_data_file_path = ibdata1:10M:autoextend
|
||||
innodb_log_group_home_dir = {$SERVER_APP_PATH}/data
|
||||
innodb_buffer_pool_size = 16M
|
||||
innodb_redo_log_capacity=10485760
|
||||
innodb_log_buffer_size = 8M
|
||||
innodb_flush_log_at_trx_commit = 1
|
||||
innodb_lock_wait_timeout = 120
|
||||
innodb_max_dirty_pages_pct = 90
|
||||
innodb_read_io_threads = 1
|
||||
innodb_write_io_threads = 1
|
||||
innodb_file_per_table=1
|
||||
binlog_expire_logs_seconds=2592000
|
||||
|
||||
secure-file-priv={$SERVER_APP_PATH}/tmp
|
||||
|
||||
[mysqldump]
|
||||
quick
|
||||
|
||||
[mysql]
|
||||
no-auto-rehash
|
||||
|
||||
[myisamchk]
|
||||
key_buffer_size = 20M
|
||||
sort_buffer_size = 20M
|
||||
read_buffer = 2M
|
||||
write_buffer = 2M
|
||||
|
||||
[mysqlhotcopy]
|
||||
interactive-timeout
|
||||
@@ -0,0 +1,104 @@
|
||||
[client]
|
||||
user = root
|
||||
#password = your_password
|
||||
port = 33206
|
||||
socket = {$SERVER_APP_PATH}/mysql.sock
|
||||
default-character-set = UTF8MB4
|
||||
|
||||
[mysqld]
|
||||
!include {$SERVER_APP_PATH}/etc/mode/classic.cnf
|
||||
#mysql_native_password=ON
|
||||
authentication_policy=caching_sha2_password
|
||||
pid-file = {$SERVER_APP_PATH}/data/mysql.pid
|
||||
user = mysql
|
||||
port = 33206
|
||||
#mysqlx_port = 33260
|
||||
socket = {$SERVER_APP_PATH}/mysql.sock
|
||||
datadir = {$SERVER_APP_PATH}/data
|
||||
log-error = {$SERVER_APP_PATH}/data/error.log
|
||||
server-id = {$SERVER_ID}
|
||||
|
||||
default_storage_engine = InnoDB
|
||||
|
||||
key_buffer_size = 8M
|
||||
table_open_cache = 32
|
||||
sort_buffer_size = 256K
|
||||
net_buffer_length = 4K
|
||||
read_buffer_size = 128K
|
||||
read_rnd_buffer_size = 256K
|
||||
myisam_sort_buffer_size = 4M
|
||||
thread_cache_size = 4
|
||||
lower_case_table_names=1
|
||||
tmp_table_size = 8M
|
||||
character-set-server = UTF8MB4
|
||||
|
||||
max_connections = 500
|
||||
max_connect_errors = 100
|
||||
open_files_limit = 2560
|
||||
max_allowed_packet = 128M
|
||||
|
||||
#skip-external-locking
|
||||
#skip-grant-tables
|
||||
#loose-skip-innodb
|
||||
#skip-networking
|
||||
#skip-name-resolve
|
||||
|
||||
log-bin=mysql-bin
|
||||
slow_query_log=1
|
||||
slow-query-log-file={$SERVER_APP_PATH}/data/mysql-slow.log
|
||||
long_query_time=3
|
||||
#log_queries_not_using_indexes=on
|
||||
|
||||
relay-log=mdserver
|
||||
relay-log-index=mdserver
|
||||
|
||||
#master
|
||||
#binlog-do-db
|
||||
#sync_binlog=1
|
||||
|
||||
binlog-ignore-db = test
|
||||
binlog-ignore-db = mysql
|
||||
binlog-ignore-db = information_schema
|
||||
binlog-ignore-db = performance_schema
|
||||
|
||||
#slave
|
||||
log_replica_updates
|
||||
#replicate-do-db
|
||||
replica_skip_errors=1062,1396
|
||||
replicate-ignore-db = information_schema
|
||||
replicate-ignore-db = performance_schema
|
||||
replicate-ignore-db = mysql
|
||||
replicate-ignore-db = test
|
||||
|
||||
|
||||
default_storage_engine = InnoDB
|
||||
innodb_data_home_dir = {$SERVER_APP_PATH}/data
|
||||
innodb_data_file_path = ibdata1:10M:autoextend
|
||||
innodb_log_group_home_dir = {$SERVER_APP_PATH}/data
|
||||
innodb_buffer_pool_size = 16M
|
||||
innodb_redo_log_capacity=10485760
|
||||
innodb_log_buffer_size = 8M
|
||||
innodb_flush_log_at_trx_commit = 1
|
||||
innodb_lock_wait_timeout = 120
|
||||
innodb_max_dirty_pages_pct = 90
|
||||
innodb_read_io_threads = 1
|
||||
innodb_write_io_threads = 1
|
||||
innodb_file_per_table=1
|
||||
binlog_expire_logs_seconds=2592000
|
||||
|
||||
secure-file-priv={$SERVER_APP_PATH}/tmp
|
||||
|
||||
[mysqldump]
|
||||
quick
|
||||
|
||||
[mysql]
|
||||
no-auto-rehash
|
||||
|
||||
[myisamchk]
|
||||
key_buffer_size = 20M
|
||||
sort_buffer_size = 20M
|
||||
read_buffer = 2M
|
||||
write_buffer = 2M
|
||||
|
||||
[mysqlhotcopy]
|
||||
interactive-timeout
|
||||
@@ -50,7 +50,9 @@ CREATE TABLE IF NOT EXISTS `slave_sync_user` (
|
||||
`pass` TEXT,
|
||||
`mode` TEXT,
|
||||
`cmd` TEXT,
|
||||
`db` TEXT,
|
||||
`addtime` TEXT
|
||||
);
|
||||
ALTER TABLE `slave_sync_user` ADD COLUMN `db` TEXT DEFAULT '';
|
||||
|
||||
|
||||
|
||||
+635
-92
@@ -125,7 +125,12 @@ def getSocketFile():
|
||||
content = mw.readFile(file)
|
||||
rep = 'socket\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0].strip()
|
||||
socket = tmp.groups()[0].strip()
|
||||
|
||||
_socket = socket+'.sock'
|
||||
if os.path.exists(_socket):
|
||||
return _socket
|
||||
return socket
|
||||
|
||||
|
||||
def getErrorLogsFile():
|
||||
@@ -149,8 +154,7 @@ def contentReplace(content):
|
||||
service_path = mw.getServerDir()
|
||||
content = content.replace('{$ROOT_PATH}', mw.getRootDir())
|
||||
content = content.replace('{$SERVER_PATH}', service_path)
|
||||
content = content.replace('{$SERVER_APP_PATH}',
|
||||
service_path + '/' + getPluginName())
|
||||
content = content.replace('{$SERVER_APP_PATH}',service_path + '/' + getPluginName())
|
||||
|
||||
server_id = int(time.time())
|
||||
content = content.replace('{$SERVER_ID}', str(server_id))
|
||||
@@ -241,17 +245,23 @@ def initDreplace(version=''):
|
||||
systemDir = mw.systemdCfgDir()
|
||||
systemService = systemDir + '/mysql-yum.service'
|
||||
systemServiceTpl = getPluginDir() + '/init.d/mysql' + version + '.service.tpl'
|
||||
if os.path.exists(systemDir) and not os.path.exists(systemService):
|
||||
service_path = mw.getServerDir()
|
||||
se_content = mw.readFile(systemServiceTpl)
|
||||
se_content = se_content.replace('{$SERVER_PATH}', service_path)
|
||||
mw.writeFile(systemService, se_content)
|
||||
mw.execShell('systemctl daemon-reload')
|
||||
# if os.path.exists(systemDir) and not os.path.exists(systemService):
|
||||
service_path = mw.getServerDir()
|
||||
content = mw.readFile(systemServiceTpl)
|
||||
content = content.replace('{$SERVER_PATH}', service_path)
|
||||
mw.writeFile(systemService, content)
|
||||
mw.execShell('systemctl daemon-reload')
|
||||
|
||||
if mw.getOs() != 'darwin':
|
||||
mw.execShell('chown -R mysql mysql ' + getServerDir())
|
||||
return 'ok'
|
||||
|
||||
def process_status():
|
||||
cmd = "ps -ef|grep mysql-yum | grep mysql |grep -v grep | grep -v python | awk '{print $2}'"
|
||||
data = mw.execShell(cmd)
|
||||
if data[0] == '':
|
||||
return 'stop'
|
||||
return 'start'
|
||||
|
||||
def status(version=''):
|
||||
pid = getPidFile()
|
||||
@@ -260,7 +270,7 @@ def status(version=''):
|
||||
return 'start'
|
||||
|
||||
|
||||
def binLog():
|
||||
def binLog(version=''):
|
||||
args = getArgs()
|
||||
conf = getConf()
|
||||
con = mw.readFile(conf)
|
||||
@@ -271,7 +281,7 @@ def binLog():
|
||||
con = con.replace('#log-bin=mysql-bin', 'log-bin=mysql-bin')
|
||||
con = con.replace('#binlog_format=mixed', 'binlog_format=mixed')
|
||||
mw.execShell('sync')
|
||||
restart()
|
||||
restart(version)
|
||||
else:
|
||||
path = getDataDir()
|
||||
if 'status' in args:
|
||||
@@ -285,7 +295,7 @@ def binLog():
|
||||
con = con.replace('log-bin=mysql-bin', '#log-bin=mysql-bin')
|
||||
con = con.replace('binlog_format=mixed', '#binlog_format=mixed')
|
||||
mw.execShell('sync')
|
||||
restart()
|
||||
restart(version)
|
||||
mw.execShell('rm -f ' + path + '/mysql-bin.*')
|
||||
|
||||
mw.writeFile(conf, con)
|
||||
@@ -379,6 +389,8 @@ def getShowLogFile():
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
def getMdb8Ver():
|
||||
return ['8.0','8.1','8.2','8.3','8.4','9.0']
|
||||
|
||||
def pGetDbUser():
|
||||
if mw.isAppleSystem():
|
||||
@@ -413,7 +425,8 @@ def initMysql8Data():
|
||||
user = pGetDbUser()
|
||||
cmd = serverdir + '/bin/usr/sbin/mysqld --basedir=' + serverdir + '/bin/usr --datadir=' + \
|
||||
datadir + ' --initialize-insecure --lower-case-table-names=1'
|
||||
mw.execShell(cmd)
|
||||
data = mw.execShell(cmd)
|
||||
# print(data)
|
||||
|
||||
if not mw.isAppleSystem():
|
||||
mw.execShell('chown -R mysql:mysql ' + datadir)
|
||||
@@ -442,7 +455,6 @@ def yumLibFix():
|
||||
makeLib64SoftLink('libtinfo')
|
||||
|
||||
def initMysql8Pwd():
|
||||
yumLibFix()
|
||||
'''
|
||||
/usr/bin/mysql --defaults-file=/www/server/mysql-apt/etc/my.cnf -uroot -e"UPDATE mysql.user SET password=PASSWORD('BhIroUczczNVaKvw') WHERE user='root';flush privileges;"
|
||||
/usr/bin/mysql --defaults-file=/www/server/mysql-apt/etc/my.cnf -uroot -e"alter user 'root'@'localhost' identified by '123456';"
|
||||
@@ -496,19 +508,46 @@ def initMysql8Pwd():
|
||||
def my8cmd(version, method):
|
||||
initDreplace(version)
|
||||
# mysql 8.0 and 5.7
|
||||
|
||||
mdb8 = getMdb8Ver()
|
||||
try:
|
||||
isInited = True
|
||||
if version == '5.7':
|
||||
isInited = initMysql57Data()
|
||||
elif version == '8.0':
|
||||
if mw.inArray(mdb8, version):
|
||||
isInited = initMysql8Data()
|
||||
else:
|
||||
isInited = initMysql57Data()
|
||||
|
||||
if not isInited:
|
||||
mw.execShell('systemctl start ' + getPluginName())
|
||||
initMysql8Pwd()
|
||||
mw.execShell('systemctl stop ' + getPluginName())
|
||||
if not mw.isSupportSystemctl():
|
||||
cmd_init_start = init_file + ' start'
|
||||
subprocess.Popen(cmd_init_start, stdout=subprocess.PIPE, shell=True,
|
||||
bufsize=4096, stderr=subprocess.PIPE)
|
||||
|
||||
mw.execShell('systemctl ' + method + ' ' + getPluginName())
|
||||
time.sleep(6)
|
||||
else:
|
||||
mw.execShell('systemctl start '+getPluginName())
|
||||
|
||||
for x in range(10):
|
||||
mydb_status = process_status()
|
||||
if mydb_status == 'start':
|
||||
initMysql8Pwd()
|
||||
break
|
||||
time.sleep(1)
|
||||
|
||||
if not mw.isSupportSystemctl():
|
||||
cmd_init_stop = init_file + ' stop'
|
||||
subprocess.Popen(cmd_init_stop, stdout=subprocess.PIPE, shell=True,
|
||||
bufsize=4096, stderr=subprocess.PIPE)
|
||||
time.sleep(3)
|
||||
else:
|
||||
mw.execShell('systemctl stop ' + getPluginName())
|
||||
|
||||
if not mw.isSupportSystemctl():
|
||||
sub = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True,
|
||||
bufsize=4096, stderr=subprocess.PIPE)
|
||||
sub.wait(5)
|
||||
else:
|
||||
mw.execShell('systemctl ' + method + ' ' + getPluginName())
|
||||
return 'ok'
|
||||
except Exception as e:
|
||||
return str(e)
|
||||
@@ -601,8 +640,8 @@ def setMyDbPos(version=''):
|
||||
mw.writeFile(myfile, mycnf)
|
||||
restart(version)
|
||||
|
||||
result = mw.execShell(
|
||||
'ps aux|grep "mysql-apt/bin/usr/sbin/mysqld"| grep -v grep|grep -v python')
|
||||
cmd = 'ps aux|grep "mysql-yum/bin/usr/sbin/mysqld"| grep -v grep|grep -v python'
|
||||
result = mw.execShell(cmd)
|
||||
if len(result[0]) > 10:
|
||||
mw.writeFile('data/datadir.pl', t_datadir)
|
||||
return mw.returnJson(True, '存储目录迁移成功!')
|
||||
@@ -869,6 +908,80 @@ def importDbExternal():
|
||||
|
||||
return mw.returnJson(True, 'ok')
|
||||
|
||||
def importDbExternalProgress():
|
||||
args = getArgs()
|
||||
data = checkArgs(args, ['file', 'name'])
|
||||
if not data[0]:
|
||||
return data[1]
|
||||
|
||||
file = args['file']
|
||||
name = args['name']
|
||||
|
||||
cmd = 'cd '+mw.getServerDir()+'/mdserver-web && source bin/activate && '
|
||||
cmd += 'python3 '+mw.getServerDir()+'/mdserver-web/plugins/mysql-yum/index.py import_db_external_progress_bar {"file":"'+file+'","name":"'+name+'"}'
|
||||
return mw.returnJson(True, 'ok',cmd)
|
||||
|
||||
def importDbExternalProgressBar():
|
||||
args = getArgs()
|
||||
data = checkArgs(args, ['file', 'name'])
|
||||
if not data[0]:
|
||||
return data[1]
|
||||
|
||||
file = args['file']
|
||||
name = args['name']
|
||||
|
||||
import_dir = mw.getRootDir() + '/backup/import/'
|
||||
|
||||
file_path = import_dir + file
|
||||
if not os.path.exists(file_path):
|
||||
return mw.returnJson(False, '文件突然消失?')
|
||||
|
||||
exts = ['sql', 'gz', 'zip']
|
||||
ext = mw.getFileSuffix(file)
|
||||
if ext not in exts:
|
||||
return mw.returnJson(False, '导入数据库格式不对!')
|
||||
|
||||
tmp = file.split('/')
|
||||
tmpFile = tmp[len(tmp) - 1]
|
||||
tmpFile = tmpFile.replace('.sql.' + ext, '.sql')
|
||||
tmpFile = tmpFile.replace('.' + ext, '.sql')
|
||||
tmpFile = tmpFile.replace('tar.', '')
|
||||
|
||||
# print(tmpFile)
|
||||
import_sql = ""
|
||||
if file.find("sql.gz") > -1:
|
||||
cmd = 'cd ' + import_dir + ' && gzip -dc ' + \
|
||||
file + " > " + import_dir + tmpFile
|
||||
info = mw.execShell(cmd)
|
||||
if info[1] == "":
|
||||
import_sql = import_dir + tmpFile
|
||||
|
||||
if file.find(".zip") > -1:
|
||||
cmd = 'cd ' + import_dir + ' && unzip -o ' + file
|
||||
mw.execShell(cmd)
|
||||
import_sql = import_dir + tmpFile
|
||||
|
||||
if file.find("tar.gz") > -1:
|
||||
cmd = 'cd ' + import_dir + ' && tar -zxvf ' + file
|
||||
mw.execShell(cmd)
|
||||
import_sql = import_dir + tmpFile
|
||||
|
||||
if file.find(".sql") > -1 and file.find(".sql.gz") == -1:
|
||||
import_sql = import_dir + file
|
||||
|
||||
if import_sql == "":
|
||||
return mw.returnJson(False, '未找SQL文件')
|
||||
|
||||
pwd = pSqliteDb('config').where('id=?', (1,)).getField('mysql_root')
|
||||
sock = getSocketFile()
|
||||
|
||||
my_cnf = getConf()
|
||||
mysql_cmd = getServerDir() + '/bin/usr/bin/mysql --defaults-file=' + my_cnf + \
|
||||
' -uroot -p"' + pwd + '" -f ' + name
|
||||
mysql_cmd_progress_bar = "pv -t -p " + import_sql + '|'+ mysql_cmd
|
||||
print(mysql_cmd_progress_bar)
|
||||
rdata = os.system(mysql_cmd_progress_bar)
|
||||
return ""
|
||||
|
||||
def importDbBackup():
|
||||
args = getArgs()
|
||||
@@ -1239,7 +1352,7 @@ def addDb():
|
||||
reg = "^[\w-]+$"
|
||||
if not re.match(reg, args['name']):
|
||||
return mw.returnJson(False, '数据库名称不能带有特殊符号!')
|
||||
checks = ['root', 'mysql', 'test', 'sys', 'panel_logs']
|
||||
checks = ['root', 'mysql', 'test', 'sys', 'performance_schema','information_schema']
|
||||
if dbuser in checks or len(dbuser) < 1:
|
||||
return mw.returnJson(False, '数据库用户名不合法!')
|
||||
if dbname in checks or len(dbname) < 1:
|
||||
@@ -1388,7 +1501,8 @@ def resetDbRootPwd(version):
|
||||
|
||||
pSqliteDb('config').where('id=?', (1,)).save('mysql_root', (pwd,))
|
||||
|
||||
if float(version) < 5.7:
|
||||
mdb8 = getMdb8Ver()
|
||||
if not mw.inArray(mdb8, version):
|
||||
cmd_pass = serverdir + '/bin/usr/bin/mysql --defaults-file=' + myconf + ' -uroot -e'
|
||||
cmd_pass = cmd_pass + '"UPDATE mysql.user SET password=PASSWORD(\'' + pwd + "') WHERE user='root';"
|
||||
cmd_pass = cmd_pass + 'flush privileges;"'
|
||||
@@ -1881,9 +1995,17 @@ def setDbSlave(version):
|
||||
|
||||
def getMasterStatus(version=''):
|
||||
|
||||
if status(version) == 'stop':
|
||||
return mw.returnJson(False, 'MySQL未启动,或正在启动中...!', [])
|
||||
|
||||
query_status_cmd = 'show slave status'
|
||||
mdb8 = getMdb8Ver()
|
||||
is_mdb8 = False
|
||||
if mw.inArray(mdb8, version):
|
||||
is_mdb8 = True
|
||||
query_status_cmd = 'show replica status'
|
||||
|
||||
try:
|
||||
if status(version) == 'stop':
|
||||
return mw.returnJson(False, 'MySQL未启动,或正在启动中...!', [])
|
||||
|
||||
conf = getConf()
|
||||
content = mw.readFile(conf)
|
||||
@@ -1898,15 +2020,20 @@ def getMasterStatus(version=''):
|
||||
data['status'] = master_status
|
||||
|
||||
db = pMysqlDb()
|
||||
dlist = db.query('show slave status')
|
||||
dlist = db.query(query_status_cmd)
|
||||
|
||||
# print(dlist[0])
|
||||
if len(dlist) > 0 and (dlist[0]["Slave_IO_Running"] == 'Yes' or dlist[0]["Slave_SQL_Running"] == 'Yes'):
|
||||
data['slave_status'] = True
|
||||
if is_mdb8:
|
||||
if len(dlist) > 0 and (dlist[0]["Replica_IO_Running"] == 'Yes' or dlist[0]["Replica_SQL_Running"] == 'Yes'):
|
||||
data['slave_status'] = True
|
||||
else:
|
||||
if len(dlist) > 0 and (dlist[0]["Slave_IO_Running"] == 'Yes' or dlist[0]["Slave_SQL_Running"] == 'Yes'):
|
||||
data['slave_status'] = True
|
||||
|
||||
return mw.returnJson(master_status, '设置成功', data)
|
||||
except Exception as e:
|
||||
return mw.returnJson(False, "数据库密码错误,在管理列表-点击【修复】!", 'pwd')
|
||||
mw.getTracebackInfo()
|
||||
return mw.returnJson(False, "数据库密码错误,在管理列表-点击【修复】,"+str(e), 'pwd')
|
||||
|
||||
|
||||
def setMasterStatus(version=''):
|
||||
@@ -1979,21 +2106,17 @@ def addMasterRepSlaveUser(version=''):
|
||||
if not data[0]:
|
||||
return data[1]
|
||||
|
||||
if not 'address' in args:
|
||||
address = ''
|
||||
else:
|
||||
address = ''
|
||||
if 'address' in args:
|
||||
address = args['address'].strip()
|
||||
|
||||
username = args['username'].strip()
|
||||
password = args['password'].strip()
|
||||
# ps = args['ps'].strip()
|
||||
# address = args['address'].strip()
|
||||
# dataAccess = args['dataAccess'].strip()
|
||||
|
||||
reg = "^[\w-]+$"
|
||||
if not re.match(reg, username):
|
||||
return mw.returnJson(False, '用户名不能带有特殊符号!')
|
||||
checks = ['root', 'mysql', 'test', 'sys', 'panel_logs']
|
||||
checks = ['root', 'mysql', 'test', 'sys', 'performance_schema','information_schema']
|
||||
if username in checks or len(username) < 1:
|
||||
return mw.returnJson(False, '用户名不合法!')
|
||||
if password in checks or len(password) < 1:
|
||||
@@ -2005,14 +2128,13 @@ def addMasterRepSlaveUser(version=''):
|
||||
pdb = pMysqlDb()
|
||||
psdb = pSqliteDb('master_replication_user')
|
||||
|
||||
auth_policy = getAuthPolicy()
|
||||
|
||||
if psdb.where("username=?", (username)).count() > 0:
|
||||
return mw.returnJson(False, '用户已存在!')
|
||||
|
||||
if version == "8.0":
|
||||
mdb8 = ['8.0','8.1','8.2','8.3','8.4']
|
||||
if mw.inArray(mdb8,version):
|
||||
sql = "CREATE USER '" + username + \
|
||||
"' IDENTIFIED WITH "+auth_policy+" BY '" + password + "';"
|
||||
"' IDENTIFIED WITH mysql_native_password BY '" + password + "';"
|
||||
pdb.execute(sql)
|
||||
sql = "grant replication slave on *.* to '" + username + "'@'%';"
|
||||
result = pdb.execute(sql)
|
||||
@@ -2028,13 +2150,12 @@ def addMasterRepSlaveUser(version=''):
|
||||
if isError != None:
|
||||
return isError
|
||||
|
||||
sql_select = "grant select,lock tables,PROCESS on *.* to " + username + "@'%';"
|
||||
sql_select = "grant select,reload,REPLICATION CLIENT,PROCESS on *.* to " + username + "@'%';"
|
||||
pdb.execute(sql_select)
|
||||
pdb.execute('FLUSH PRIVILEGES;')
|
||||
|
||||
addTime = time.strftime('%Y-%m-%d %X', time.localtime())
|
||||
psdb.add('username,password,accept,ps,addtime',
|
||||
(username, password, '%', '', addTime))
|
||||
psdb.add('username,password,accept,ps,addtime',(username, password, '%', '', addTime))
|
||||
return mw.returnJson(True, '添加成功!')
|
||||
|
||||
|
||||
@@ -2071,31 +2192,31 @@ def getMasterRepSlaveUserCmd(version):
|
||||
sid = getDbServerId()
|
||||
channel_name = ""
|
||||
if sid != '':
|
||||
channel_name = " for channel 'r{}';".format(sid)
|
||||
channel_name = " for channel 'r{}'".format(sid)
|
||||
|
||||
if mode == "gtid":
|
||||
sql = "CHANGE MASTER TO MASTER_HOST='" + ip + "', MASTER_PORT=" + port + ", MASTER_USER='" + \
|
||||
clist[0]['username'] + "', MASTER_PASSWORD='" + \
|
||||
clist[0]['password'] + "', MASTER_AUTO_POSITION=1" + channel_name
|
||||
if version == '8.0':
|
||||
sql = "CHANGE REPLICATION SOURCE TO SOURCE_HOST='" + ip + "', SOURCE_PORT=" + port + ", SOURCE_USER='" + \
|
||||
clist[0]['username'] + "', SOURCE_PASSWORD='" + \
|
||||
clist[0]['password'] + \
|
||||
"', MASTER_AUTO_POSITION=1" + channel_name
|
||||
mdb8 = getMdb8Ver()
|
||||
sql = ''
|
||||
if not mw.inArray(mdb8,version):
|
||||
base_sql = "CHANGE MASTER TO MASTER_HOST='" + ip + "', MASTER_PORT=" + port + ", MASTER_USER='" + \
|
||||
clist[0]['username'] + "', MASTER_PASSWORD='" + clist[0]['password'] + "'"
|
||||
|
||||
sql += base_sql;
|
||||
sql += "<br/><hr/>";
|
||||
# sql += base_sql + ", MASTER_AUTO_POSITION=1" + channel_name
|
||||
sql += base_sql + channel_name
|
||||
sql += "<br/><hr/>";
|
||||
|
||||
sql += base_sql + ", MASTER_LOG_FILE='" + mstatus[0]["File"] + "',MASTER_LOG_POS=" + str(mstatus[0]["Position"]) + channel_name
|
||||
else:
|
||||
sql = "CHANGE MASTER TO MASTER_HOST='" + ip + "', MASTER_PORT=" + port + ", MASTER_USER='" + \
|
||||
clist[0]['username'] + "', MASTER_PASSWORD='" + \
|
||||
clist[0]['password'] + \
|
||||
"', MASTER_LOG_FILE='" + mstatus[0]["File"] + \
|
||||
"',MASTER_LOG_POS=" + str(mstatus[0]["Position"]) + channel_name
|
||||
base_sql = "CHANGE REPLICATION SOURCE TO SOURCE_HOST='" + ip + "', SOURCE_PORT=" + port + ", SOURCE_USER='" + \
|
||||
clist[0]['username'] + "', SOURCE_PASSWORD='" + clist[0]['password']+"'"
|
||||
sql += base_sql;
|
||||
sql += "<br/><hr/>";
|
||||
# sql += base_sql + ", MASTER_AUTO_POSITION=1" + channel_name
|
||||
sql += base_sql + channel_name
|
||||
sql += "<br/><hr/>";
|
||||
sql += base_sql + ", SOURCE_LOG_FILE='" + mstatus[0]["File"] + "',SOURCE_LOG_POS=" + str(mstatus[0]["Position"]) + channel_name
|
||||
|
||||
if version == "8.0":
|
||||
sql = "CHANGE REPLICATION SOURCE TO SOURCE_HOST='" + ip + "', SOURCE_PORT=" + port + ", SOURCE_USER='" + \
|
||||
clist[0]['username'] + "', SOURCE_PASSWORD='" + \
|
||||
clist[0]['password'] + \
|
||||
"', SOURCE_LOG_FILE='" + mstatus[0]["File"] + \
|
||||
"',SOURCE_LOG_POS=" + \
|
||||
str(mstatus[0]["Position"]) + channel_name
|
||||
|
||||
data = {}
|
||||
data['cmd'] = sql
|
||||
@@ -2366,8 +2487,16 @@ def updateSlaveSSH(version=''):
|
||||
|
||||
|
||||
def getSlaveList(version=''):
|
||||
if status(version) == 'stop':
|
||||
return mw.returnJson(False, 'MySQL未启动', [])
|
||||
|
||||
query_status_cmd = 'show slave status'
|
||||
mdb8 = getMdb8Ver()
|
||||
if mw.inArray(mdb8, version):
|
||||
query_status_cmd = 'show replica status'
|
||||
|
||||
db = pMysqlDb()
|
||||
dlist = db.query('show slave status')
|
||||
dlist = db.query(query_status_cmd)
|
||||
data = {}
|
||||
data['data'] = dlist
|
||||
return mw.getJson(data)
|
||||
@@ -2659,17 +2788,314 @@ def dumpMysqlData(version=''):
|
||||
return 'fail'
|
||||
|
||||
|
||||
############### --- 重要 数据补足同步 ---- ###########
|
||||
|
||||
def getSyncMysqlDB(dbname,sign = ''):
|
||||
conn = pSqliteDb('slave_sync_user')
|
||||
if sign != '':
|
||||
data = conn.field('ip,port,user,pass,mode,cmd').where('ip=?', (sign,)).find()
|
||||
else:
|
||||
data = conn.field('ip,port,user,pass,mode,cmd').find()
|
||||
user = data['user']
|
||||
apass = data['pass']
|
||||
port = data['port']
|
||||
ip = data['ip']
|
||||
# 远程数据
|
||||
sync_db = mw.getMyORM()
|
||||
# MySQLdb |
|
||||
sync_db.setPort(port)
|
||||
sync_db.setHost(ip)
|
||||
sync_db.setUser(user)
|
||||
sync_db.setPwd(apass)
|
||||
sync_db.setDbName(dbname)
|
||||
sync_db.setTimeout(60)
|
||||
return sync_db
|
||||
|
||||
def syncDatabaseRepairTempFile():
|
||||
tmp_log = mw.getMWLogs()+ '/mysql-check.log'
|
||||
return tmp_log
|
||||
|
||||
def syncDatabaseRepairLog(version=''):
|
||||
import subprocess
|
||||
args = getArgs()
|
||||
data = checkArgs(args, ['db','sign','op'])
|
||||
if not data[0]:
|
||||
return data[1]
|
||||
|
||||
sync_args_db = args['db']
|
||||
sync_args_sign = args['sign']
|
||||
op = args['op']
|
||||
tmp_log = syncDatabaseRepairTempFile()
|
||||
cmd = 'cd '+mw.getServerDir()+'/mdserver-web && source bin/activate && python3 plugins/mysql-yum/index.py sync_database_repair {"db":"'+sync_args_db+'","sign":"'+sync_args_sign+'"}'
|
||||
# print(cmd)
|
||||
|
||||
if op == 'get':
|
||||
log = mw.getLastLine(tmp_log, 15)
|
||||
return mw.returnJson(True, log)
|
||||
|
||||
if op == 'cmd':
|
||||
return mw.returnJson(True, 'ok', cmd)
|
||||
|
||||
if op == 'do':
|
||||
os.system(' echo "开始执行" > '+ tmp_log)
|
||||
os.system(cmd +' >> '+ tmp_log +' &')
|
||||
return mw.returnJson(True, 'ok')
|
||||
|
||||
return mw.returnJson(False, '无效请求!')
|
||||
|
||||
|
||||
def syncDatabaseRepair(version=''):
|
||||
time_stats_s = time.time()
|
||||
tmp_log = syncDatabaseRepairTempFile()
|
||||
|
||||
from pymysql.converters import escape_string
|
||||
args = getArgs()
|
||||
data = checkArgs(args, ['db','sign'])
|
||||
if not data[0]:
|
||||
return data[1]
|
||||
|
||||
sync_args_db = args['db']
|
||||
sync_args_sign = args['sign']
|
||||
|
||||
# 本地数据
|
||||
local_db = pMysqlDb()
|
||||
# 远程数据
|
||||
sync_db = getSyncMysqlDB(sync_args_db,sync_args_sign)
|
||||
|
||||
tables = local_db.query('show tables from `%s`' % sync_args_db)
|
||||
table_key = "Tables_in_" + sync_args_db
|
||||
inconsistent_table = []
|
||||
|
||||
tmp_dir = '/tmp/sync_db_repair'
|
||||
mw.execShell('mkdir -p '+tmp_dir)
|
||||
|
||||
for tb in tables:
|
||||
|
||||
table_name = sync_args_db+'.'+tb[table_key]
|
||||
table_check_file = tmp_dir+'/'+table_name+'.txt'
|
||||
|
||||
if os.path.exists(table_check_file):
|
||||
# print(table_name+', 已检查OK')
|
||||
continue
|
||||
|
||||
primary_key_sql = "SHOW INDEX FROM "+table_name+" WHERE Key_name = 'PRIMARY';";
|
||||
primary_key_data = local_db.query(primary_key_sql)
|
||||
# print(primary_key_sql,primary_key_data)
|
||||
pkey_name = '*'
|
||||
if len(primary_key_data) == 1:
|
||||
pkey_name = primary_key_data[0]['Column_name']
|
||||
# print(pkey_name)
|
||||
if pkey_name != '*' :
|
||||
# 智能校验(由于服务器同步可能会慢,比较总数总是对不上)
|
||||
cmd_local_newpk_sql = 'select ' + pkey_name + ' from ' + table_name + " order by " + pkey_name + " desc limit 1"
|
||||
cmd_local_newpk_data = local_db.query(cmd_local_newpk_sql)
|
||||
# print(cmd_local_newpk_data)
|
||||
if len(cmd_local_newpk_data) == 1:
|
||||
# 比较总数
|
||||
cmd_count_sql = 'select count('+pkey_name+') as num from '+table_name + ' where '+pkey_name + ' <= '+ str(cmd_local_newpk_data[0][pkey_name])
|
||||
local_count_data = local_db.query(cmd_count_sql)
|
||||
sync_count_data = sync_db.query(cmd_count_sql)
|
||||
|
||||
if local_count_data != sync_count_data:
|
||||
print(cmd_count_sql)
|
||||
print("all data compare: ",local_count_data, sync_count_data)
|
||||
else:
|
||||
print(table_name+' smart compare check ok.')
|
||||
mw.writeFile(tmp_log, table_name+' smart compare check ok.\n','a+')
|
||||
mw.execShell("echo 'ok' > "+table_check_file)
|
||||
continue
|
||||
|
||||
|
||||
|
||||
# 比较总数
|
||||
cmd_count_sql = 'select count('+pkey_name+') as num from '+table_name
|
||||
local_count_data = local_db.query(cmd_count_sql)
|
||||
sync_count_data = sync_db.query(cmd_count_sql)
|
||||
|
||||
if local_count_data != sync_count_data:
|
||||
print("all data compare: ",local_count_data, sync_count_data)
|
||||
inconsistent_table.append(table_name)
|
||||
diff = sync_count_data[0]['num'] - local_count_data[0]['num']
|
||||
print(table_name+', need sync. diff,'+str(diff))
|
||||
mw.writeFile(tmp_log, table_name+', need sync. diff,'+str(diff)+'\n','a+')
|
||||
else:
|
||||
print(table_name+' check ok.')
|
||||
mw.writeFile(tmp_log, table_name+' check ok.\n','a+')
|
||||
mw.execShell("echo 'ok' > "+table_check_file)
|
||||
|
||||
|
||||
# inconsistent_table = ['xx.xx']
|
||||
# 数据对齐
|
||||
for table_name in inconsistent_table:
|
||||
is_break = False
|
||||
while not is_break:
|
||||
local_db.ping()
|
||||
# 远程数据
|
||||
sync_db.ping()
|
||||
|
||||
print("check table:"+table_name)
|
||||
mw.writeFile(tmp_log, "check table:"+table_name+'\n','a+')
|
||||
table_name_pos = 0
|
||||
table_name_pos_file = tmp_dir+'/'+table_name+'.pos.txt'
|
||||
primary_key_sql = "SHOW INDEX FROM "+table_name+" WHERE Key_name = 'PRIMARY';";
|
||||
primary_key_data = local_db.query(primary_key_sql)
|
||||
pkey_name = primary_key_data[0]['Column_name']
|
||||
|
||||
if os.path.exists(table_name_pos_file):
|
||||
table_name_pos = mw.readFile(table_name_pos_file)
|
||||
|
||||
|
||||
data_select_sql = 'select * from '+table_name + ' where '+pkey_name+' > '+str(table_name_pos)+' limit 10000'
|
||||
print(data_select_sql)
|
||||
local_select_data = local_db.query(data_select_sql)
|
||||
|
||||
time_s = time.time()
|
||||
sync_select_data = sync_db.query(data_select_sql)
|
||||
print(f'sync query cos:{time.time() - time_s:.4f}s')
|
||||
mw.writeFile(tmp_log, f'sync query cos:{time.time() - time_s:.4f}s\n','a+')
|
||||
|
||||
# print(local_select_data)
|
||||
# print(sync_select_data)
|
||||
|
||||
# print(len(local_select_data))
|
||||
# print(len(sync_select_data))
|
||||
print('pos:',str(table_name_pos),'local compare sync,',local_select_data == sync_select_data)
|
||||
|
||||
|
||||
cmd_count_sql = 'select count('+pkey_name+') as num from '+table_name
|
||||
local_count_data = local_db.query(cmd_count_sql)
|
||||
time_s = time.time()
|
||||
sync_count_data = sync_db.query(cmd_count_sql)
|
||||
print(f'sync count data cos:{time.time() - time_s:.4f}s')
|
||||
print(local_count_data,sync_count_data)
|
||||
# 数据同步有延迟,相等即任务数据补足完成
|
||||
if local_count_data[0]['num'] == sync_count_data[0]['num']:
|
||||
is_break = True
|
||||
break
|
||||
|
||||
diff = sync_count_data[0]['num'] - local_count_data[0]['num']
|
||||
print("diff," + str(diff)+' line data!')
|
||||
|
||||
if local_select_data == sync_select_data:
|
||||
data_count = len(local_select_data)
|
||||
if data_count == 0:
|
||||
# mw.writeFile(table_name_pos_file, '0')
|
||||
print(table_name+",data is equal ok..")
|
||||
is_break = True
|
||||
break
|
||||
|
||||
# print(table_name,data_count)
|
||||
pos = local_select_data[data_count-1][pkey_name]
|
||||
print('pos',pos)
|
||||
progress = pos/sync_count_data[0]['num']
|
||||
print('progress,%.2f' % progress+'%')
|
||||
mw.writeFile(table_name_pos_file, str(pos))
|
||||
else:
|
||||
sync_select_data_len = len(sync_select_data)
|
||||
skip_idx = 0
|
||||
# 主库PK -> 查询本地 | 保证一致
|
||||
if sync_select_data_len > 0:
|
||||
for idx in range(sync_select_data_len):
|
||||
sync_idx_data = sync_select_data[idx]
|
||||
local_idx_data = None
|
||||
if idx in local_select_data:
|
||||
local_idx_data = local_select_data[idx]
|
||||
if sync_select_data[idx] == local_idx_data:
|
||||
skip_idx = idx
|
||||
pos = local_select_data[idx][pkey_name]
|
||||
mw.writeFile(table_name_pos_file, str(pos))
|
||||
|
||||
# print(insert_data)
|
||||
local_inquery_sql = 'select * from ' + table_name+ ' where ' +pkey_name+' = '+ str(sync_idx_data[pkey_name])
|
||||
# print(local_inquery_sql)
|
||||
ldata = local_db.query(local_inquery_sql)
|
||||
# print('ldata:',ldata)
|
||||
if len(ldata) == 0:
|
||||
print("id:"+ str(sync_idx_data[pkey_name])+ " no exists, insert")
|
||||
insert_sql = 'insert into ' + table_name
|
||||
field_str = ''
|
||||
value_str = ''
|
||||
for field in sync_idx_data:
|
||||
field_str += '`'+field+'`,'
|
||||
value_str += '\''+escape_string(str(sync_idx_data[field]))+'\','
|
||||
field_str = '(' +field_str.strip(',')+')'
|
||||
value_str = '(' +value_str.strip(',')+')'
|
||||
insert_sql = insert_sql+' '+field_str+' values'+value_str+';'
|
||||
print(insert_sql)
|
||||
r = local_db.execute(insert_sql)
|
||||
print(r)
|
||||
else:
|
||||
# print('compare sync->local:',sync_idx_data == ldata[0] )
|
||||
if ldata[0] == sync_idx_data:
|
||||
continue
|
||||
|
||||
print("id:"+ str(sync_idx_data[pkey_name])+ " data is not equal, update")
|
||||
update_sql = 'update ' + table_name
|
||||
field_str = ''
|
||||
value_str = ''
|
||||
for field in sync_idx_data:
|
||||
if field == pkey_name:
|
||||
continue
|
||||
field_str += '`'+field+'`=\''+escape_string(str(sync_idx_data[field]))+'\','
|
||||
field_str = field_str.strip(',')
|
||||
update_sql = update_sql+' set '+field_str+' where '+pkey_name+'=\''+str(sync_idx_data[pkey_name])+'\';'
|
||||
print(update_sql)
|
||||
r = local_db.execute(update_sql)
|
||||
print(r)
|
||||
|
||||
# 本地PK -> 查询主库 | 保证一致
|
||||
# local_select_data_len = len(local_select_data)
|
||||
# if local_select_data_len > 0:
|
||||
# for idx in range(local_select_data_len):
|
||||
# if idx < skip_idx:
|
||||
# continue
|
||||
# local_idx_data = local_select_data[idx]
|
||||
# print('local idx check', idx, skip_idx)
|
||||
# local_inquery_sql = 'select * from ' + table_name+ ' where ' +pkey_name+' = '+ str(local_idx_data[pkey_name])
|
||||
# print(local_inquery_sql)
|
||||
# sdata = sync_db.query(local_inquery_sql)
|
||||
# sdata_len = len(sdata)
|
||||
# print('sdata:',sdata,sdata_len)
|
||||
# if sdata_len == 0:
|
||||
# delete_sql = 'delete from ' + table_name + ' where ' +pkey_name+' = '+ str(local_idx_data[pkey_name])
|
||||
# print(delete_sql)
|
||||
# r = local_db.execute(delete_sql)
|
||||
# print(r)
|
||||
# break
|
||||
|
||||
|
||||
if is_break:
|
||||
print("break all")
|
||||
break
|
||||
time.sleep(3)
|
||||
print(f'data check cos:{time.time() - time_stats_s:.4f}s')
|
||||
print("data supplementation completed")
|
||||
mw.execShell('rm -rf '+tmp_dir)
|
||||
return 'ok'
|
||||
|
||||
############### --- 重要 同步---- ###########
|
||||
|
||||
def asyncTmpfile():
|
||||
path = '/tmp/mysql_yum_async_status.txt'
|
||||
path = '/tmp/mysql_async_status.txt'
|
||||
return path
|
||||
|
||||
|
||||
def writeDbSyncStatus(data):
|
||||
path = asyncTmpfile()
|
||||
mw.writeFile(path, json.dumps(data))
|
||||
return True
|
||||
|
||||
def fullSyncCmd():
|
||||
args = getArgs()
|
||||
data = checkArgs(args, ['db', 'sign'])
|
||||
if not data[0]:
|
||||
return data[1]
|
||||
|
||||
db = args['db']
|
||||
sign = args['sign']
|
||||
|
||||
cmd = 'cd '+mw.getServerDir()+'/mdserver-web && source bin/activate && python3 plugins/mysql-yum/index.py do_full_sync {"db":"'+db+'","sign":"'+sign+'"}'
|
||||
return mw.returnJson(True,'ok',cmd)
|
||||
|
||||
def doFullSync(version=''):
|
||||
mode_file = getSyncModeFile()
|
||||
@@ -2683,7 +3109,51 @@ def doFullSync(version=''):
|
||||
return doFullSyncUser(version)
|
||||
|
||||
|
||||
def isSimpleSyncCmd(sql):
|
||||
new_sql = sql.lower()
|
||||
if new_sql.find('master_auto_position') > 0:
|
||||
return False
|
||||
return True
|
||||
|
||||
def getChannelNameForCmd(cmd):
|
||||
cmd = cmd.lower()
|
||||
cmd_arr = cmd.split('channel')
|
||||
if len(cmd_arr) == 2:
|
||||
cmd_channel_info = cmd_arr[1]
|
||||
channel_name = cmd_channel_info.strip()
|
||||
channel_name = channel_name.strip(';')
|
||||
channel_name = channel_name.strip("'")
|
||||
return channel_name
|
||||
return ''
|
||||
|
||||
def doFullSyncUserImportContentForChannel(file, channel_name):
|
||||
# print(file, channel_name)
|
||||
content = mw.readFile(file)
|
||||
|
||||
content = content.replace('STOP SLAVE;', "STOP SLAVE for channel '{}';".format(channel_name))
|
||||
content = content.replace('START SLAVE;', "START SLAVE for channel '{}';".format(channel_name))
|
||||
|
||||
find_head = "CHANGE MASTER TO "
|
||||
find_re = find_head+"(.*?);"
|
||||
find_r = re.search(find_re, content, re.I|re.M)
|
||||
if find_r:
|
||||
find_rg = find_r.groups()
|
||||
if len(find_rg)>0:
|
||||
find_str = find_head+find_rg[0]
|
||||
if find_str.lower().find('channel')==-1:
|
||||
content = content.replace(find_str+';', find_str+" for channel '{}';".format(channel_name))
|
||||
|
||||
mw.writeFile(file,content)
|
||||
return True
|
||||
|
||||
|
||||
def doFullSyncUser(version=''):
|
||||
which_pv = mw.execShell('which pv')
|
||||
is_exist_pv = False
|
||||
if os.path.exists(which_pv[0]):
|
||||
is_exist_pv = True
|
||||
|
||||
time_all_s = time.time()
|
||||
args = getArgs()
|
||||
data = checkArgs(args, ['db', 'sign'])
|
||||
if not data[0]:
|
||||
@@ -2715,8 +3185,14 @@ def doFullSyncUser(version=''):
|
||||
apass = data['pass']
|
||||
port = data['port']
|
||||
ip = data['ip']
|
||||
cmd = data['cmd']
|
||||
|
||||
channel_name = getChannelNameForCmd(cmd)
|
||||
sync_mdb = getSyncMysqlDB(sync_db,sync_sign)
|
||||
|
||||
bak_file = '/tmp/tmp.sql'
|
||||
if os.path.exists(bak_file):
|
||||
os.system("rm -rf " + bak_file)
|
||||
|
||||
writeDbSyncStatus({'code': 0, 'msg': '开始同步...', 'progress': 0})
|
||||
dmp_option = ''
|
||||
@@ -2724,29 +3200,86 @@ def doFullSyncUser(version=''):
|
||||
if mode == 'gtid':
|
||||
dmp_option = ' --set-gtid-purged=off '
|
||||
|
||||
writeDbSyncStatus({'code': 1, 'msg': '远程导出数据...', 'progress': 20})
|
||||
writeDbSyncStatus({'code': 1, 'msg': '远程导出数据...', 'progress': 15})
|
||||
|
||||
mdb8 = getMdb8Ver()
|
||||
if mw.inArray(mdb8,version):
|
||||
db.query("stop slave user='{}' password='{}';".format(user, apass))
|
||||
else:
|
||||
db.query("stop slave")
|
||||
|
||||
time.sleep(1)
|
||||
writeDbSyncStatus({'code': 2, 'msg': '远程导出数据...', 'progress': 20})
|
||||
|
||||
find_run_dump = mw.execShell('ps -ef | grep mysqldump | grep -v grep')
|
||||
if find_run_dump[0] != "":
|
||||
print("正在远程导出数据中,别着急...")
|
||||
writeDbSyncStatus({'code': 3.1, 'msg': '正在远程导出数据中,别着急...', 'progress': 19})
|
||||
return False
|
||||
|
||||
if not os.path.exists(bak_file):
|
||||
dump_sql_data = getServerDir() + "/bin/usr/bin/mysqldump " + dmp_option + " --force --opt --default-character-set=utf8 --single-transaction -h" + ip + " -P" + \
|
||||
port + " -u" + user + " -p\"" + apass + \
|
||||
"\" --ssl-mode=DISABLED " + sync_db + " > " + bak_file
|
||||
# print(dump_sql_data)
|
||||
mw.execShell(dump_sql_data)
|
||||
dmp_option += ' '
|
||||
if isSimpleSyncCmd(cmd):
|
||||
if mw.inArray(mdb8,version):
|
||||
# --compression-algorithms
|
||||
dmp_option += " --source-data=1 --apply-replica-statements --include-source-host-port "
|
||||
else:
|
||||
dmp_option += " --master-data=1 --apply-slave-statements --include-master-host-port --compress "
|
||||
|
||||
|
||||
dump_sql_data = getServerDir() + "/bin/usr/bin/mysqldump --single-transaction --default-character-set=utf8mb4 -q " + dmp_option + " -h" + \
|
||||
ip + " -P" + port + " -u" + user + ' -p"' + apass + '" --ssl-mode=DISABLED ' + sync_db + " > " + bak_file
|
||||
print(dump_sql_data)
|
||||
time_s = time.time()
|
||||
r = mw.execShell(dump_sql_data)
|
||||
print(r)
|
||||
time_e = time.time()
|
||||
export_cos = time_e - time_s
|
||||
print("export cos:", export_cos)
|
||||
|
||||
writeDbSyncStatus({'code': 3, 'msg': '导出耗时:'+str(int(export_cos))+'秒,正在到本地导入数据中...', 'progress': 40})
|
||||
|
||||
find_run_import = mw.execShell('ps -ef | grep mysql| grep '+ bak_file +' | grep -v grep')
|
||||
if find_run_import[0] != "":
|
||||
print("正在导入数据中,别着急...")
|
||||
writeDbSyncStatus({'code': 4.1, 'msg': '正在导入数据中,别着急...', 'progress': 39})
|
||||
return False
|
||||
|
||||
writeDbSyncStatus({'code': 2, 'msg': '本地导入数据...', 'progress': 40})
|
||||
time_s = time.time()
|
||||
if os.path.exists(bak_file):
|
||||
# 重置
|
||||
db.execute('reset master')
|
||||
if channel_name != '':
|
||||
doFullSyncUserImportContentForChannel(bak_file, channel_name)
|
||||
|
||||
pwd = pSqliteDb('config').where('id=?', (1,)).getField('mysql_root')
|
||||
sock = getSocketFile()
|
||||
|
||||
if is_exist_pv:
|
||||
my_import_cmd = getServerDir() + '/bin/usr/bin/mysql -S ' + sock + " -uroot -p'" + pwd + "' " + sync_db_import
|
||||
my_import_cmd = "pv -t -p " + bak_file + '|' + my_import_cmd
|
||||
print(my_import_cmd)
|
||||
os.system(my_import_cmd)
|
||||
else:
|
||||
my_import_cmd = getServerDir() + '/bin/usr/bin/mysql -S ' + sock + " -uroot -p'" + pwd + "' " + sync_db_import + ' < ' + bak_file
|
||||
print(my_import_cmd)
|
||||
mw.execShell(my_import_cmd)
|
||||
|
||||
my_import_cmd = getServerDir() + '/bin/usr/bin/mysql -S ' + sock + ' -uroot -p' + pwd + \
|
||||
' ' + sync_db_import + ' < ' + bak_file
|
||||
mw.execShell(my_import_cmd)
|
||||
|
||||
if version == '8.0':
|
||||
db.query("start slave user='{}' password='{}';".format(user, apass))
|
||||
|
||||
if mw.inArray(mdb8, version):
|
||||
db.query("start replica user='{}' password='{}';".format(user, apass))
|
||||
else:
|
||||
db.query("start slave")
|
||||
|
||||
writeDbSyncStatus({'code': 6, 'msg': '从库重启完成...', 'progress': 100})
|
||||
db.query("start all slaves")
|
||||
time_all_e = time.time()
|
||||
cos = time_all_e - time_all_s
|
||||
writeDbSyncStatus({'code': 6, 'msg': '总耗时:'+str(int(cos))+'秒,从库重启完成...', 'progress': 100})
|
||||
|
||||
if os.path.exists(bak_file):
|
||||
os.system("rm -rf " + bak_file)
|
||||
@@ -2928,32 +3461,32 @@ def fullSync(version=''):
|
||||
|
||||
|
||||
def installPreInspection(version):
|
||||
cmd = "cat /etc/*-release | grep PRETTY_NAME |awk -F = '{print $2}' | awk -F '\"' '{print $2}'| awk '{print $1}'"
|
||||
sys = mw.execShell(cmd)
|
||||
|
||||
sys = mw.execShell(
|
||||
"cat /etc/*-release | grep PRETTY_NAME |awk -F = '{print $2}' | awk -F '\"' '{print $2}'| awk '{print $1}'")
|
||||
|
||||
if sys[1] != '':
|
||||
return '不支持改系统'
|
||||
|
||||
sys_id = mw.execShell(
|
||||
"cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F '\"' '{print $2}'")
|
||||
cmd = "cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F '\"' '{print $2}'"
|
||||
sys_id = mw.execShell(cmd)
|
||||
|
||||
sysName = sys[0].strip().lower()
|
||||
sysId = sys_id[0].strip()
|
||||
|
||||
if not sysName in ('centos',):
|
||||
return '仅支持centos'
|
||||
if not sysName in ['centos','almalinux','rocky','opensuse']:
|
||||
return '仅支持centos,almalinux,rocky,opensuse'
|
||||
|
||||
if (sysName == 'centos' and version == '5.7' and not sysId in('7',)):
|
||||
return 'mysql5.7 仅支持centos7'
|
||||
|
||||
if (sysName == 'centos' and version == '8.0' and not sysId in ('7', '8', '9',)):
|
||||
mdb8 = getMdb8Ver()
|
||||
if (sysName == 'centos' and mw.inArray(mdb8, version) and not sysId in ('7', '8', '9',)):
|
||||
return 'mysql8.0 仅支持centos7,8,9'
|
||||
return 'ok'
|
||||
|
||||
|
||||
def uninstallPreInspection(version):
|
||||
stop(version)
|
||||
try:
|
||||
stop(version)
|
||||
except Exception as e:
|
||||
pass
|
||||
if mw.isDebugMode():
|
||||
return 'ok'
|
||||
|
||||
@@ -2965,7 +3498,7 @@ def uninstallPreInspection(version):
|
||||
if __name__ == "__main__":
|
||||
func = sys.argv[1]
|
||||
|
||||
version = "5.6"
|
||||
version = '5.6'
|
||||
version_pl = getServerDir() + "/version.pl"
|
||||
if os.path.exists(version_pl):
|
||||
version = mw.readFile(version_pl).strip()
|
||||
@@ -2999,7 +3532,7 @@ if __name__ == "__main__":
|
||||
elif func == 'conf':
|
||||
print(getConf())
|
||||
elif func == 'bin_log':
|
||||
print(binLog())
|
||||
print(binLog(version))
|
||||
elif func == 'binlog_list':
|
||||
print(binLogList())
|
||||
elif func == 'clean_bin_log':
|
||||
@@ -3028,6 +3561,10 @@ if __name__ == "__main__":
|
||||
print(importDbBackup())
|
||||
elif func == 'import_db_external':
|
||||
print(importDbExternal())
|
||||
elif func == 'import_db_external_progress':
|
||||
print(importDbExternalProgress())
|
||||
elif func == 'import_db_external_progress_bar':
|
||||
print(importDbExternalProgressBar())
|
||||
elif func == 'delete_db_backup':
|
||||
print(deleteDbBackup())
|
||||
elif func == 'get_db_backup_list':
|
||||
@@ -3134,7 +3671,13 @@ if __name__ == "__main__":
|
||||
print(fullSync(version))
|
||||
elif func == 'do_full_sync':
|
||||
print(doFullSync(version))
|
||||
elif func == 'full_sync_cmd':
|
||||
print(fullSyncCmd())
|
||||
elif func == 'dump_mysql_data':
|
||||
print(dumpMysqlData(version))
|
||||
elif func == 'sync_database_repair':
|
||||
print(syncDatabaseRepair())
|
||||
elif func == 'sync_database_repair_log':
|
||||
print(syncDatabaseRepairLog())
|
||||
else:
|
||||
print('error')
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
"name":"mysql-yum",
|
||||
"type":"运行环境",
|
||||
"ps":"一种关系数据库管理系统[centos](极速安装)",
|
||||
"todo_versions":["5.7","8.0"],
|
||||
"versions":["5.7","8.0"],
|
||||
"versions":["5.7","8.0","8.2","8.3", "8.4", "9.0"],
|
||||
"shell":"install.sh",
|
||||
"install_pre_inspection":true,
|
||||
"uninstall_pre_inspection":true,
|
||||
"checks":"server/mysql-yum",
|
||||
"path":"server/mysql-yum",
|
||||
"author":"mysql",
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
# It's not recommended to modify this file in-place, because it will be
|
||||
# overwritten during package upgrades. If you want to customize, the
|
||||
# best way is to use systemctl edit:
|
||||
#
|
||||
# $ systemctl edit mysqld.service
|
||||
#
|
||||
# this will create file
|
||||
#
|
||||
# /etc/systemd/system/mysqld.service.d/override.conf
|
||||
#
|
||||
# which be parsed after the file mysqld.service itself is parsed.
|
||||
#
|
||||
# For example, if you want to increase mysql's open-files-limit to 20000
|
||||
# add following when editing with command above:
|
||||
#
|
||||
# [Service]
|
||||
# LimitNOFILE=20000
|
||||
#
|
||||
# Or if you require to execute pre and post scripts in the unit file as root, set
|
||||
# PermissionsStartOnly=true
|
||||
#
|
||||
# For more info about custom unit files, see systemd.unit(5) or
|
||||
# http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F
|
||||
#
|
||||
# Don't forget to reload systemd daemon after you change unit configuration:
|
||||
# root> systemctl --system daemon-reload
|
||||
|
||||
[Unit]
|
||||
Description=MySQL 8.0 database server
|
||||
After=syslog.target
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
User=mysql
|
||||
Group=mysql
|
||||
|
||||
#ExecStartPre=/usr/libexec/mysql-check-socket
|
||||
#ExecStartPre=/usr/libexec/mysql-prepare-db-dir %n
|
||||
# Note: we set --basedir to prevent probes that might trigger SELinux alarms,
|
||||
# per bug #547485
|
||||
ExecStart={$SERVER_PATH}/mysql-yum/bin/usr/sbin/mysqld --defaults-file={$SERVER_PATH}/mysql-yum/etc/my.cnf --basedir={$SERVER_PATH}/mysql-yum/bin/usr --user=mysql
|
||||
#ExecStartPost=/usr/libexec/mysql-check-upgrade
|
||||
#ExecStopPost=/usr/libexec/mysql-wait-stop
|
||||
|
||||
# Give a reasonable amount of time for the server to start up/shut down
|
||||
TimeoutSec=300
|
||||
|
||||
# Place temp files in a secure directory, not /tmp
|
||||
PrivateTmp=false
|
||||
|
||||
Restart=on-failure
|
||||
|
||||
RestartPreventExitStatus=1
|
||||
|
||||
# Sets open_files_limit
|
||||
LimitNOFILE = 10000
|
||||
|
||||
# Set enviroment variable MYSQLD_PARENT_PID. This is required for SQL restart command.
|
||||
Environment=MYSQLD_PARENT_PID=1
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,63 @@
|
||||
# It's not recommended to modify this file in-place, because it will be
|
||||
# overwritten during package upgrades. If you want to customize, the
|
||||
# best way is to use systemctl edit:
|
||||
#
|
||||
# $ systemctl edit mysqld.service
|
||||
#
|
||||
# this will create file
|
||||
#
|
||||
# /etc/systemd/system/mysqld.service.d/override.conf
|
||||
#
|
||||
# which be parsed after the file mysqld.service itself is parsed.
|
||||
#
|
||||
# For example, if you want to increase mysql's open-files-limit to 20000
|
||||
# add following when editing with command above:
|
||||
#
|
||||
# [Service]
|
||||
# LimitNOFILE=20000
|
||||
#
|
||||
# Or if you require to execute pre and post scripts in the unit file as root, set
|
||||
# PermissionsStartOnly=true
|
||||
#
|
||||
# For more info about custom unit files, see systemd.unit(5) or
|
||||
# http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F
|
||||
#
|
||||
# Don't forget to reload systemd daemon after you change unit configuration:
|
||||
# root> systemctl --system daemon-reload
|
||||
|
||||
[Unit]
|
||||
Description=MySQL 8.0 database server
|
||||
After=syslog.target
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
User=mysql
|
||||
Group=mysql
|
||||
|
||||
#ExecStartPre=/usr/libexec/mysql-check-socket
|
||||
#ExecStartPre=/usr/libexec/mysql-prepare-db-dir %n
|
||||
# Note: we set --basedir to prevent probes that might trigger SELinux alarms,
|
||||
# per bug #547485
|
||||
ExecStart={$SERVER_PATH}/mysql-yum/bin/usr/sbin/mysqld --defaults-file={$SERVER_PATH}/mysql-yum/etc/my.cnf --basedir={$SERVER_PATH}/mysql-yum/bin/usr --user=mysql
|
||||
#ExecStartPost=/usr/libexec/mysql-check-upgrade
|
||||
#ExecStopPost=/usr/libexec/mysql-wait-stop
|
||||
|
||||
# Give a reasonable amount of time for the server to start up/shut down
|
||||
TimeoutSec=300
|
||||
|
||||
# Place temp files in a secure directory, not /tmp
|
||||
PrivateTmp=false
|
||||
|
||||
Restart=on-failure
|
||||
|
||||
RestartPreventExitStatus=1
|
||||
|
||||
# Sets open_files_limit
|
||||
LimitNOFILE = 10000
|
||||
|
||||
# Set enviroment variable MYSQLD_PARENT_PID. This is required for SQL restart command.
|
||||
Environment=MYSQLD_PARENT_PID=1
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,63 @@
|
||||
# It's not recommended to modify this file in-place, because it will be
|
||||
# overwritten during package upgrades. If you want to customize, the
|
||||
# best way is to use systemctl edit:
|
||||
#
|
||||
# $ systemctl edit mysqld.service
|
||||
#
|
||||
# this will create file
|
||||
#
|
||||
# /etc/systemd/system/mysqld.service.d/override.conf
|
||||
#
|
||||
# which be parsed after the file mysqld.service itself is parsed.
|
||||
#
|
||||
# For example, if you want to increase mysql's open-files-limit to 20000
|
||||
# add following when editing with command above:
|
||||
#
|
||||
# [Service]
|
||||
# LimitNOFILE=20000
|
||||
#
|
||||
# Or if you require to execute pre and post scripts in the unit file as root, set
|
||||
# PermissionsStartOnly=true
|
||||
#
|
||||
# For more info about custom unit files, see systemd.unit(5) or
|
||||
# http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F
|
||||
#
|
||||
# Don't forget to reload systemd daemon after you change unit configuration:
|
||||
# root> systemctl --system daemon-reload
|
||||
|
||||
[Unit]
|
||||
Description=MySQL 8.0 database server
|
||||
After=syslog.target
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
User=mysql
|
||||
Group=mysql
|
||||
|
||||
#ExecStartPre=/usr/libexec/mysql-check-socket
|
||||
#ExecStartPre=/usr/libexec/mysql-prepare-db-dir %n
|
||||
# Note: we set --basedir to prevent probes that might trigger SELinux alarms,
|
||||
# per bug #547485
|
||||
ExecStart={$SERVER_PATH}/mysql-yum/bin/usr/sbin/mysqld --defaults-file={$SERVER_PATH}/mysql-yum/etc/my.cnf --basedir={$SERVER_PATH}/mysql-yum/bin/usr --user=mysql
|
||||
#ExecStartPost=/usr/libexec/mysql-check-upgrade
|
||||
#ExecStopPost=/usr/libexec/mysql-wait-stop
|
||||
|
||||
# Give a reasonable amount of time for the server to start up/shut down
|
||||
TimeoutSec=300
|
||||
|
||||
# Place temp files in a secure directory, not /tmp
|
||||
PrivateTmp=false
|
||||
|
||||
Restart=on-failure
|
||||
|
||||
RestartPreventExitStatus=1
|
||||
|
||||
# Sets open_files_limit
|
||||
LimitNOFILE = 10000
|
||||
|
||||
# Set enviroment variable MYSQLD_PARENT_PID. This is required for SQL restart command.
|
||||
Environment=MYSQLD_PARENT_PID=1
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,63 @@
|
||||
# It's not recommended to modify this file in-place, because it will be
|
||||
# overwritten during package upgrades. If you want to customize, the
|
||||
# best way is to use systemctl edit:
|
||||
#
|
||||
# $ systemctl edit mysqld.service
|
||||
#
|
||||
# this will create file
|
||||
#
|
||||
# /etc/systemd/system/mysqld.service.d/override.conf
|
||||
#
|
||||
# which be parsed after the file mysqld.service itself is parsed.
|
||||
#
|
||||
# For example, if you want to increase mysql's open-files-limit to 20000
|
||||
# add following when editing with command above:
|
||||
#
|
||||
# [Service]
|
||||
# LimitNOFILE=20000
|
||||
#
|
||||
# Or if you require to execute pre and post scripts in the unit file as root, set
|
||||
# PermissionsStartOnly=true
|
||||
#
|
||||
# For more info about custom unit files, see systemd.unit(5) or
|
||||
# http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F
|
||||
#
|
||||
# Don't forget to reload systemd daemon after you change unit configuration:
|
||||
# root> systemctl --system daemon-reload
|
||||
|
||||
[Unit]
|
||||
Description=MySQL 8.0 database server
|
||||
After=syslog.target
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
User=mysql
|
||||
Group=mysql
|
||||
|
||||
#ExecStartPre=/usr/libexec/mysql-check-socket
|
||||
#ExecStartPre=/usr/libexec/mysql-prepare-db-dir %n
|
||||
# Note: we set --basedir to prevent probes that might trigger SELinux alarms,
|
||||
# per bug #547485
|
||||
ExecStart={$SERVER_PATH}/mysql-yum/bin/usr/sbin/mysqld --defaults-file={$SERVER_PATH}/mysql-yum/etc/my.cnf --basedir={$SERVER_PATH}/mysql-yum/bin/usr --user=mysql
|
||||
#ExecStartPost=/usr/libexec/mysql-check-upgrade
|
||||
#ExecStopPost=/usr/libexec/mysql-wait-stop
|
||||
|
||||
# Give a reasonable amount of time for the server to start up/shut down
|
||||
TimeoutSec=300
|
||||
|
||||
# Place temp files in a secure directory, not /tmp
|
||||
PrivateTmp=false
|
||||
|
||||
Restart=on-failure
|
||||
|
||||
RestartPreventExitStatus=1
|
||||
|
||||
# Sets open_files_limit
|
||||
LimitNOFILE = 10000
|
||||
|
||||
# Set enviroment variable MYSQLD_PARENT_PID. This is required for SQL restart command.
|
||||
Environment=MYSQLD_PARENT_PID=1
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -11,6 +11,7 @@ serverPath=$(dirname "$rootPath")
|
||||
# cd /www/server/mdserver-web/plugins/mysql-yum && bash install.sh install 8.0
|
||||
# cd /www/server/mdserver-web/plugins/mysql-yum && bash install.sh uninstall 8.0
|
||||
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql-yum/index.py start 8.0
|
||||
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql-yum/index.py get_master_status 8.4
|
||||
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
@@ -18,6 +19,14 @@ install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
action=$1
|
||||
type=$2
|
||||
|
||||
if id mysql &> /dev/null ;then
|
||||
echo "mysql UID is `id -u mysql`"
|
||||
echo "mysql Shell is `grep "^mysql:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd mysql
|
||||
useradd -g mysql -s /usr/sbin/nologin mysql
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if [ "${2}" == "" ];then
|
||||
|
||||
@@ -56,9 +56,10 @@ function myAsyncPost(method,args){
|
||||
}
|
||||
|
||||
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
|
||||
return syncPost('/plugins/run', {name:'mysql-yum', func:method, args:_args});
|
||||
return syncPost('/plugins/run', {name:'mysql', func:method, args:_args});
|
||||
}
|
||||
|
||||
|
||||
function myPostCallbak(method, version, args,callback){
|
||||
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
|
||||
|
||||
@@ -115,7 +116,6 @@ function myPostCallbakN(method, version, args,callback){
|
||||
},'json');
|
||||
}
|
||||
|
||||
|
||||
function vaildPhpmyadmin(url,username,password){
|
||||
// console.log("Authorization: Basic " + btoa(username + ":" + password));
|
||||
$.ajax({
|
||||
@@ -161,7 +161,7 @@ function runInfo(){
|
||||
<tr><th>活动/峰值连接数</th><td>' + rdata.Threads_running + '/' + rdata.Max_used_connections + '</td><td colspan="2">若值过大,增加max_connections</td></tr>\
|
||||
<tr><th>线程缓存命中率</th><td>' + ((1 - rdata.Threads_created / rdata.Connections) * 100).toFixed(2) + '%</td><td colspan="2">若过低,增加thread_cache_size</td></tr>\
|
||||
<tr><th>索引命中率</th><td>' + ((1 - rdata.Key_reads / rdata.Key_read_requests) * 100).toFixed(2) + '%</td><td colspan="2">若过低,增加key_buffer_size</td></tr>\
|
||||
<tr><th>Innodb索引命中率</th><td>' + ((1 - rdata.Innodb_buffer_pool_reads / rdata.Innodb_buffer_pool_read_requests) * 100).toFixed(2) + '%</td><td colspan="2">若过低,增加innodb_buffer_pool_size</td></tr>\
|
||||
<tr><th>Innodb索引命中率</th><td>' + (rdata.Innodb_buffer_pool_read_requests / (rdata.Innodb_buffer_pool_read_requests+rdata.Innodb_buffer_pool_reads)).toFixed(2) + '%</td><td colspan="2">若过低,增加innodb_buffer_pool_size</td></tr>\
|
||||
<tr><th>查询缓存命中率</th><td>' + cache_size + '</td><td colspan="2">' + lan.soft.mysql_status_ps5 + '</td></tr>\
|
||||
<tr><th>创建临时表到磁盘</th><td>' + ((rdata.Created_tmp_disk_tables / rdata.Created_tmp_tables) * 100).toFixed(2) + '%</td><td colspan="2">若过大,尝试增加tmp_table_size</td></tr>\
|
||||
<tr><th>已打开的表</th><td>' + rdata.Open_tables + '</td><td colspan="2">若过大,增加table_cache_size</td></tr>\
|
||||
@@ -200,7 +200,7 @@ function myPort(){
|
||||
myPost('my_port','',function(data){
|
||||
var con = '<div class="line ">\
|
||||
<div class="info-r ml0">\
|
||||
<input name="port" class="bt-input-text mr5 port" type="text" style="width:100px" value="'+data.data+'">\
|
||||
<input name="port" class="bt-input-text mr5 port" type="number" style="width:100px" value="'+data.data+'">\
|
||||
<button id="btn_change_port" name="btn_change_port" class="btn btn-success btn-sm mr5 ml5 btn_change_port">修改</button>\
|
||||
</div></div>';
|
||||
$(".soft-man-con").html(con);
|
||||
@@ -701,7 +701,7 @@ function setDbPass(id, username, password){
|
||||
<span title='随机密码' class='glyphicon glyphicon-repeat cursor' onclick='repeatPwd(16)'></span></div>\
|
||||
</div>\
|
||||
<input type='hidden' name='id' value='"+id+"'>\
|
||||
</form>",
|
||||
</form>",
|
||||
yes:function(index){
|
||||
// var data = $("#mod_pwd").serialize();
|
||||
var data = {};
|
||||
@@ -795,7 +795,7 @@ function addDatabase(type){
|
||||
|
||||
function delDb(id, name){
|
||||
safeMessage('删除['+name+']','您真的要删除['+name+']吗?',function(){
|
||||
var data='id='+id+'&name='+name
|
||||
var data='id='+id+'&name='+name;
|
||||
myPost('del_db', data, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
showMsg(rdata.msg,function(){
|
||||
@@ -871,7 +871,7 @@ function openPhpmyadmin(name,username,password){
|
||||
}
|
||||
|
||||
if (rdata.data['cfg']['choose'] != 'mysql-yum'){
|
||||
layer.msg('当前为['+rdata.choose+']模式,若要使用请修改phpMyAdmin访问切换.',{icon:2,shade: [0.3, '#000']});
|
||||
layer.msg('当前为['+rdata.data['cfg']['choose'] + ']模式,若要使用请修改phpMyAdmin访问切换.',{icon:2,shade: [0.3, '#000']});
|
||||
return;
|
||||
}
|
||||
var home_page = rdata.data['home_page'];
|
||||
@@ -929,6 +929,31 @@ function importBackup(file,name){
|
||||
});
|
||||
}
|
||||
|
||||
function importBackupProgress(file,name){
|
||||
myPost('import_db_backup_progress',{file:file,name:name}, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
layer.open({
|
||||
title: "手动导入命令CMD【显示进度】",
|
||||
area: ['600px', '180px'],
|
||||
type:1,
|
||||
closeBtn: 1,
|
||||
shadeClose: false,
|
||||
btn:["复制","取消"],
|
||||
content: '<div class="pd15">\
|
||||
<div class="divtable">\
|
||||
<pre class="layui-code">'+rdata.data+'</pre>\
|
||||
</div>\
|
||||
</div>',
|
||||
success:function(){
|
||||
copyText(rdata.data);
|
||||
},
|
||||
yes:function(){
|
||||
copyText(rdata.data);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function importDbExternal(file,name){
|
||||
myPost('import_db_external',{file:file,name:name}, function(data){
|
||||
@@ -936,6 +961,31 @@ function importDbExternal(file,name){
|
||||
});
|
||||
}
|
||||
|
||||
function importDbExternalProgress(file,name){
|
||||
myPost('import_db_external_progress',{file:file,name:name}, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
layer.open({
|
||||
title: "手动导入命令CMD【显示进度】",
|
||||
area: ['600px', '180px'],
|
||||
type:1,
|
||||
closeBtn: 1,
|
||||
shadeClose: false,
|
||||
btn:["复制","取消"],
|
||||
content: '<div class="pd15">\
|
||||
<div class="divtable">\
|
||||
<pre class="layui-code">'+rdata.data+'</pre>\
|
||||
</div>\
|
||||
</div>',
|
||||
success:function(){
|
||||
copyText(rdata.data);
|
||||
},
|
||||
yes:function(){
|
||||
copyText(rdata.data);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function setLocalImport(db_name){
|
||||
|
||||
//上传文件
|
||||
@@ -991,6 +1041,7 @@ function setLocalImport(db_name){
|
||||
<td><span> ' + file_list[i]['time'] + '</span></td>\
|
||||
<td style="text-align: right;">\
|
||||
<a class="btlink" onclick="importDbExternal(\'' + file_list[i]['name'] + '\',\'' +db_name+ '\')">导入</a> | \
|
||||
<a class="btlink" onclick="importDbExternalProgress(\'' + file_list[i]['name'] + '\',\'' +db_name+ '\')">导入进度</a> | \
|
||||
<a class="btlink del" index="'+i+'">删除</a>\
|
||||
</td>\
|
||||
</tr>';
|
||||
@@ -1014,7 +1065,7 @@ function setLocalImport(db_name){
|
||||
var layerIndex = layer.open({
|
||||
type: 1,
|
||||
title: "从文件导入数据",
|
||||
area: ['600px', '380px'],
|
||||
area: ['700px', '380px'],
|
||||
closeBtn: 1,
|
||||
shadeClose: false,
|
||||
content: '<div class="pd15">\
|
||||
@@ -1060,7 +1111,7 @@ function setBackup(db_name){
|
||||
var layerIndex = layer.open({
|
||||
type: 1,
|
||||
title: "数据库备份详情",
|
||||
area: ['600px', '280px'],
|
||||
area: ['700px', '280px'],
|
||||
closeBtn: 1,
|
||||
shadeClose: false,
|
||||
content: '<div class="pd15">\
|
||||
@@ -1114,6 +1165,7 @@ function setBackupReq(db_name, obj){
|
||||
<td><span> ' + rdata.data[i]['time'] + '</span></td>\
|
||||
<td style="text-align: right;">\
|
||||
<a class="btlink" onclick="importBackup(\'' + rdata.data[i]['name'] + '\',\'' +db_name+ '\')">导入</a> | \
|
||||
<a class="btlink" onclick="importBackupProgress(\'' + rdata.data[i]['name'] + '\',\'' +db_name+ '\')">导入进度</a> | \
|
||||
<a class="btlink" onclick="downloadBackup(\'' + rdata.data[i]['file'] + '\')">下载</a> | \
|
||||
<a class="btlink" onclick="delBackup(\'' + rdata.data[i]['name'] + '\',\'' +db_name+ '\')">删除</a>\
|
||||
</td>\
|
||||
@@ -1231,6 +1283,7 @@ function dbList(page, search){
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function myBinRollingLogs(_name, func, _args, line){
|
||||
|
||||
var file_line = 100;
|
||||
@@ -1654,7 +1707,7 @@ function addMasterRepSlaveUser(){
|
||||
|
||||
|
||||
|
||||
function updateMasterRepSlaveUser(username){
|
||||
function updateMasterRepSlaveUser(username, password){
|
||||
|
||||
var index = layer.open({
|
||||
type: 1,
|
||||
@@ -1667,7 +1720,7 @@ function updateMasterRepSlaveUser(username){
|
||||
<div class='line'><span class='tname'>用户名</span><div class='info-r'><input name='username' readonly='readonly' class='bt-input-text mr5' placeholder='用户名' type='text' style='width:330px;' value='"+username+"'></div></div>\
|
||||
<div class='line'>\
|
||||
<span class='tname'>密码</span>\
|
||||
<div class='info-r'><input class='bt-input-text mr5' type='text' name='password' id='MyPassword' style='width:330px' value='"+(randomStrPwd(16))+"' /><span title='随机密码' class='glyphicon glyphicon-repeat cursor' onclick='repeatPwd(16)'></span></div>\
|
||||
<div class='info-r'><input class='bt-input-text mr5' type='text' name='password' id='MyPassword' style='width:330px' value='"+password+"' /><span title='随机密码' class='glyphicon glyphicon-repeat cursor' onclick='repeatPwd(16)'></span></div>\
|
||||
</div>\
|
||||
<input type='hidden' name='ps' value='' />\
|
||||
<div class='bt-form-submit-btn'>\
|
||||
@@ -1709,17 +1762,11 @@ function getMasterRepSlaveUserCmd(username, db=''){
|
||||
area: '500px',
|
||||
content:"<form class='bt-form pd20 pb70' id='add_master'>\
|
||||
<div class='line'>"+cmd+"</div>\
|
||||
<div class='bt-form-submit-btn'>\
|
||||
<button type='button' class='btn btn-success btn-sm btn-title class-copy-cmd'>复制</button>\
|
||||
<div class='bt-form-submit-btn' style='text-align:center;'>\
|
||||
<button type='button' class='btn btn-success btn-sm btn-title'>选择其中一个复制</button>\
|
||||
</div>\
|
||||
</form>",
|
||||
});
|
||||
|
||||
|
||||
copyPass(cmd);
|
||||
$('.class-copy-cmd').click(function(){
|
||||
copyPass(cmd);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1810,6 +1857,7 @@ function setDbMasterAccess(username){
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function resetMaster(){
|
||||
myPost('reset_master', '', function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
@@ -1840,10 +1888,11 @@ function getMasterRepSlaveList(){
|
||||
for (i in user_list) {
|
||||
// console.log(i);
|
||||
var name = user_list[i]['username'];
|
||||
var password = user_list[i]['password'];
|
||||
list += '<tr><td>'+name+'</td>\
|
||||
<td>'+user_list[i]['password']+'</td>\
|
||||
<td>'+password+'</td>\
|
||||
<td>\
|
||||
<a class="btlink" onclick="updateMasterRepSlaveUser(\''+name+'\');">修改</a> | \
|
||||
<a class="btlink" onclick="updateMasterRepSlaveUser(\''+name+'\',\''+password+'\');">修改</a> | \
|
||||
<a class="btlink" onclick="delMasterRepSlaveUser(\''+name+'\');">删除</a> | \
|
||||
<a class="btlink" onclick="setDbMasterAccess(\''+name+'\');">权限</a> | \
|
||||
<a class="btlink" onclick="getMasterRepSlaveUserCmd(\''+name+'\');">从库同步命令</a>\
|
||||
@@ -1931,6 +1980,7 @@ function getFullSyncStatus(db){
|
||||
</div>\
|
||||
<div class='table_toolbar' style='left:0px;'>\
|
||||
<span data-status='init' class='sync btn btn-default btn-sm' id='begin_full_sync'>开始</span>\
|
||||
<span data-status='init' class='btn btn-default btn-sm' id='full_sync_cmd'>手动命令</span>\
|
||||
</div>\
|
||||
</div>",
|
||||
cancel: function(){
|
||||
@@ -1949,10 +1999,36 @@ function getFullSyncStatus(db){
|
||||
fullSync(db,sign,0);
|
||||
}, 1000);
|
||||
$(this).data('status','starting');
|
||||
$('#begin_full_sync').text("同步中");
|
||||
} else {
|
||||
layer.msg("正在同步中..",{icon:0});
|
||||
}
|
||||
});
|
||||
|
||||
$('#full_sync_cmd').click(function(){
|
||||
myPostN('full_sync_cmd', {'db':db,'sign':''}, function(rdata){
|
||||
var rdata = $.parseJSON(rdata.data);
|
||||
layer.open({
|
||||
title: "手动执行命令CMD",
|
||||
area: ['600px', '180px'],
|
||||
type:1,
|
||||
closeBtn: 1,
|
||||
shadeClose: false,
|
||||
btn:["复制","取消"],
|
||||
content: '<div class="pd15">\
|
||||
<div class="divtable">\
|
||||
<pre class="layui-code">'+rdata.data+'</pre>\
|
||||
</div>\
|
||||
</div>',
|
||||
success:function(){
|
||||
copyText(rdata.data);
|
||||
},
|
||||
yes:function(){
|
||||
copyText(rdata.data);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1968,12 +2044,91 @@ function getFullSyncStatus(db){
|
||||
if (rdata['code']==6 ||rdata['code']<0){
|
||||
layer.msg(rdata['msg']);
|
||||
clearInterval(timeId);
|
||||
$('#begin_full_sync').text("同步结束,再次同步?");
|
||||
$("#begin_full_sync").attr('data-status','init');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function dataSyncVerify(db){
|
||||
var reqTimer = null;
|
||||
|
||||
function requestLogs(layerIndex){
|
||||
myPostN('sync_database_repair_log', {db:db, sign:'',op:'get'}, function(rdata){
|
||||
var rdata = $.parseJSON(rdata.data);
|
||||
|
||||
if(!rdata.status) {
|
||||
layer.close(layerIndex);
|
||||
layer.msg(rdata.msg,{icon:2, time:2000});
|
||||
clearInterval(reqTimer);
|
||||
return;
|
||||
};
|
||||
|
||||
if (rdata.msg == ''){
|
||||
rdata.msg = '暂无数据!';
|
||||
}
|
||||
|
||||
$("#data_verify_log").html(rdata.msg);
|
||||
//滚动到最低
|
||||
var ob = document.getElementById('data_verify_log');
|
||||
ob.scrollTop = ob.scrollHeight;
|
||||
});
|
||||
}
|
||||
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: '同步数据库['+db+']数据校验',
|
||||
area: '500px',
|
||||
btn:[ "开始","取消","手动"],
|
||||
content:"<div class='bt-form'>\
|
||||
"+'<pre id="data_verify_log" style="overflow: auto; border: 0px none; line-height:23px;padding: 5px; margin: 0px; white-space: pre-wrap; height: 395px; background-color: rgb(51,51,51);color:#f1f1f1;border-radius:0px;font-family:"></pre>'+"\
|
||||
</div>",
|
||||
cancel: function(){
|
||||
if (reqTimer){
|
||||
clearInterval(reqTimer);
|
||||
}
|
||||
},
|
||||
yes:function(index,layer_index){
|
||||
myPostN('sync_database_repair_log', {db:db, sign:'',op:'do'}, function(data){});
|
||||
layer.msg("执行成功");
|
||||
|
||||
requestLogs(layer_index);
|
||||
reqTimer = setInterval(function(){
|
||||
requestLogs(layer_index);
|
||||
},3000);
|
||||
},
|
||||
success:function(){
|
||||
},
|
||||
btn3: function(){
|
||||
myPostN('sync_database_repair_log', {db:db, sign:'',op:'cmd'}, function(rdata){
|
||||
var rdata = $.parseJSON(rdata.data);
|
||||
layer.open({
|
||||
title: "手动执行命令CMD",
|
||||
area: ['600px', '180px'],
|
||||
type:1,
|
||||
closeBtn: 1,
|
||||
shadeClose: false,
|
||||
btn:["复制","取消"],
|
||||
content: '<div class="pd15">\
|
||||
<div class="divtable">\
|
||||
<pre class="layui-code">'+rdata.data+'</pre>\
|
||||
</div>\
|
||||
</div>',
|
||||
success:function(){
|
||||
copyText(rdata.data);
|
||||
},
|
||||
yes:function(){
|
||||
copyText(rdata.data);
|
||||
}
|
||||
});
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function addSlaveSSH(ip=''){
|
||||
|
||||
myPost('get_slave_ssh_by_ip', {ip:ip}, function(rdata){
|
||||
@@ -2129,7 +2284,7 @@ function addSlaveSyncUser(ip=''){
|
||||
|
||||
var index = layer.open({
|
||||
type: 1,
|
||||
area: ['500px','470px'],
|
||||
area: ['500px','510px'],
|
||||
title: '同步账户',
|
||||
closeBtn: 1,
|
||||
shift: 5,
|
||||
@@ -2141,7 +2296,16 @@ function addSlaveSyncUser(ip=''){
|
||||
<div class='line'><span class='tname'>同步账户</span><div class='info-r'><input name='user' class='bt-input-text mr5' type='text' style='width:330px;' value='"+user+"'></div></div>\
|
||||
<div class='line'><span class='tname'>同步密码</span><div class='info-r'><input name='pass' class='bt-input-text mr5' type='text' style='width:330px;' value='"+pass+"'></div></div>\
|
||||
<div class='line'>\
|
||||
<span class='tname'>CMD[必须填写]</span>\
|
||||
<span class='tname'>同步模式</span>\
|
||||
<div class='info-r'>\
|
||||
<select class='bt-input-text mr5' name='mode'>\
|
||||
<option value='0' "+( mode == '0' ? 'selected="selected"' : '')+">经典</option>\
|
||||
<option value='1' "+( mode == '1' ? 'selected="selected"' : '')+">GTID</option>\
|
||||
</select>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class='line'>\
|
||||
<span class='tname'>CMD[必填]</span>\
|
||||
<div class='info-r'><textarea class='bt-input-text mr5' row='20' cols='30' name='cmd' style='width:330px;height:150px;'></textarea></div>\
|
||||
</div>\
|
||||
<input type='hidden' name='mode' value='"+mode+"' />\
|
||||
@@ -2150,6 +2314,7 @@ function addSlaveSyncUser(ip=''){
|
||||
$('textarea[name="cmd"]').html(cmd);
|
||||
$('textarea[name="cmd"]').change(function(){
|
||||
var val = $(this).val();
|
||||
val = val.replace(';','');
|
||||
var a = {};
|
||||
if (val.toLowerCase().indexOf('for')>0){
|
||||
cmd_tmp = val.split('for');
|
||||
@@ -2172,14 +2337,16 @@ function addSlaveSyncUser(ip=''){
|
||||
a[kv[0]] = kv[1].replace("'",'').replace("'",'');
|
||||
}
|
||||
|
||||
$('input[name="ip"]').val(a['MASTER_HOST']);
|
||||
$('input[name="port"]').val(a['MASTER_PORT']);
|
||||
$('input[name="user"]').val(a['MASTER_USER']);
|
||||
$('input[name="pass"]').val(a['MASTER_PASSWORD']);
|
||||
|
||||
console.log(a['MASTER_AUTO_POSITION'],typeof(a['MASTER_AUTO_POSITION']));
|
||||
if (typeof(a['MASTER_AUTO_POSITION']) != 'undefined' ){
|
||||
$('input[name="mode"]').val('1');
|
||||
if ('MASTER_HOST' in a){
|
||||
$('input[name="ip"]').val(a['MASTER_HOST']);
|
||||
$('input[name="port"]').val(a['MASTER_PORT']);
|
||||
$('input[name="user"]').val(a['MASTER_USER']);
|
||||
$('input[name="pass"]').val(a['MASTER_PASSWORD']);
|
||||
} else {
|
||||
$('input[name="ip"]').val(a['SOURCE_HOST']);
|
||||
$('input[name="port"]').val(a['SOURCE_PORT']);
|
||||
$('input[name="user"]').val(a['SOURCE_USER']);
|
||||
$('input[name="pass"]').val(a['SOURCE_PASSWORD']);
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -2189,7 +2356,7 @@ function addSlaveSyncUser(ip=''){
|
||||
var user = $('input[name="user"]').val();
|
||||
var pass = $('input[name="pass"]').val();
|
||||
var cmd = $('textarea[name="cmd"]').val();
|
||||
var mode = $('input[name="mode"]').val();
|
||||
var mode = $('select[name="mode"]').val();
|
||||
|
||||
var data = {ip:ip,port:port,cmd:cmd,user:user,pass:pass,mode:mode};
|
||||
myPost('add_slave_sync_user', data, function(ret_data){
|
||||
@@ -2459,6 +2626,8 @@ function masterOrSlaveConf(version=''){
|
||||
_data['page'] = page;
|
||||
_data['page_size'] = 10;
|
||||
|
||||
var mdb_ver = $('.plugin_version').attr('version');
|
||||
|
||||
myPost('get_slave_list', _data, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
var list = '';
|
||||
@@ -2467,22 +2636,38 @@ function masterOrSlaveConf(version=''){
|
||||
for(i in rdata.data){
|
||||
|
||||
var v = rdata.data[i];
|
||||
if ('Channel_Name' in v){
|
||||
if ('Channel_Name' in v && v['Channel_Name'] !=''){
|
||||
isHasSign = true;
|
||||
}
|
||||
|
||||
var status = "<a data-id="+i+" class='btlink db_error'>异常</>";
|
||||
if (v['Slave_SQL_Running'] == 'Yes' && v['Slave_IO_Running'] == 'Yes'){
|
||||
status = "正常";
|
||||
}
|
||||
if (mdb_ver >= 8){
|
||||
if (v['Replica_SQL_Running'] == 'Yes' && v['Replica_IO_Running'] == 'Yes'){
|
||||
status = "正常";
|
||||
}
|
||||
|
||||
list += '<tr>';
|
||||
list += '<td>' + rdata.data[i]['Master_Host'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Master_Port'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Master_User'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Master_Log_File'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Slave_IO_Running'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Slave_SQL_Running'] +'</td>';
|
||||
list += '<tr>';
|
||||
list += '<td>' + rdata.data[i]['Source_Host'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Source_Port'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Source_User'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Relay_Source_Log_File'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Replica_IO_Running'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Replica_SQL_Running'] +'</td>';
|
||||
|
||||
} else {
|
||||
if (v['Slave_SQL_Running'] == 'Yes' && v['Slave_IO_Running'] == 'Yes'){
|
||||
status = "正常";
|
||||
}
|
||||
|
||||
list += '<tr>';
|
||||
list += '<td>' + rdata.data[i]['Master_Host'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Master_Port'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Master_User'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Master_Log_File'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Slave_IO_Running'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Slave_SQL_Running'] +'</td>';
|
||||
}
|
||||
|
||||
|
||||
if (isHasSign){
|
||||
list += '<td>' + v['Channel_Name'] +'</td>';
|
||||
@@ -2554,6 +2739,7 @@ function masterOrSlaveConf(version=''){
|
||||
<td>"+(info['Slave_SQL_Running_State'] == '' ? '无':info['Slave_SQL_Running_State']) +"</td>\
|
||||
</tr>";
|
||||
|
||||
|
||||
var btn_list = ['复制错误',"取消"];
|
||||
if (info['Last_IO_Error'].search(/1236/i)>0){
|
||||
btn_list = ['复制错误',"取消","尝试修复"];
|
||||
@@ -2637,7 +2823,8 @@ function masterOrSlaveConf(version=''){
|
||||
list += '<td>' + rdata.data[i]['name'] +'</td>';
|
||||
list += '<td style="text-align:right">' +
|
||||
'<a href="javascript:;" class="btlink" onclick="setDbSlave(\''+rdata.data[i]['name']+'\')" title="加入|退出">'+(rdata.data[i]['slave']?'退出':'加入')+'</a> | ' +
|
||||
'<a href="javascript:;" class="btlink" onclick="getFullSyncStatus(\''+rdata.data[i]['name']+'\')" title="同步">同步</a>' +
|
||||
'<a href="javascript:;" class="btlink" onclick="getFullSyncStatus(\''+rdata.data[i]['name']+'\')" title="同步">同步</a> | ' +
|
||||
'<a href="javascript:;" class="btlink" onclick="dataSyncVerify(\''+rdata.data[i]['name']+'\')" title="数据校验">数据校验</a>' +
|
||||
'</td>';
|
||||
list += '</tr>';
|
||||
}
|
||||
@@ -2685,7 +2872,7 @@ function masterOrSlaveConf(version=''){
|
||||
<p class="conf_p">\
|
||||
<span class="f14 c6 mr20">Master[主]配置</span><span class="f14 c6 mr20"></span>\
|
||||
<button class="btn '+(!rdata.status ? 'btn-danger' : 'btn-success')+' btn-xs btn-master">'+(!rdata.status ? '未开启' : '已开启') +'</button>\
|
||||
<button class="btn btn-success btn-xs" onclick="resetMaster()" >重置</button>\
|
||||
<button class="btn btn-success btn-xs" onclick="resetMaster()">重置</button>\
|
||||
</p>\
|
||||
<hr/>\
|
||||
<!-- master list -->\
|
||||
|
||||
@@ -65,7 +65,7 @@ class backupTools:
|
||||
if len(content) > 100:
|
||||
mw.writeFile(my_cnf, content)
|
||||
|
||||
cmd = db_path + "/bin/usr/bin/mysqldump --defaults-file=" + my_cnf + " --single-transaction -q --default-character-set=utf8 " + \
|
||||
cmd = db_path + "/bin/usr/bin/mysqldump --defaults-file=" + my_cnf + " --single-transaction -q --default-character-set=utf8mb4 " + \
|
||||
name + " | gzip > " + filename
|
||||
mw.execShell(cmd)
|
||||
|
||||
|
||||
@@ -39,16 +39,19 @@ if [ "$OSNAME" == "centos" ];then
|
||||
OS_SIGN=1.el${VERSION_ID}
|
||||
elif [ "$OSNAME" == "fedora" ]; then
|
||||
OS_SIGN=10.fc${VERSION_ID}
|
||||
elif [ "$OSNAME" == "suse" ]; then
|
||||
OS_SIGN=1.sl${VERSION_ID}
|
||||
elif [ "$OSNAME" == "opensuse" ]; then
|
||||
OS_SIGN=1.sl${VERSION_ID:0:2}
|
||||
fi
|
||||
|
||||
MYSQL_VER=5.7.39
|
||||
MYSQL_VER=5.7.44
|
||||
SUFFIX_NAME=${MYSQL_VER}-${OS_SIGN}.${ARCH}
|
||||
|
||||
YUM_INSTALL()
|
||||
{
|
||||
|
||||
mkdir -p /var/run/mysqld
|
||||
chown mysql -R /var/run/mysqld
|
||||
|
||||
#######
|
||||
mkdir -p $myDir
|
||||
|
||||
@@ -71,6 +74,38 @@ rpm2cpio ${myDir}/mysql-community-test-${SUFFIX_NAME}.rpm | cpio -div
|
||||
#######
|
||||
}
|
||||
|
||||
ZYPPER_INSTALL()
|
||||
{
|
||||
zypper install -y libstdc++6
|
||||
|
||||
mkdir -p /var/run/mysqld
|
||||
chown mysql -R /var/run/mysqld
|
||||
#######
|
||||
mkdir -p $myDir
|
||||
|
||||
wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-5.7/mysql-${SUFFIX_NAME}.rpm-bundle.tar
|
||||
echo "wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-5.7/mysql-${SUFFIX_NAME}.rpm-bundle.tar"
|
||||
|
||||
cd ${myDir} && tar vxf mysql-${SUFFIX_NAME}.rpm-bundle.tar
|
||||
|
||||
mkdir -p ${serverPath}/mysql-yum/bin && cd ${serverPath}/mysql-yum/bin
|
||||
|
||||
rpm2cpio ${myDir}/mysql-community-client-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-client-${SUFFIX_NAME}.x86_64.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-common-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-debuginfo-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-devel-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-embedded-compat-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-icu-data-files-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-libs-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-libs-compat-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-server-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-server-debug-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-test-${SUFFIX_NAME}.rpm | cpio -div
|
||||
|
||||
#######
|
||||
}
|
||||
|
||||
YUM_UNINSTALL()
|
||||
{
|
||||
### YUM卸载 START ########
|
||||
@@ -84,13 +119,6 @@ Install_mysql()
|
||||
{
|
||||
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
if id mysql &> /dev/null ;then
|
||||
echo "mysql uid is `id -u mysql`"
|
||||
echo "mysql shell is `grep "^mysql:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd mysql
|
||||
useradd -g mysql mysql
|
||||
fi
|
||||
|
||||
mkdir -p $serverPath/mysql-yum
|
||||
|
||||
@@ -98,6 +126,11 @@ Install_mysql()
|
||||
if [ "$isYum" != "" ];then
|
||||
YUM_INSTALL
|
||||
fi
|
||||
|
||||
isZypper=`which zypper`
|
||||
if [ "$isZypper" != "" ];then
|
||||
ZYPPER_INSTALL
|
||||
fi
|
||||
|
||||
rm -rf $myDir
|
||||
echo '5.7' > $serverPath/mysql-yum/version.pl
|
||||
@@ -106,10 +139,7 @@ Install_mysql()
|
||||
|
||||
Uninstall_mysql()
|
||||
{
|
||||
isYum=`which yum`
|
||||
if [ "$isYum" != "" ];then
|
||||
YUM_UNINSTALL
|
||||
fi
|
||||
YUM_UNINSTALL
|
||||
rm -rf $serverPath/mysql-yum
|
||||
echo '卸载完成' > $install_tmp
|
||||
}
|
||||
|
||||
@@ -35,16 +35,18 @@ if [ "$OSNAME" == "centos" ];then
|
||||
OS_SIGN=1.el${VERSION_ID}
|
||||
elif [ "$OSNAME" == "fedora" ]; then
|
||||
OS_SIGN=10.fc${VERSION_ID}
|
||||
elif [ "$OSNAME" == "suse" ]; then
|
||||
OS_SIGN=1.sl${VERSION_ID}
|
||||
elif [ "$OSNAME" == "opensuse" ]; then
|
||||
OS_SIGN=1.sl${VERSION_ID:0:2}
|
||||
fi
|
||||
|
||||
MYSQL_VER=8.0.30
|
||||
MYSQL_VER=8.0.37
|
||||
SUFFIX_NAME=${MYSQL_VER}-${OS_SIGN}.${ARCH}
|
||||
|
||||
YUM_INSTALL()
|
||||
{
|
||||
|
||||
mkdir -p /var/run/mysqld
|
||||
chown mysql -R /var/run/mysqld
|
||||
#######
|
||||
mkdir -p $myDir
|
||||
|
||||
@@ -69,6 +71,37 @@ rpm2cpio ${myDir}/mysql-community-test-${SUFFIX_NAME}.rpm | cpio -div
|
||||
#######
|
||||
}
|
||||
|
||||
ZYPPER_INSTALL()
|
||||
{
|
||||
zypper install -y libstdc++6
|
||||
|
||||
mkdir -p /var/run/mysqld
|
||||
chown mysql -R /var/run/mysqld
|
||||
#######
|
||||
mkdir -p $myDir
|
||||
|
||||
wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.0/mysql-${SUFFIX_NAME}.rpm-bundle.tar
|
||||
cd ${myDir} && tar vxf mysql-${SUFFIX_NAME}.rpm-bundle.tar
|
||||
echo "wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.0/mysql-${SUFFIX_NAME}.rpm-bundle.tar"
|
||||
|
||||
mkdir -p ${serverPath}/mysql-yum/bin && cd ${serverPath}/mysql-yum/bin
|
||||
|
||||
rpm2cpio ${myDir}/mysql-community-client-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-client-${SUFFIX_NAME}.x86_64.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-common-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-debuginfo-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-devel-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-embedded-compat-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-icu-data-files-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-libs-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-libs-compat-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-server-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-server-debug-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-test-${SUFFIX_NAME}.rpm | cpio -div
|
||||
|
||||
#######
|
||||
}
|
||||
|
||||
YUM_UNINSTALL()
|
||||
{
|
||||
### YUM卸载 START ########
|
||||
@@ -82,21 +115,21 @@ Install_mysql()
|
||||
{
|
||||
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
if id mysql &> /dev/null ;then
|
||||
echo "mysql uid is `id -u mysql`"
|
||||
echo "mysql shell is `grep "^mysql:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd mysql
|
||||
useradd -g mysql mysql
|
||||
fi
|
||||
|
||||
mkdir -p $serverPath/mysql-yum
|
||||
mkdir -p /var/run/mysqld
|
||||
chown mysql -R /var/run/mysqld
|
||||
|
||||
isYum=`which yum`
|
||||
if [ "$isYum" != "" ];then
|
||||
YUM_INSTALL
|
||||
fi
|
||||
|
||||
isZypper=`which zypper`
|
||||
if [ "$isZypper" != "" ];then
|
||||
ZYPPER_INSTALL
|
||||
fi
|
||||
|
||||
rm -rf $myDir
|
||||
|
||||
echo '8.0' > $serverPath/mysql-yum/version.pl
|
||||
@@ -105,10 +138,7 @@ Install_mysql()
|
||||
|
||||
Uninstall_mysql()
|
||||
{
|
||||
isYum=`which yum`
|
||||
if [ "$isYum" != "" ];then
|
||||
YUM_UNINSTALL
|
||||
fi
|
||||
YUM_UNINSTALL
|
||||
rm -rf $serverPath/mysql-yum
|
||||
echo '卸载完成'
|
||||
}
|
||||
|
||||
Executable
+153
@@ -0,0 +1,153 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#!/bin/bash
|
||||
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
|
||||
# https://downloads.mysql.com/archives/community/
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
sysName=`uname`
|
||||
|
||||
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
myDir=${serverPath}/source/mysql-yum
|
||||
|
||||
ARCH=`uname -m`
|
||||
ARCH_NAME=''
|
||||
case $(uname -m) in
|
||||
i386) ARCH_NAME="386" ;;
|
||||
i686) ARCH_NAME="386" ;;
|
||||
x86_64) ARCH_NAME="amd64" ;;
|
||||
arm) ARCH_NAME="arm64" ;;
|
||||
esac
|
||||
|
||||
bash ${rootPath}/scripts/getos.sh
|
||||
OSNAME=`cat ${rootPath}/data/osname.pl`
|
||||
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
echo "VERSION_ID:${VERSION_ID}"
|
||||
|
||||
OS_SIGN=1.el9
|
||||
if [ "$OSNAME" == "centos" ];then
|
||||
OS_SIGN=1.el${VERSION_ID}
|
||||
elif [ "$OSNAME" == "fedora" ]; then
|
||||
OS_SIGN=10.fc${VERSION_ID}
|
||||
elif [ "$OSNAME" == "opensuse" ]; then
|
||||
OS_SIGN=1.sl${VERSION_ID:0:2}
|
||||
fi
|
||||
|
||||
MYSQL_VER=8.2.0
|
||||
SUFFIX_NAME=${MYSQL_VER}-${OS_SIGN}.${ARCH}
|
||||
|
||||
YUM_INSTALL()
|
||||
{
|
||||
|
||||
mkdir -p /var/run/mysqld
|
||||
chown mysql -R /var/run/mysqld
|
||||
|
||||
#######
|
||||
mkdir -p $myDir
|
||||
|
||||
wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.2/mysql-${SUFFIX_NAME}.rpm-bundle.tar
|
||||
cd ${myDir} && tar vxf mysql-${SUFFIX_NAME}.rpm-bundle.tar
|
||||
|
||||
mkdir -p ${serverPath}/mysql-yum/bin && cd ${serverPath}/mysql-yum/bin
|
||||
|
||||
rpm2cpio ${myDir}/mysql-community-client-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-client-${SUFFIX_NAME}.x86_64.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-common-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-debuginfo-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-devel-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-embedded-compat-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-icu-data-files-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-libs-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-libs-compat-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-server-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-server-debug-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-test-${SUFFIX_NAME}.rpm | cpio -div
|
||||
|
||||
#######
|
||||
}
|
||||
|
||||
ZYPPER_INSTALL()
|
||||
{
|
||||
zypper install -y libstdc++6
|
||||
|
||||
mkdir -p /var/run/mysqld
|
||||
chown mysql -R /var/run/mysqld
|
||||
#######
|
||||
mkdir -p $myDir
|
||||
|
||||
wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.2/mysql-${SUFFIX_NAME}.rpm-bundle.tar
|
||||
echo "wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.2/mysql-${SUFFIX_NAME}.rpm-bundle.tar"
|
||||
cd ${myDir} && tar vxf mysql-${SUFFIX_NAME}.rpm-bundle.tar
|
||||
|
||||
mkdir -p ${serverPath}/mysql-yum/bin && cd ${serverPath}/mysql-yum/bin
|
||||
|
||||
rpm2cpio ${myDir}/mysql-community-client-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-client-${SUFFIX_NAME}.x86_64.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-common-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-debuginfo-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-devel-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-embedded-compat-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-icu-data-files-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-libs-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-libs-compat-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-server-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-server-debug-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-test-${SUFFIX_NAME}.rpm | cpio -div
|
||||
|
||||
#######
|
||||
}
|
||||
|
||||
YUM_UNINSTALL()
|
||||
{
|
||||
### YUM卸载 START ########
|
||||
# yum -y remove mysql-server
|
||||
rm -rf ${myDir}
|
||||
### YUM卸载 END ########
|
||||
}
|
||||
|
||||
|
||||
Install_mysql()
|
||||
{
|
||||
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
|
||||
mkdir -p $serverPath/mysql-yum
|
||||
|
||||
mkdir -p /var/lib/mysql
|
||||
chown mysql -R /var/lib/mysql
|
||||
|
||||
isYum=`which yum`
|
||||
if [ "$isYum" != "" ];then
|
||||
YUM_INSTALL
|
||||
fi
|
||||
|
||||
isZypper=`which zypper`
|
||||
if [ "$isZypper" != "" ];then
|
||||
ZYPPER_INSTALL
|
||||
fi
|
||||
|
||||
rm -rf $myDir
|
||||
|
||||
echo '8.2' > $serverPath/mysql-yum/version.pl
|
||||
echo '安装完成'
|
||||
}
|
||||
|
||||
Uninstall_mysql()
|
||||
{
|
||||
YUM_UNINSTALL
|
||||
rm -rf $serverPath/mysql-yum
|
||||
echo '卸载完成'
|
||||
}
|
||||
|
||||
action=$1
|
||||
if [ "${1}" == 'install' ];then
|
||||
Install_mysql
|
||||
else
|
||||
Uninstall_mysql
|
||||
fi
|
||||
Executable
+153
@@ -0,0 +1,153 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#!/bin/bash
|
||||
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
|
||||
# https://downloads.mysql.com/archives/community/
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
sysName=`uname`
|
||||
|
||||
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
myDir=${serverPath}/source/mysql-yum
|
||||
|
||||
ARCH=`uname -m`
|
||||
ARCH_NAME=''
|
||||
case $(uname -m) in
|
||||
i386) ARCH_NAME="386" ;;
|
||||
i686) ARCH_NAME="386" ;;
|
||||
x86_64) ARCH_NAME="amd64" ;;
|
||||
arm) ARCH_NAME="arm64" ;;
|
||||
esac
|
||||
|
||||
bash ${rootPath}/scripts/getos.sh
|
||||
OSNAME=`cat ${rootPath}/data/osname.pl`
|
||||
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
echo "VERSION_ID:${VERSION_ID}"
|
||||
|
||||
OS_SIGN=1.el9
|
||||
if [ "$OSNAME" == "centos" ];then
|
||||
OS_SIGN=1.el${VERSION_ID}
|
||||
elif [ "$OSNAME" == "fedora" ]; then
|
||||
OS_SIGN=10.fc${VERSION_ID}
|
||||
elif [ "$OSNAME" == "opensuse" ]; then
|
||||
OS_SIGN=1.sl${VERSION_ID:0:2}
|
||||
fi
|
||||
|
||||
MYSQL_VER=8.3.0
|
||||
SUFFIX_NAME=${MYSQL_VER}-${OS_SIGN}.${ARCH}
|
||||
|
||||
YUM_INSTALL()
|
||||
{
|
||||
|
||||
mkdir -p /var/run/mysqld
|
||||
chown mysql -R /var/run/mysqld
|
||||
|
||||
#######
|
||||
mkdir -p $myDir
|
||||
|
||||
wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.3/mysql-${SUFFIX_NAME}.rpm-bundle.tar
|
||||
cd ${myDir} && tar vxf mysql-${SUFFIX_NAME}.rpm-bundle.tar
|
||||
|
||||
mkdir -p ${serverPath}/mysql-yum/bin && cd ${serverPath}/mysql-yum/bin
|
||||
|
||||
rpm2cpio ${myDir}/mysql-community-client-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-client-${SUFFIX_NAME}.x86_64.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-common-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-debuginfo-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-devel-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-embedded-compat-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-icu-data-files-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-libs-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-libs-compat-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-server-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-server-debug-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-test-${SUFFIX_NAME}.rpm | cpio -div
|
||||
|
||||
#######
|
||||
}
|
||||
|
||||
ZYPPER_INSTALL()
|
||||
{
|
||||
zypper install -y libstdc++6
|
||||
|
||||
mkdir -p /var/run/mysqld
|
||||
chown mysql -R /var/run/mysqld
|
||||
#######
|
||||
mkdir -p $myDir
|
||||
|
||||
wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.3/mysql-${SUFFIX_NAME}.rpm-bundle.tar
|
||||
echo "wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.3/mysql-${SUFFIX_NAME}.rpm-bundle.tar"
|
||||
cd ${myDir} && tar vxf mysql-${SUFFIX_NAME}.rpm-bundle.tar
|
||||
|
||||
mkdir -p ${serverPath}/mysql-yum/bin && cd ${serverPath}/mysql-yum/bin
|
||||
|
||||
rpm2cpio ${myDir}/mysql-community-client-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-client-${SUFFIX_NAME}.x86_64.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-common-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-debuginfo-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-devel-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-embedded-compat-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-icu-data-files-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-libs-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-libs-compat-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-server-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-server-debug-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-test-${SUFFIX_NAME}.rpm | cpio -div
|
||||
|
||||
#######
|
||||
}
|
||||
|
||||
YUM_UNINSTALL()
|
||||
{
|
||||
### YUM卸载 START ########
|
||||
# yum -y remove mysql-server
|
||||
rm -rf ${myDir}
|
||||
### YUM卸载 END ########
|
||||
}
|
||||
|
||||
|
||||
Install_mysql()
|
||||
{
|
||||
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
|
||||
mkdir -p $serverPath/mysql-yum
|
||||
|
||||
mkdir -p /var/lib/mysql
|
||||
chown mysql -R /var/lib/mysql
|
||||
|
||||
isYum=`which yum`
|
||||
if [ "$isYum" != "" ];then
|
||||
YUM_INSTALL
|
||||
fi
|
||||
|
||||
isZypper=`which zypper`
|
||||
if [ "$isZypper" != "" ];then
|
||||
ZYPPER_INSTALL
|
||||
fi
|
||||
|
||||
rm -rf $myDir
|
||||
|
||||
echo '8.3' > $serverPath/mysql-yum/version.pl
|
||||
echo '安装完成'
|
||||
}
|
||||
|
||||
Uninstall_mysql()
|
||||
{
|
||||
YUM_UNINSTALL
|
||||
rm -rf $serverPath/mysql-yum
|
||||
echo '卸载完成'
|
||||
}
|
||||
|
||||
action=$1
|
||||
if [ "${1}" == 'install' ];then
|
||||
Install_mysql
|
||||
else
|
||||
Uninstall_mysql
|
||||
fi
|
||||
Executable
+155
@@ -0,0 +1,155 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#!/bin/bash
|
||||
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
|
||||
# https://downloads.mysql.com/archives/community/
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
sysName=`uname`
|
||||
|
||||
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
myDir=${serverPath}/source/mysql-yum
|
||||
|
||||
ARCH=`uname -m`
|
||||
ARCH_NAME=''
|
||||
case $(uname -m) in
|
||||
i386) ARCH_NAME="386" ;;
|
||||
i686) ARCH_NAME="386" ;;
|
||||
x86_64) ARCH_NAME="amd64" ;;
|
||||
arm) ARCH_NAME="arm64" ;;
|
||||
esac
|
||||
|
||||
bash ${rootPath}/scripts/getos.sh
|
||||
OSNAME=`cat ${rootPath}/data/osname.pl`
|
||||
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
echo "VERSION_ID:${VERSION_ID}"
|
||||
|
||||
OS_SIGN=1.el9
|
||||
if [ "$OSNAME" == "centos" ];then
|
||||
OS_SIGN=1.el${VERSION_ID}
|
||||
elif [ "$OSNAME" == "fedora" ]; then
|
||||
OS_SIGN=10.fc${VERSION_ID}
|
||||
elif [ "$OSNAME" == "opensuse" ]; then
|
||||
OS_SIGN=1.sl${VERSION_ID:0:2}
|
||||
fi
|
||||
|
||||
MYSQL_VER=8.4.0
|
||||
SUFFIX_NAME=${MYSQL_VER}-${OS_SIGN}.${ARCH}
|
||||
|
||||
YUM_INSTALL()
|
||||
{
|
||||
|
||||
mkdir -p /var/run/mysqld
|
||||
chown mysql -R /var/run/mysqld
|
||||
|
||||
#######
|
||||
mkdir -p $myDir
|
||||
|
||||
# https://dev.mysql.com/get/Downloads/MySQL-8.4/mysql-${SUFFIX_NAME}.rpm-bundle.tar
|
||||
# https://cdn.mysql.com/archives/mysql-8.4/mysql-${SUFFIX_NAME}.rpm-bundle.tar
|
||||
|
||||
wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://dev.mysql.com/get/Downloads/MySQL-8.4/mysql-${SUFFIX_NAME}.rpm-bundle.tar
|
||||
cd ${myDir} && tar vxf mysql-${SUFFIX_NAME}.rpm-bundle.tar
|
||||
|
||||
mkdir -p ${serverPath}/mysql-yum/bin && cd ${serverPath}/mysql-yum/bin
|
||||
|
||||
rpm2cpio ${myDir}/mysql-community-client-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-client-${SUFFIX_NAME}.x86_64.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-common-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-debuginfo-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-devel-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-embedded-compat-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-icu-data-files-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-libs-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-libs-compat-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-server-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-server-debug-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-test-${SUFFIX_NAME}.rpm | cpio -div
|
||||
|
||||
#######
|
||||
}
|
||||
|
||||
ZYPPER_INSTALL()
|
||||
{
|
||||
zypper install -y libstdc++6
|
||||
|
||||
mkdir -p /var/run/mysqld
|
||||
chown mysql -R /var/run/mysqld
|
||||
#######
|
||||
mkdir -p $myDir
|
||||
|
||||
wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.4/mysql-${SUFFIX_NAME}.rpm-bundle.tar
|
||||
echo "wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.4/mysql-${SUFFIX_NAME}.rpm-bundle.tar"
|
||||
cd ${myDir} && tar vxf mysql-${SUFFIX_NAME}.rpm-bundle.tar
|
||||
|
||||
mkdir -p ${serverPath}/mysql-yum/bin && cd ${serverPath}/mysql-yum/bin
|
||||
|
||||
rpm2cpio ${myDir}/mysql-community-client-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-client-${SUFFIX_NAME}.x86_64.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-common-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-debuginfo-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-devel-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-embedded-compat-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-icu-data-files-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-libs-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-libs-compat-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-server-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-server-debug-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-test-${SUFFIX_NAME}.rpm | cpio -div
|
||||
|
||||
#######
|
||||
}
|
||||
|
||||
YUM_UNINSTALL()
|
||||
{
|
||||
### YUM卸载 START ########
|
||||
# yum -y remove mysql-server
|
||||
rm -rf ${myDir}
|
||||
### YUM卸载 END ########
|
||||
}
|
||||
|
||||
|
||||
Install_mysql()
|
||||
{
|
||||
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
mkdir -p $serverPath/mysql-yum
|
||||
|
||||
mkdir -p /var/lib/mysql
|
||||
chown mysql -R /var/lib/mysql/
|
||||
|
||||
isYum=`which yum`
|
||||
if [ "$isYum" != "" ];then
|
||||
YUM_INSTALL
|
||||
fi
|
||||
|
||||
isZypper=`which zypper`
|
||||
if [ "$isZypper" != "" ];then
|
||||
ZYPPER_INSTALL
|
||||
fi
|
||||
|
||||
rm -rf $myDir
|
||||
|
||||
echo '8.4' > $serverPath/mysql-yum/version.pl
|
||||
echo '安装完成'
|
||||
}
|
||||
|
||||
Uninstall_mysql()
|
||||
{
|
||||
YUM_UNINSTALL
|
||||
rm -rf $serverPath/mysql-yum
|
||||
echo '卸载完成'
|
||||
}
|
||||
|
||||
action=$1
|
||||
if [ "${1}" == 'install' ];then
|
||||
Install_mysql
|
||||
else
|
||||
Uninstall_mysql
|
||||
fi
|
||||
Executable
+156
@@ -0,0 +1,156 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#!/bin/bash
|
||||
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
|
||||
# https://downloads.mysql.com/archives/community/
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
sysName=`uname`
|
||||
|
||||
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
myDir=${serverPath}/source/mysql-yum
|
||||
|
||||
ARCH=`uname -m`
|
||||
ARCH_NAME=''
|
||||
case $(uname -m) in
|
||||
i386) ARCH_NAME="386" ;;
|
||||
i686) ARCH_NAME="386" ;;
|
||||
x86_64) ARCH_NAME="amd64" ;;
|
||||
arm) ARCH_NAME="arm64" ;;
|
||||
esac
|
||||
|
||||
bash ${rootPath}/scripts/getos.sh
|
||||
OSNAME=`cat ${rootPath}/data/osname.pl`
|
||||
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
echo "VERSION_ID:${VERSION_ID}"
|
||||
|
||||
OS_SIGN=1.el9
|
||||
if [ "$OSNAME" == "centos" ];then
|
||||
OS_SIGN=1.el${VERSION_ID}
|
||||
elif [ "$OSNAME" == "fedora" ]; then
|
||||
OS_SIGN=10.fc${VERSION_ID}
|
||||
elif [ "$OSNAME" == "opensuse" ]; then
|
||||
OS_SIGN=1.sl${VERSION_ID:0:2}
|
||||
fi
|
||||
|
||||
MYSQL_VER=9.0.1
|
||||
SUFFIX_NAME=${MYSQL_VER}-${OS_SIGN}.${ARCH}
|
||||
|
||||
YUM_INSTALL()
|
||||
{
|
||||
|
||||
mkdir -p /var/run/mysqld
|
||||
chown mysql -R /var/run/mysqld
|
||||
|
||||
#######
|
||||
mkdir -p $myDir
|
||||
|
||||
# https://dev.mysql.com/get/Downloads/MySQL-8.4/mysql-${SUFFIX_NAME}.rpm-bundle.tar
|
||||
# https://cdn.mysql.com/archives/mysql-8.4/mysql-${SUFFIX_NAME}.rpm-bundle.tar
|
||||
|
||||
wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://dev.mysql.com/get/Downloads/MySQL-9.0/mysql-${SUFFIX_NAME}.rpm-bundle.tar
|
||||
cd ${myDir} && tar vxf mysql-${SUFFIX_NAME}.rpm-bundle.tar
|
||||
|
||||
mkdir -p ${serverPath}/mysql-yum/bin && cd ${serverPath}/mysql-yum/bin
|
||||
|
||||
rpm2cpio ${myDir}/mysql-community-client-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-client-${SUFFIX_NAME}.x86_64.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-common-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-debuginfo-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-devel-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-embedded-compat-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-icu-data-files-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-libs-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-libs-compat-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-server-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-server-debug-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-test-${SUFFIX_NAME}.rpm | cpio -div
|
||||
|
||||
#######
|
||||
}
|
||||
|
||||
ZYPPER_INSTALL()
|
||||
{
|
||||
zypper install -y libstdc++6
|
||||
|
||||
mkdir -p /var/run/mysqld
|
||||
chown mysql -R /var/run/mysqld
|
||||
#######
|
||||
mkdir -p $myDir
|
||||
|
||||
|
||||
wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/Downloads/MySQL-9.0/mysql-${SUFFIX_NAME}.rpm-bundle.tar
|
||||
echo "wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/Downloads/MySQL-9.0/mysql-${SUFFIX_NAME}.rpm-bundle.tar"
|
||||
cd ${myDir} && tar vxf mysql-${SUFFIX_NAME}.rpm-bundle.tar
|
||||
|
||||
mkdir -p ${serverPath}/mysql-yum/bin && cd ${serverPath}/mysql-yum/bin
|
||||
|
||||
rpm2cpio ${myDir}/mysql-community-client-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-client-${SUFFIX_NAME}.x86_64.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-common-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-debuginfo-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-devel-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-embedded-compat-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-icu-data-files-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-libs-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-libs-compat-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-server-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-server-debug-${SUFFIX_NAME}.rpm | cpio -div
|
||||
rpm2cpio ${myDir}/mysql-community-test-${SUFFIX_NAME}.rpm | cpio -div
|
||||
|
||||
#######
|
||||
}
|
||||
|
||||
YUM_UNINSTALL()
|
||||
{
|
||||
### YUM卸载 START ########
|
||||
# yum -y remove mysql-server
|
||||
rm -rf ${myDir}
|
||||
### YUM卸载 END ########
|
||||
}
|
||||
|
||||
|
||||
Install_mysql()
|
||||
{
|
||||
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
mkdir -p $serverPath/mysql-yum
|
||||
|
||||
mkdir -p /var/lib/mysql
|
||||
chown mysql -R /var/lib/mysql/
|
||||
|
||||
isYum=`which yum`
|
||||
if [ "$isYum" != "" ];then
|
||||
YUM_INSTALL
|
||||
fi
|
||||
|
||||
isZypper=`which zypper`
|
||||
if [ "$isZypper" != "" ];then
|
||||
ZYPPER_INSTALL
|
||||
fi
|
||||
|
||||
rm -rf $myDir
|
||||
|
||||
echo '9.0' > $serverPath/mysql-yum/version.pl
|
||||
echo '安装完成'
|
||||
}
|
||||
|
||||
Uninstall_mysql()
|
||||
{
|
||||
YUM_UNINSTALL
|
||||
rm -rf $serverPath/mysql-yum
|
||||
echo '卸载完成'
|
||||
}
|
||||
|
||||
action=$1
|
||||
if [ "${1}" == 'install' ];then
|
||||
Install_mysql
|
||||
else
|
||||
Uninstall_mysql
|
||||
fi
|
||||
@@ -10,7 +10,7 @@ default-character-set = UTF8MB4
|
||||
|
||||
sha256_password_private_key_path={$SERVER_APP_PATH}/data/mysql.pem
|
||||
sha256_password_public_key_path={$SERVER_APP_PATH}/data/mysql.pub
|
||||
authentication_policy=mysql_native_password
|
||||
authentication_policy=caching_sha2_password
|
||||
|
||||
pid-file = {$SERVER_APP_PATH}/data/mysql.pid
|
||||
user = mysql
|
||||
|
||||
@@ -10,7 +10,7 @@ default-character-set = UTF8MB4
|
||||
|
||||
sha256_password_private_key_path={$SERVER_APP_PATH}/data/mysql.pem
|
||||
sha256_password_public_key_path={$SERVER_APP_PATH}/data/mysql.pub
|
||||
authentication_policy=mysql_native_password
|
||||
authentication_policy=caching_sha2_password
|
||||
|
||||
pid-file = {$SERVER_APP_PATH}/data/mysql.pid
|
||||
user = mysql
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
[client]
|
||||
user = root
|
||||
#password = your_password
|
||||
port = 3306
|
||||
socket = {$SERVER_APP_PATH}/mysql.sock
|
||||
default-character-set = UTF8MB4
|
||||
|
||||
[mysqld]
|
||||
!include {$SERVER_APP_PATH}/etc/mode/classic.cnf
|
||||
|
||||
authentication_policy=caching_sha2_password
|
||||
pid-file = {$SERVER_APP_PATH}/data/mysql.pid
|
||||
user = mysql
|
||||
port = 3306
|
||||
socket = {$SERVER_APP_PATH}/mysql.sock
|
||||
basedir = {$SERVER_APP_PATH}
|
||||
datadir = {$SERVER_APP_PATH}/data
|
||||
log-error = {$SERVER_APP_PATH}/data/error.log
|
||||
server-id = {$SERVER_ID}
|
||||
#sql-mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
|
||||
|
||||
default_storage_engine = InnoDB
|
||||
|
||||
key_buffer_size = 8M
|
||||
table_open_cache = 32
|
||||
sort_buffer_size = 256K
|
||||
net_buffer_length = 4K
|
||||
read_buffer_size = 128K
|
||||
read_rnd_buffer_size = 256K
|
||||
myisam_sort_buffer_size = 4M
|
||||
thread_cache_size = 4
|
||||
lower_case_table_names=0
|
||||
tmp_table_size = 8M
|
||||
character-set-server = UTF8MB4
|
||||
|
||||
max_connections = 500
|
||||
max_connect_errors = 100
|
||||
open_files_limit = 2560
|
||||
max_allowed_packet = 128M
|
||||
|
||||
skip_name_resolve=1
|
||||
#skip-networking
|
||||
#skip-external-locking
|
||||
#loose-skip-innodb
|
||||
#skip-grant-tables
|
||||
|
||||
log-bin=mysql-bin
|
||||
slow_query_log=1
|
||||
slow-query-log-file={$SERVER_APP_PATH}/data/mysql-slow.log
|
||||
long_query_time=10
|
||||
#log_queries_not_using_indexes=1
|
||||
#log_slow_admin_statements=1
|
||||
#log_slow_replica_statements=1
|
||||
binlog_expire_logs_seconds=2592000
|
||||
|
||||
relay-log=mdserver
|
||||
relay-log-index=mdserver
|
||||
|
||||
#多主设置
|
||||
#auto_increment_offset=2
|
||||
#auto_increment_increment=2
|
||||
|
||||
#master
|
||||
#sync_binlog=1
|
||||
|
||||
#binlog-do-db
|
||||
binlog-ignore-db = test
|
||||
binlog-ignore-db = mysql
|
||||
binlog-ignore-db = information_schema
|
||||
binlog-ignore-db = performance_schema
|
||||
|
||||
#slave
|
||||
log_replica_updates = 1
|
||||
# Prevent replication from starting automatically with MySQL
|
||||
#skip_replica_start = 1
|
||||
#replicate-do-db
|
||||
replica_skip_errors=1062,1396
|
||||
replicate-ignore-db = information_schema
|
||||
replicate-ignore-db = performance_schema
|
||||
replicate-ignore-db = mysql
|
||||
replicate-ignore-db = test
|
||||
|
||||
|
||||
innodb_data_home_dir = {$SERVER_APP_PATH}/data
|
||||
innodb_data_file_path = ibdata1:10M:autoextend
|
||||
innodb_log_group_home_dir = {$SERVER_APP_PATH}/data
|
||||
innodb_buffer_pool_size = 16M
|
||||
#innodb_log_file_size = 5M
|
||||
innodb_redo_log_capacity=10485760
|
||||
innodb_log_buffer_size = 8M
|
||||
innodb_flush_log_at_trx_commit = 1
|
||||
innodb_lock_wait_timeout = 120
|
||||
innodb_max_dirty_pages_pct = 90
|
||||
innodb_read_io_threads = 1
|
||||
innodb_write_io_threads = 1
|
||||
innodb_file_per_table=1
|
||||
|
||||
secure-file-priv={$SERVER_APP_PATH}/tmp
|
||||
|
||||
[mysqldump]
|
||||
quick
|
||||
|
||||
[mysql]
|
||||
no-auto-rehash
|
||||
|
||||
[myisamchk]
|
||||
key_buffer_size = 20M
|
||||
sort_buffer_size = 20M
|
||||
read_buffer = 2M
|
||||
write_buffer = 2M
|
||||
|
||||
[mysqlhotcopy]
|
||||
interactive-timeout
|
||||
@@ -0,0 +1,113 @@
|
||||
[client]
|
||||
user = root
|
||||
#password = your_password
|
||||
port = 3306
|
||||
socket = {$SERVER_APP_PATH}/mysql.sock
|
||||
default-character-set = UTF8MB4
|
||||
|
||||
[mysqld]
|
||||
!include {$SERVER_APP_PATH}/etc/mode/classic.cnf
|
||||
|
||||
authentication_policy=caching_sha2_password
|
||||
pid-file = {$SERVER_APP_PATH}/data/mysql.pid
|
||||
user = mysql
|
||||
port = 3306
|
||||
socket = {$SERVER_APP_PATH}/mysql.sock
|
||||
basedir = {$SERVER_APP_PATH}
|
||||
datadir = {$SERVER_APP_PATH}/data
|
||||
log-error = {$SERVER_APP_PATH}/data/error.log
|
||||
server-id = {$SERVER_ID}
|
||||
#sql-mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
|
||||
|
||||
default_storage_engine = InnoDB
|
||||
|
||||
key_buffer_size = 8M
|
||||
table_open_cache = 32
|
||||
sort_buffer_size = 256K
|
||||
net_buffer_length = 4K
|
||||
read_buffer_size = 128K
|
||||
read_rnd_buffer_size = 256K
|
||||
myisam_sort_buffer_size = 4M
|
||||
thread_cache_size = 4
|
||||
lower_case_table_names=0
|
||||
tmp_table_size = 8M
|
||||
character-set-server = UTF8MB4
|
||||
|
||||
max_connections = 500
|
||||
max_connect_errors = 100
|
||||
open_files_limit = 2560
|
||||
max_allowed_packet = 128M
|
||||
|
||||
skip_name_resolve=1
|
||||
#skip-networking
|
||||
#skip-external-locking
|
||||
#loose-skip-innodb
|
||||
#skip-grant-tables
|
||||
|
||||
log-bin=mysql-bin
|
||||
slow_query_log=1
|
||||
slow-query-log-file={$SERVER_APP_PATH}/data/mysql-slow.log
|
||||
long_query_time=10
|
||||
#log_queries_not_using_indexes=1
|
||||
#log_slow_admin_statements=1
|
||||
#log_slow_replica_statements=1
|
||||
binlog_expire_logs_seconds=2592000
|
||||
|
||||
relay-log=mdserver
|
||||
relay-log-index=mdserver
|
||||
|
||||
#多主设置
|
||||
#auto_increment_offset=2
|
||||
#auto_increment_increment=2
|
||||
|
||||
#master
|
||||
#sync_binlog=1
|
||||
|
||||
#binlog-do-db
|
||||
binlog-ignore-db = test
|
||||
binlog-ignore-db = mysql
|
||||
binlog-ignore-db = information_schema
|
||||
binlog-ignore-db = performance_schema
|
||||
|
||||
#slave
|
||||
log_replica_updates = 1
|
||||
# Prevent replication from starting automatically with MySQL
|
||||
#skip_replica_start = 1
|
||||
#replicate-do-db
|
||||
replica_skip_errors=1062,1396
|
||||
replicate-ignore-db = information_schema
|
||||
replicate-ignore-db = performance_schema
|
||||
replicate-ignore-db = mysql
|
||||
replicate-ignore-db = test
|
||||
|
||||
|
||||
innodb_data_home_dir = {$SERVER_APP_PATH}/data
|
||||
innodb_data_file_path = ibdata1:10M:autoextend
|
||||
innodb_log_group_home_dir = {$SERVER_APP_PATH}/data
|
||||
innodb_buffer_pool_size = 16M
|
||||
#innodb_log_file_size = 5M
|
||||
innodb_redo_log_capacity=10485760
|
||||
innodb_log_buffer_size = 8M
|
||||
innodb_flush_log_at_trx_commit = 1
|
||||
innodb_lock_wait_timeout = 120
|
||||
innodb_max_dirty_pages_pct = 90
|
||||
innodb_read_io_threads = 1
|
||||
innodb_write_io_threads = 1
|
||||
innodb_file_per_table=1
|
||||
|
||||
secure-file-priv={$SERVER_APP_PATH}/tmp
|
||||
|
||||
[mysqldump]
|
||||
quick
|
||||
|
||||
[mysql]
|
||||
no-auto-rehash
|
||||
|
||||
[myisamchk]
|
||||
key_buffer_size = 20M
|
||||
sort_buffer_size = 20M
|
||||
read_buffer = 2M
|
||||
write_buffer = 2M
|
||||
|
||||
[mysqlhotcopy]
|
||||
interactive-timeout
|
||||
+101
-79
@@ -88,7 +88,7 @@ def getConf():
|
||||
def getDbPort():
|
||||
file = getConf()
|
||||
content = mw.readFile(file)
|
||||
rep = 'port\s*=\s*(.*)'
|
||||
rep = r'port\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
@@ -96,7 +96,7 @@ def getDbPort():
|
||||
def getDbServerId():
|
||||
file = getConf()
|
||||
content = mw.readFile(file)
|
||||
rep = 'server-id\s*=\s*(.*)'
|
||||
rep = r'server-id\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
@@ -104,7 +104,7 @@ def getDbServerId():
|
||||
def getSocketFile():
|
||||
file = getConf()
|
||||
content = mw.readFile(file)
|
||||
rep = 'socket\s*=\s*(.*)'
|
||||
rep = r'socket\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
@@ -112,14 +112,14 @@ def getSocketFile():
|
||||
def getErrorLogsFile():
|
||||
file = getConf()
|
||||
content = mw.readFile(file)
|
||||
rep = 'log-error\s*=\s*(.*)'
|
||||
rep = r'log-error\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
def getAuthPolicy():
|
||||
file = getConf()
|
||||
content = mw.readFile(file)
|
||||
rep = 'authentication_policy\s*=\s*(.*)'
|
||||
rep = r'authentication_policy\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
if tmp:
|
||||
return tmp.groups()[0].strip()
|
||||
@@ -183,7 +183,7 @@ def pMysqlDb():
|
||||
db = mw.getMyORM()
|
||||
# MySQLdb |
|
||||
# db = mw.getMyORMDb()
|
||||
|
||||
# print(getDbPort())
|
||||
db.setPort(getDbPort())
|
||||
db.setSocket(getSocketFile())
|
||||
# db.setCharset("utf8")
|
||||
@@ -302,7 +302,7 @@ def status(version=''):
|
||||
def getDataDir():
|
||||
file = getConf()
|
||||
content = mw.readFile(file)
|
||||
rep = 'datadir\s*=\s*(.*)'
|
||||
rep = r'datadir\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
@@ -310,7 +310,7 @@ def getDataDir():
|
||||
def getLogBinName():
|
||||
file = getConf()
|
||||
content = mw.readFile(file)
|
||||
rep = 'log-bin\s*=\s*(.*)'
|
||||
rep = r'log-bin\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
@@ -318,12 +318,12 @@ def getLogBinName():
|
||||
def getPidFile():
|
||||
file = getConf()
|
||||
content = mw.readFile(file)
|
||||
rep = 'pid-file\s*=\s*(.*)'
|
||||
rep = r'pid-file\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
|
||||
def binLog():
|
||||
def binLog(version = ''):
|
||||
args = getArgs()
|
||||
conf = getConf()
|
||||
con = mw.readFile(conf)
|
||||
@@ -334,7 +334,7 @@ def binLog():
|
||||
con = con.replace('#log-bin=mysql-bin', 'log-bin=mysql-bin')
|
||||
con = con.replace('#binlog_format=mixed', 'binlog_format=mixed')
|
||||
mw.execShell('sync')
|
||||
restart()
|
||||
restart(version)
|
||||
else:
|
||||
path = getDataDir()
|
||||
if 'status' in args:
|
||||
@@ -348,7 +348,7 @@ def binLog():
|
||||
con = con.replace('log-bin=mysql-bin', '#log-bin=mysql-bin')
|
||||
con = con.replace('binlog_format=mixed', '#binlog_format=mixed')
|
||||
mw.execShell('sync')
|
||||
restart()
|
||||
restart(version)
|
||||
mw.execShell('rm -f ' + path + '/mysql-bin.*')
|
||||
|
||||
mw.writeFile(conf, con)
|
||||
@@ -424,11 +424,14 @@ def getErrorLog():
|
||||
def getShowLogFile():
|
||||
file = getConf()
|
||||
content = mw.readFile(file)
|
||||
rep = 'slow-query-log-file\s*=\s*(.*)'
|
||||
rep = r'slow-query-log-file\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
|
||||
def getMdb8Ver():
|
||||
return ['8.0','8.1','8.2','8.3','8.4','9.0']
|
||||
|
||||
def pGetDbUser():
|
||||
if mw.isAppleSystem():
|
||||
user = mw.execShell(
|
||||
@@ -589,23 +592,22 @@ def myOp(version, method):
|
||||
isInited = initMysqlData()
|
||||
if not isInited:
|
||||
|
||||
if current_os.startswith("freebsd"):
|
||||
if not mw.isSupportSystemctl():
|
||||
mw.execShell('service ' + getPluginName() + ' start')
|
||||
else:
|
||||
mw.execShell('systemctl start mysql')
|
||||
|
||||
initMysqlPwd()
|
||||
|
||||
if current_os.startswith("freebsd"):
|
||||
if not mw.isSupportSystemctl():
|
||||
mw.execShell('service ' + getPluginName() + ' stop')
|
||||
else:
|
||||
mw.execShell('systemctl stop mysql')
|
||||
|
||||
if current_os.startswith("freebsd"):
|
||||
data = mw.execShell('service ' + getPluginName() + ' ' + method)
|
||||
return 'ok'
|
||||
|
||||
mw.execShell('systemctl ' + method + ' mysql')
|
||||
if not mw.isSupportSystemctl():
|
||||
mw.execShell('service ' + getPluginName() + ' ' + method)
|
||||
else:
|
||||
mw.execShell('systemctl ' + method + ' mysql')
|
||||
return 'ok'
|
||||
except Exception as e:
|
||||
return str(e)
|
||||
@@ -615,19 +617,17 @@ def my8cmd(version, method):
|
||||
# mysql 8.0 and 5.7
|
||||
init_file = initDreplace(version)
|
||||
cmd = init_file + ' ' + method
|
||||
mdb8 = getMdb8Ver()
|
||||
try:
|
||||
if version == '5.7':
|
||||
isInited = True
|
||||
if mw.inArray(mdb8, version):
|
||||
isInited = initMysql8Data()
|
||||
else:
|
||||
isInited = initMysql57Data()
|
||||
elif version == '8.0':
|
||||
isInited = initMysql8Data()
|
||||
elif version == '8.2':
|
||||
isInited = initMysql8Data()
|
||||
elif version == '8.3':
|
||||
isInited = initMysql8Data()
|
||||
|
||||
if not isInited:
|
||||
|
||||
if mw.isAppleSystem():
|
||||
if not mw.isSupportSystemctl():
|
||||
cmd_init_start = init_file + ' start'
|
||||
subprocess.Popen(cmd_init_start, stdout=subprocess.PIPE, shell=True,
|
||||
bufsize=4096, stderr=subprocess.PIPE)
|
||||
@@ -643,7 +643,7 @@ def my8cmd(version, method):
|
||||
break
|
||||
time.sleep(1)
|
||||
|
||||
if mw.isAppleSystem():
|
||||
if not mw.isSupportSystemctl():
|
||||
cmd_init_stop = init_file + ' stop'
|
||||
subprocess.Popen(cmd_init_stop, stdout=subprocess.PIPE, shell=True,
|
||||
bufsize=4096, stderr=subprocess.PIPE)
|
||||
@@ -651,7 +651,7 @@ def my8cmd(version, method):
|
||||
else:
|
||||
mw.execShell('systemctl stop mysql')
|
||||
|
||||
if mw.isAppleSystem():
|
||||
if not mw.isSupportSystemctl():
|
||||
sub = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True,
|
||||
bufsize=4096, stderr=subprocess.PIPE)
|
||||
sub.wait(5)
|
||||
@@ -664,7 +664,10 @@ def my8cmd(version, method):
|
||||
|
||||
def appCMD(version, action):
|
||||
makeInitRsaKey(version)
|
||||
if float(version) >= 5.7:
|
||||
mdb8 = getMdb8Ver()
|
||||
mdb8.append('5.7')
|
||||
# print(mdb8)
|
||||
if mw.inArray(mdb8, version):
|
||||
status = my8cmd(version, action)
|
||||
else:
|
||||
status = myOp(version, action)
|
||||
@@ -740,7 +743,7 @@ def initdUinstall():
|
||||
def getMyDbPos():
|
||||
file = getConf()
|
||||
content = mw.readFile(file)
|
||||
rep = 'datadir\s*=\s*(.*)'
|
||||
rep = r'datadir\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
@@ -776,8 +779,7 @@ def setMyDbPos(version):
|
||||
mw.writeFile(myfile, mycnf)
|
||||
start(version)
|
||||
|
||||
result = mw.execShell(
|
||||
'ps aux|grep mysqld| grep -v grep|grep -v python')
|
||||
result = mw.execShell('ps aux|grep mysqld| grep -v grep|grep -v python')
|
||||
if len(result[0]) > 10:
|
||||
mw.writeFile('data/datadir.pl', t_datadir)
|
||||
return mw.returnJson(True, '存储目录迁移成功!')
|
||||
@@ -791,7 +793,7 @@ def setMyDbPos(version):
|
||||
def getMyPort():
|
||||
file = getConf()
|
||||
content = mw.readFile(file)
|
||||
rep = 'port\s*=\s*(.*)'
|
||||
rep = r'port\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
@@ -805,7 +807,7 @@ def setMyPort(version):
|
||||
port = args['port']
|
||||
file = getConf()
|
||||
content = mw.readFile(file)
|
||||
rep = "port\s*=\s*([0-9]+)\s*\n"
|
||||
rep = r"port\s*=\s*([0-9]+)\s*\n"
|
||||
content = re.sub(rep, 'port = ' + port + '\n', content)
|
||||
mw.writeFile(file, content)
|
||||
restart(version)
|
||||
@@ -896,7 +898,7 @@ def setDbStatus(version):
|
||||
s = 'K'
|
||||
if g in emptys:
|
||||
s = ''
|
||||
rep = '\s*' + g + '\s*=\s*\d+(M|K|k|m|G)?\n'
|
||||
rep = r'\s*' + g + r'\s*=\s*\d+(M|K|k|m|G)?\n'
|
||||
c = g + ' = ' + args[g] + s + '\n'
|
||||
if content.find(g) != -1:
|
||||
content = re.sub(rep, '\n' + c, content, 1)
|
||||
@@ -1569,10 +1571,10 @@ def addDb():
|
||||
dataAccess = args['dataAccess'].strip()
|
||||
ps = args['ps'].strip()
|
||||
|
||||
reg = "^[\w-]+$"
|
||||
reg = r"^[\w-]+$"
|
||||
if not re.match(reg, args['name']):
|
||||
return mw.returnJson(False, '数据库名称不能带有特殊符号!')
|
||||
checks = ['root', 'mysql', 'test', 'sys', 'panel_logs']
|
||||
checks = ['root', 'mysql', 'test', 'sys', 'performance_schema','information_schema']
|
||||
if dbuser in checks or len(dbuser) < 1:
|
||||
return mw.returnJson(False, '数据库用户名不合法!')
|
||||
if dbname in checks or len(dbname) < 1:
|
||||
@@ -1722,7 +1724,8 @@ def resetDbRootPwd(version):
|
||||
|
||||
pSqliteDb('config').where('id=?', (1,)).save('mysql_root', (pwd,))
|
||||
|
||||
if float(version) < 5.7:
|
||||
mdb8 = getMdb8Ver()
|
||||
if not mw.inArray(mdb8, version):
|
||||
cmd_pass = serverdir + '/bin/mysql --defaults-file=' + myconf + ' -uroot -e'
|
||||
cmd_pass = cmd_pass + '"UPDATE mysql.user SET password=PASSWORD(\'' + pwd + "') WHERE user='root';"
|
||||
cmd_pass = cmd_pass + 'flush privileges;"'
|
||||
@@ -2160,8 +2163,7 @@ def setDbMaster(version):
|
||||
|
||||
if not isHas:
|
||||
prefix = '#binlog-do-db'
|
||||
con = con.replace(
|
||||
prefix, prefix + "\nbinlog-do-db=" + args['name'])
|
||||
con = con.replace(prefix, prefix + "\nbinlog-do-db=" + args['name'])
|
||||
mw.writeFile(conf, con)
|
||||
|
||||
restart(version)
|
||||
@@ -2200,11 +2202,18 @@ def setDbSlave(version):
|
||||
|
||||
|
||||
def getMasterStatus(version=''):
|
||||
if status(version) == 'stop':
|
||||
return mw.returnJson(False, 'MySQL未启动,或正在启动中...!', [])
|
||||
|
||||
query_status_cmd = 'show slave status'
|
||||
is_mdb8 = False
|
||||
mdb8 = getMdb8Ver()
|
||||
if mw.inArray(mdb8, version):
|
||||
is_mdb8 = True
|
||||
query_status_cmd = 'show replica status'
|
||||
|
||||
try:
|
||||
if status(version) == 'stop':
|
||||
return mw.returnJson(False, 'MySQL未启动,或正在启动中...!', [])
|
||||
|
||||
|
||||
conf = getConf()
|
||||
content = mw.readFile(conf)
|
||||
master_status = False
|
||||
@@ -2219,15 +2228,20 @@ def getMasterStatus(version=''):
|
||||
data['slave_status'] = False
|
||||
|
||||
db = pMysqlDb()
|
||||
dlist = db.query('show slave status')
|
||||
dlist = db.query(query_status_cmd)
|
||||
|
||||
for v in dlist:
|
||||
if v["Slave_IO_Running"] == 'Yes' or v["Slave_SQL_Running"] == 'Yes':
|
||||
data['slave_status'] = True
|
||||
|
||||
if is_mdb8:
|
||||
if (v["Replica_IO_Running"] == 'Yes' or v["Replica_SQL_Running"] == 'Yes'):
|
||||
data['slave_status'] = True
|
||||
else:
|
||||
if (v["Slave_IO_Running"] == 'Yes' or v["Slave_SQL_Running"] == 'Yes'):
|
||||
data['slave_status'] = True
|
||||
|
||||
return mw.returnJson(master_status, '设置成功', data)
|
||||
except Exception as e:
|
||||
return mw.returnJson(False, "数据库密码错误,在管理列表-点击【修复】!", 'pwd')
|
||||
return mw.returnJson(False, "数据库密码错误,在管理列表-点击【修复】,"+str(e), 'pwd')
|
||||
|
||||
|
||||
def setMasterStatus(version=''):
|
||||
@@ -2311,10 +2325,10 @@ def addMasterRepSlaveUser(version=''):
|
||||
# address = args['address'].strip()
|
||||
# dataAccess = args['dataAccess'].strip()
|
||||
|
||||
reg = "^[\w-]+$"
|
||||
reg = r"^[\w-]+$"
|
||||
if not re.match(reg, username):
|
||||
return mw.returnJson(False, '用户名不能带有特殊符号!')
|
||||
checks = ['root', 'mysql', 'test', 'sys', 'panel_logs']
|
||||
checks = ['root', 'mysql', 'test', 'sys', 'performance_schema','information_schema']
|
||||
if username in checks or len(username) < 1:
|
||||
return mw.returnJson(False, '用户名不合法!')
|
||||
if password in checks or len(password) < 1:
|
||||
@@ -2331,7 +2345,8 @@ def addMasterRepSlaveUser(version=''):
|
||||
if psdb.where("username=?", (username)).count() > 0:
|
||||
return mw.returnJson(False, '用户已存在!')
|
||||
|
||||
if version == "8.0":
|
||||
mdb8 = getMdb8Ver()
|
||||
if mw.inArray(mdb8,version):
|
||||
sql = "CREATE USER '" + username + \
|
||||
"' IDENTIFIED WITH "+auth_policy+" BY '" + password + "';"
|
||||
pdb.execute(sql)
|
||||
@@ -2340,7 +2355,6 @@ def addMasterRepSlaveUser(version=''):
|
||||
isError = isSqlError(result)
|
||||
if isError != None:
|
||||
return isError
|
||||
|
||||
else:
|
||||
sql = "grant replication SLAVE ON *.* TO '" + username + \
|
||||
"'@'%' identified by '" + password + "';"
|
||||
@@ -2392,32 +2406,30 @@ def getMasterRepSlaveUserCmd(version):
|
||||
sid = getDbServerId()
|
||||
channel_name = ""
|
||||
if sid != '':
|
||||
channel_name = " for channel 'r{}';".format(sid)
|
||||
channel_name = " for channel 'r{}'".format(sid)
|
||||
|
||||
mdb8 = ['8.0','8.1','8.2','8.3','8.4']
|
||||
mdb8 = getMdb8Ver()
|
||||
sql = ''
|
||||
if not mw.inArray(mdb8,version):
|
||||
base_sql = "CHANGE MASTER TO MASTER_HOST='" + ip + "', MASTER_PORT=" + port + ", MASTER_USER='" + \
|
||||
clist[0]['username'] + "', MASTER_PASSWORD='" + \
|
||||
clist[0]['password'] + "'"
|
||||
clist[0]['username'] + "', MASTER_PASSWORD='" + clist[0]['password'] + "'"
|
||||
|
||||
sql += base_sql +';'
|
||||
sql += "<br/><hr/>"
|
||||
sql += base_sql;
|
||||
sql += "<br/><hr/>";
|
||||
# sql += base_sql + ", MASTER_AUTO_POSITION=1" + channel_name
|
||||
sql += base_sql + channel_name
|
||||
sql += "<br/><hr/>"
|
||||
sql += "<br/><hr/>";
|
||||
|
||||
sql += base_sql + "', MASTER_LOG_FILE='" + mstatus[0]["File"] + "',MASTER_LOG_POS=" + str(mstatus[0]["Position"]) + channel_name
|
||||
sql += base_sql + ", MASTER_LOG_FILE='" + mstatus[0]["File"] + "',MASTER_LOG_POS=" + str(mstatus[0]["Position"]) + channel_name
|
||||
else:
|
||||
base_sql = "CHANGE REPLICATION SOURCE TO SOURCE_HOST='" + ip + "', SOURCE_PORT=" + port + ", SOURCE_USER='" + \
|
||||
clist[0]['username'] + "', SOURCE_PASSWORD='" + \
|
||||
clist[0]['password']+"'"
|
||||
sql += base_sql +';'
|
||||
sql += "<br/><hr/>"
|
||||
clist[0]['username'] + "', SOURCE_PASSWORD='" + clist[0]['password']+"'"
|
||||
sql += base_sql;
|
||||
sql += "<br/><hr/>";
|
||||
# sql += base_sql + ", MASTER_AUTO_POSITION=1" + channel_name
|
||||
sql += base_sql + channel_name
|
||||
sql += "<br/><hr/>"
|
||||
sql += base_sql + "', SOURCE_LOG_FILE='" + mstatus[0]["File"] + "',SOURCE_LOG_POS=" + str(mstatus[0]["Position"]) + channel_name
|
||||
sql += "<br/><hr/>";
|
||||
sql += base_sql + ", SOURCE_LOG_FILE='" + mstatus[0]["File"] + "',SOURCE_LOG_POS=" + str(mstatus[0]["Position"]) + channel_name
|
||||
|
||||
|
||||
data = {}
|
||||
@@ -2689,11 +2701,17 @@ def updateSlaveSSH(version=''):
|
||||
|
||||
|
||||
def getSlaveList(version=''):
|
||||
|
||||
query_status_cmd = 'show slave status'
|
||||
mdb8 = getMdb8Ver()
|
||||
if mw.inArray(mdb8, version):
|
||||
query_status_cmd = 'show replica status'
|
||||
|
||||
if status(version) == 'stop':
|
||||
return mw.returnJson(False, 'MySQL未启动', [])
|
||||
|
||||
db = pMysqlDb()
|
||||
dlist = db.query('show slave status')
|
||||
dlist = db.query(query_status_cmd)
|
||||
|
||||
# print(dlist)
|
||||
data = {}
|
||||
@@ -3373,7 +3391,7 @@ def doFullSyncUserImportContentForChannel(file, channel_name):
|
||||
content = content.replace('STOP SLAVE;', "STOP SLAVE for channel '{}';".format(channel_name))
|
||||
content = content.replace('START SLAVE;', "START SLAVE for channel '{}';".format(channel_name))
|
||||
|
||||
find_head = "CHANGE MASTER TO "
|
||||
find_head = r"CHANGE MASTER TO "
|
||||
find_re = find_head+"(.*?);"
|
||||
find_r = re.search(find_re, content, re.I|re.M)
|
||||
if find_r:
|
||||
@@ -3447,7 +3465,7 @@ def doFullSyncUser(version=''):
|
||||
time.sleep(1)
|
||||
writeDbSyncStatus({'code': 1, 'msg': '正在停止从库...', 'progress': 15})
|
||||
|
||||
mdb8 = ['8.0','8.1','8.2','8.3','8.4']
|
||||
mdb8 = getMdb8Ver()
|
||||
if mw.inArray(mdb8,version):
|
||||
db.query("stop slave user='{}' password='{}';".format(user, apass))
|
||||
else:
|
||||
@@ -3475,12 +3493,14 @@ def doFullSyncUser(version=''):
|
||||
|
||||
time_s = time.time()
|
||||
if not os.path.exists(bak_file):
|
||||
if isSimpleSyncCmd(cmd):
|
||||
dmp_option += " --master-data=1 --apply-slave-statements --include-master-host-port "
|
||||
dmp_option += ' '
|
||||
if mw.inArray(mdb8,version):
|
||||
# --compression-algorithms
|
||||
dmp_option += " --source-data=1 --apply-replica-statements --include-source-host-port "
|
||||
else:
|
||||
dmp_option += ' '
|
||||
dmp_option += " --master-data=1 --apply-slave-statements --include-master-host-port --compress "
|
||||
|
||||
dump_sql_data = getServerDir() + "/bin/mysqldump --single-transaction --default-character-set=utf8mb4 --compress -q " + dmp_option + " -h" + ip + " -P" + \
|
||||
dump_sql_data = getServerDir() + "/bin/mysqldump --single-transaction --default-character-set=utf8mb4 -q " + dmp_option + " -h" + ip + " -P" + \
|
||||
port + " -u" + user + " -p'" + apass + "' --ssl-mode=DISABLED " + sync_db + " > " + bak_file
|
||||
print(dump_sql_data)
|
||||
time_s = time.time()
|
||||
@@ -3537,9 +3557,8 @@ def doFullSyncUser(version=''):
|
||||
# r = db.query(cmd)
|
||||
# print(r)
|
||||
|
||||
mdb8 = ['8.0','8.1','8.2','8.3','8.4']
|
||||
if mw.inArray(mdb8,version):
|
||||
db.query("start slave user='{}' password='{}';".format(user, apass))
|
||||
db.query("start replica user='{}' password='{}';".format(user, apass))
|
||||
else:
|
||||
db.query("start slave")
|
||||
|
||||
@@ -3682,7 +3701,7 @@ def doFullSyncSSH(version=''):
|
||||
writeDbSyncStatus({'code': 5, 'msg': '导入数据失败...', 'progress': 100})
|
||||
return 'fail'
|
||||
|
||||
mdb8 = ['8.0','8.1','8.2','8.3','8.4']
|
||||
mdb8 = getMdb8Ver()
|
||||
if mw.inArray(mdb8,version):
|
||||
db.query("start slave user='{}' password='{}';".format(uinfo['username'], uinfo['password']))
|
||||
else:
|
||||
@@ -3746,7 +3765,10 @@ def installPreInspection(version):
|
||||
|
||||
|
||||
def uninstallPreInspection(version):
|
||||
stop(version)
|
||||
data_dir = getDataDir()
|
||||
if os.path.exists(data_dir):
|
||||
stop(version)
|
||||
|
||||
if mw.isDebugMode():
|
||||
return 'ok'
|
||||
|
||||
@@ -3792,7 +3814,7 @@ if __name__ == "__main__":
|
||||
elif func == 'conf':
|
||||
print(getConf())
|
||||
elif func == 'bin_log':
|
||||
print(binLog())
|
||||
print(binLog(version))
|
||||
elif func == 'binlog_list':
|
||||
print(binLogList())
|
||||
elif func == 'clean_bin_log':
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
"checks": "server/mysql/VERSION/bin/mysql",
|
||||
"path": "server/mysql/VERSION",
|
||||
"todo_versions":["5.6","5.7","8.0","8.2"],
|
||||
"versions":["5.5", "5.6", "5.7","8.0","8.2","8.3"],
|
||||
"updates":["5.5.62","5.6.50", "5.7.32","8.0.34","8.2.0","8.3.0"],
|
||||
"versions":["5.5", "5.6", "5.7","8.0","8.2","8.3","8.4","9.0"],
|
||||
"updates":["5.5.62","5.6.50", "5.7.32","8.0.34","8.2.0","8.3.0","9.0.1"],
|
||||
"shell":"install.sh",
|
||||
"checks":"server/mysql",
|
||||
"path":"server/mysql",
|
||||
|
||||
@@ -23,6 +23,14 @@ install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
action=$1
|
||||
type=$2
|
||||
|
||||
if id mysql &> /dev/null ;then
|
||||
echo "mysql UID is `id -u mysql`"
|
||||
echo "mysql Shell is `grep "^mysql:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd mysql
|
||||
useradd -g mysql -s /usr/sbin/nologin mysql
|
||||
fi
|
||||
|
||||
if [ "${2}" == "" ];then
|
||||
echo '缺少安装脚本...' > $install_tmp
|
||||
exit 0
|
||||
|
||||
+45
-27
@@ -1707,7 +1707,7 @@ function addMasterRepSlaveUser(){
|
||||
|
||||
|
||||
|
||||
function updateMasterRepSlaveUser(username){
|
||||
function updateMasterRepSlaveUser(username, password){
|
||||
|
||||
var index = layer.open({
|
||||
type: 1,
|
||||
@@ -1720,7 +1720,7 @@ function updateMasterRepSlaveUser(username){
|
||||
<div class='line'><span class='tname'>用户名</span><div class='info-r'><input name='username' readonly='readonly' class='bt-input-text mr5' placeholder='用户名' type='text' style='width:330px;' value='"+username+"'></div></div>\
|
||||
<div class='line'>\
|
||||
<span class='tname'>密码</span>\
|
||||
<div class='info-r'><input class='bt-input-text mr5' type='text' name='password' id='MyPassword' style='width:330px' value='"+(randomStrPwd(16))+"' /><span title='随机密码' class='glyphicon glyphicon-repeat cursor' onclick='repeatPwd(16)'></span></div>\
|
||||
<div class='info-r'><input class='bt-input-text mr5' type='text' name='password' id='MyPassword' style='width:330px' value='"+password+"' /><span title='随机密码' class='glyphicon glyphicon-repeat cursor' onclick='repeatPwd(16)'></span></div>\
|
||||
</div>\
|
||||
<input type='hidden' name='ps' value='' />\
|
||||
<div class='bt-form-submit-btn'>\
|
||||
@@ -1762,17 +1762,11 @@ function getMasterRepSlaveUserCmd(username, db=''){
|
||||
area: '500px',
|
||||
content:"<form class='bt-form pd20 pb70' id='add_master'>\
|
||||
<div class='line'>"+cmd+"</div>\
|
||||
<div class='bt-form-submit-btn'>\
|
||||
<button type='button' class='btn btn-success btn-sm btn-title class-copy-cmd'>复制</button>\
|
||||
<div class='bt-form-submit-btn' style='text-align:center;'>\
|
||||
<button type='button' class='btn btn-success btn-sm btn-title'>选择其中一个复制</button>\
|
||||
</div>\
|
||||
</form>",
|
||||
});
|
||||
|
||||
|
||||
copyPass(cmd);
|
||||
$('.class-copy-cmd').click(function(){
|
||||
copyPass(cmd);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1894,10 +1888,11 @@ function getMasterRepSlaveList(){
|
||||
for (i in user_list) {
|
||||
// console.log(i);
|
||||
var name = user_list[i]['username'];
|
||||
var password = user_list[i]['password'];
|
||||
list += '<tr><td>'+name+'</td>\
|
||||
<td>'+user_list[i]['password']+'</td>\
|
||||
<td>'+password+'</td>\
|
||||
<td>\
|
||||
<a class="btlink" onclick="updateMasterRepSlaveUser(\''+name+'\');">修改</a> | \
|
||||
<a class="btlink" onclick="updateMasterRepSlaveUser(\''+name+'\',\''+password+'\');">修改</a> | \
|
||||
<a class="btlink" onclick="delMasterRepSlaveUser(\''+name+'\');">删除</a> | \
|
||||
<a class="btlink" onclick="setDbMasterAccess(\''+name+'\');">权限</a> | \
|
||||
<a class="btlink" onclick="getMasterRepSlaveUserCmd(\''+name+'\');">从库同步命令</a>\
|
||||
@@ -2310,7 +2305,7 @@ function addSlaveSyncUser(ip=''){
|
||||
</div>\
|
||||
</div>\
|
||||
<div class='line'>\
|
||||
<span class='tname'>CMD[必须填写]</span>\
|
||||
<span class='tname'>CMD[必填]</span>\
|
||||
<div class='info-r'><textarea class='bt-input-text mr5' row='20' cols='30' name='cmd' style='width:330px;height:150px;'></textarea></div>\
|
||||
</div>\
|
||||
<input type='hidden' name='mode' value='"+mode+"' />\
|
||||
@@ -2342,10 +2337,17 @@ function addSlaveSyncUser(ip=''){
|
||||
a[kv[0]] = kv[1].replace("'",'').replace("'",'');
|
||||
}
|
||||
|
||||
$('input[name="ip"]').val(a['MASTER_HOST']);
|
||||
$('input[name="port"]').val(a['MASTER_PORT']);
|
||||
$('input[name="user"]').val(a['MASTER_USER']);
|
||||
$('input[name="pass"]').val(a['MASTER_PASSWORD']);
|
||||
if ('MASTER_HOST' in a){
|
||||
$('input[name="ip"]').val(a['MASTER_HOST']);
|
||||
$('input[name="port"]').val(a['MASTER_PORT']);
|
||||
$('input[name="user"]').val(a['MASTER_USER']);
|
||||
$('input[name="pass"]').val(a['MASTER_PASSWORD']);
|
||||
} else {
|
||||
$('input[name="ip"]').val(a['SOURCE_HOST']);
|
||||
$('input[name="port"]').val(a['SOURCE_PORT']);
|
||||
$('input[name="user"]').val(a['SOURCE_USER']);
|
||||
$('input[name="pass"]').val(a['SOURCE_PASSWORD']);
|
||||
}
|
||||
});
|
||||
},
|
||||
yes:function(index){
|
||||
@@ -2623,6 +2625,7 @@ function masterOrSlaveConf(version=''){
|
||||
|
||||
_data['page'] = page;
|
||||
_data['page_size'] = 10;
|
||||
var mdb_ver = $('.plugin_version').attr('version');
|
||||
|
||||
myPost('get_slave_list', _data, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
@@ -2637,17 +2640,32 @@ function masterOrSlaveConf(version=''){
|
||||
}
|
||||
|
||||
var status = "<a data-id="+i+" class='btlink db_error'>异常</>";
|
||||
if (v['Slave_SQL_Running'] == 'Yes' && v['Slave_IO_Running'] == 'Yes'){
|
||||
status = "正常";
|
||||
}
|
||||
if (mdb_ver >= 8){
|
||||
if (v['Replica_SQL_Running'] == 'Yes' && v['Replica_IO_Running'] == 'Yes'){
|
||||
status = "正常";
|
||||
}
|
||||
|
||||
list += '<tr>';
|
||||
list += '<td>' + rdata.data[i]['Master_Host'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Master_Port'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Master_User'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Master_Log_File'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Slave_IO_Running'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Slave_SQL_Running'] +'</td>';
|
||||
list += '<tr>';
|
||||
list += '<td>' + rdata.data[i]['Source_Host'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Source_Port'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Source_User'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Relay_Source_Log_File'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Replica_IO_Running'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Replica_SQL_Running'] +'</td>';
|
||||
|
||||
} else {
|
||||
if (v['Slave_SQL_Running'] == 'Yes' && v['Slave_IO_Running'] == 'Yes'){
|
||||
status = "正常";
|
||||
}
|
||||
|
||||
list += '<tr>';
|
||||
list += '<td>' + rdata.data[i]['Master_Host'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Master_Port'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Master_User'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Master_Log_File'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Slave_IO_Running'] +'</td>';
|
||||
list += '<td>' + rdata.data[i]['Slave_SQL_Running'] +'</td>';
|
||||
}
|
||||
|
||||
if (isHasSign){
|
||||
list += '<td>' + v['Channel_Name'] +'</td>';
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
diff -ruN mysql-5.5.42.orig/sql-common/client_plugin.c mysql-5.5.42/sql-common/client_plugin.c
|
||||
--- mysql-5.5.42.orig/sql-common/client_plugin.c 2015-01-07 04:39:40.000000000 +0800
|
||||
+++ mysql-5.5.42/sql-common/client_plugin.c 2015-03-24 10:36:45.682700014 +0800
|
||||
@@ -233,6 +233,7 @@
|
||||
{
|
||||
MYSQL mysql;
|
||||
struct st_mysql_client_plugin **builtin;
|
||||
+ va_list dummy;
|
||||
|
||||
if (initialized)
|
||||
return 0;
|
||||
@@ -249,7 +250,7 @@
|
||||
pthread_mutex_lock(&LOCK_load_client_plugin);
|
||||
|
||||
for (builtin= mysql_client_builtins; *builtin; builtin++)
|
||||
- add_plugin(&mysql, *builtin, 0, 0, 0);
|
||||
+ add_plugin(&mysql, *builtin, 0, 0, dummy);
|
||||
|
||||
pthread_mutex_unlock(&LOCK_load_client_plugin);
|
||||
|
||||
@@ -293,6 +294,7 @@
|
||||
mysql_client_register_plugin(MYSQL *mysql,
|
||||
struct st_mysql_client_plugin *plugin)
|
||||
{
|
||||
+ va_list dummy;
|
||||
if (is_not_initialized(mysql, plugin->name))
|
||||
return NULL;
|
||||
|
||||
@@ -307,7 +309,7 @@
|
||||
plugin= NULL;
|
||||
}
|
||||
else
|
||||
- plugin= add_plugin(mysql, plugin, 0, 0, 0);
|
||||
+ plugin= add_plugin(mysql, plugin, 0, 0, dummy);
|
||||
|
||||
pthread_mutex_unlock(&LOCK_load_client_plugin);
|
||||
return plugin;
|
||||
@@ -10,25 +10,58 @@ rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
sysName=`uname`
|
||||
sysArch=`arch`
|
||||
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
mysqlDir=${serverPath}/source/mysql
|
||||
|
||||
VERSION=5.5.62
|
||||
|
||||
_os=`uname`
|
||||
echo "use system: ${_os}"
|
||||
if [ ${_os} == "Darwin" ]; then
|
||||
OSNAME='macos'
|
||||
elif grep -Eq "openSUSE" /etc/*-release; then
|
||||
OSNAME='opensuse'
|
||||
zypper refresh
|
||||
elif grep -Eq "FreeBSD" /etc/*-release; then
|
||||
OSNAME='freebsd'
|
||||
pkg install -y wget unzip
|
||||
elif grep -Eqi "Arch" /etc/issue || grep -Eq "Arch" /etc/*-release; then
|
||||
OSNAME='arch'
|
||||
echo y | pacman -Sy unzip
|
||||
elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then
|
||||
OSNAME='centos'
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then
|
||||
OSNAME='fedora'
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then
|
||||
OSNAME='rocky'
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; then
|
||||
OSNAME='alma'
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
|
||||
OSNAME='debian'
|
||||
apt update -y
|
||||
apt install -y devscripts
|
||||
apt install -y wget zip unzip
|
||||
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
|
||||
OSNAME='ubuntu'
|
||||
apt install -y wget zip unzip
|
||||
else
|
||||
OSNAME='unknow'
|
||||
fi
|
||||
|
||||
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
|
||||
|
||||
Install_mysql()
|
||||
{
|
||||
mkdir -p ${mysqlDir}
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
|
||||
if id mysql &> /dev/null ;then
|
||||
echo "mysql UID is `id -u www`"
|
||||
echo "mysql Shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd mysql
|
||||
useradd -g mysql mysql
|
||||
fi
|
||||
|
||||
if [ "$sysName" != "Darwin" ];then
|
||||
mkdir -p /var/log/mariadb
|
||||
touch /var/log/mariadb/mariadb.log
|
||||
@@ -77,6 +110,27 @@ Install_mysql()
|
||||
WHERE_DIR_GPP=`which g++`
|
||||
fi
|
||||
|
||||
# https://blog.whsir.com/post-7748.html
|
||||
# arm架构编译MySQL5.5报错
|
||||
if [[ "$sysArch" =~ "aarch" ]];then
|
||||
# wget --no-check-certificate -O ${mysqlDir}/mysql-5.5-fix-arm-client_plugin.patch https://down.whsir.com/downloads/mysql-5.5-fix-arm-client_plugin.patch
|
||||
cd ${mysqlDir}/mysql-5.5.62 && patch -p1 < ${rootPath}/plugins/mysql/patch/mysql-5.5-fix-arm-client_plugin.patch
|
||||
fi
|
||||
|
||||
if [ "$OSNAME" == "ubuntu" ];then
|
||||
apt install -y libudev-dev
|
||||
apt install -y libtirpc-dev
|
||||
apt install -y libssl-dev
|
||||
apt install -y libgssglue-dev
|
||||
apt install -y software-properties-common
|
||||
add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
||||
|
||||
export PKG_CONFIG_PATH=/usr/lib/pkgconfig
|
||||
apt install -y gcc-10 g++-10
|
||||
WHERE_DIR_GCC=/usr/bin/gcc-10
|
||||
WHERE_DIR_GPP=/usr/bin/g++-10
|
||||
fi
|
||||
|
||||
if [ ! -d $serverPath/mysql ];then
|
||||
cd ${mysqlDir}/mysql-5.5.62 && cmake \
|
||||
-DCMAKE_INSTALL_PREFIX=$serverPath/mysql \
|
||||
@@ -102,7 +156,6 @@ Install_mysql()
|
||||
else
|
||||
# rm -rf ${mysqlDir}/mysql-5.5.62
|
||||
echo "${VERSION}安装失败"
|
||||
echo 'install fail'>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -11,25 +11,57 @@ rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
sysName=`uname`
|
||||
sysArch=`arch`
|
||||
|
||||
_os=`uname`
|
||||
echo "use system: ${_os}"
|
||||
if [ ${_os} == "Darwin" ]; then
|
||||
OSNAME='macos'
|
||||
elif grep -Eq "openSUSE" /etc/*-release; then
|
||||
OSNAME='opensuse'
|
||||
zypper refresh
|
||||
elif grep -Eq "FreeBSD" /etc/*-release; then
|
||||
OSNAME='freebsd'
|
||||
pkg install -y wget unzip
|
||||
elif grep -Eqi "Arch" /etc/issue || grep -Eq "Arch" /etc/*-release; then
|
||||
OSNAME='arch'
|
||||
echo y | pacman -Sy unzip
|
||||
elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then
|
||||
OSNAME='centos'
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then
|
||||
OSNAME='fedora'
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then
|
||||
OSNAME='rocky'
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; then
|
||||
OSNAME='alma'
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
|
||||
OSNAME='debian'
|
||||
apt update -y
|
||||
apt install -y devscripts
|
||||
apt install -y wget zip unzip
|
||||
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
|
||||
OSNAME='ubuntu'
|
||||
apt install -y wget zip unzip
|
||||
else
|
||||
OSNAME='unknow'
|
||||
fi
|
||||
|
||||
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
|
||||
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
mysqlDir=${serverPath}/source/mysql
|
||||
|
||||
VERSION=5.6.50
|
||||
VERSION=5.6.51
|
||||
Install_mysql()
|
||||
{
|
||||
mkdir -p ${mysqlDir}
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
|
||||
if id mysql &> /dev/null ;then
|
||||
echo "mysql UID is `id -u www`"
|
||||
echo "mysql Shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd mysql
|
||||
useradd -g mysql mysql
|
||||
fi
|
||||
|
||||
if [ "$sysName" != "Darwin" ];then
|
||||
mkdir -p /var/log/mariadb
|
||||
touch /var/log/mariadb/mariadb.log
|
||||
@@ -69,6 +101,29 @@ Install_mysql()
|
||||
cd ${mysqlDir} && tar -zxvf ${mysqlDir}/mysql-${VERSION}.tar.gz
|
||||
fi
|
||||
|
||||
WHERE_DIR_GCC=/usr/bin/gcc
|
||||
WHERE_DIR_GPP=/usr/bin/g++
|
||||
if [ ! -f $WHERE_DIR_GCC ];then
|
||||
WHERE_DIR_GCC=`which gcc`
|
||||
fi
|
||||
|
||||
if [ ! -f $WHERE_DIR_GPP ];then
|
||||
WHERE_DIR_GPP=`which g++`
|
||||
fi
|
||||
|
||||
if [ "$OSNAME" == "ubuntu" ];then
|
||||
apt install -y libudev-dev
|
||||
apt install -y libtirpc-dev
|
||||
apt install -y libssl-dev
|
||||
apt install -y libgssglue-dev
|
||||
apt install -y software-properties-common
|
||||
add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
||||
|
||||
export PKG_CONFIG_PATH=/usr/lib/pkgconfig
|
||||
apt install -y gcc-11 g++-11
|
||||
WHERE_DIR_GCC=/usr/bin/gcc-11
|
||||
WHERE_DIR_GPP=/usr/bin/g++-11
|
||||
fi
|
||||
|
||||
OPTIONS=''
|
||||
##check openssl version
|
||||
@@ -76,8 +131,8 @@ Install_mysql()
|
||||
if [ "${OPENSSL_VERSION}" -ge "3" ];then
|
||||
#openssl version to high
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash openssl10.sh
|
||||
export PKG_CONFIG_PATH=$serverPath/lib/openssl10/lib/pkgconfig
|
||||
OPTIONS="-DWITH_SSL=${serverPath}/lib/openssl10"
|
||||
export PKG_CONFIG_PATH=$serverPath/lib/openssl11/lib/pkgconfig
|
||||
OPTIONS="-DWITH_SSL=${serverPath}/lib/openssl11"
|
||||
fi
|
||||
|
||||
if [ ! -d $serverPath/mysql ];then
|
||||
@@ -96,8 +151,8 @@ Install_mysql()
|
||||
-DDEFAULT_CHARSET=utf8mb4 \
|
||||
-DDEFAULT_COLLATION=utf8mb4_general_ci \
|
||||
$OPTIONS \
|
||||
-DCMAKE_C_COMPILER=/usr/bin/gcc \
|
||||
-DCMAKE_CXX_COMPILER=/usr/bin/g++ \
|
||||
-DCMAKE_C_COMPILER=$WHERE_DIR_GCC \
|
||||
-DCMAKE_CXX_COMPILER=$WHERE_DIR_GPP \
|
||||
-DCMAKE_CXX_STANDARD=11
|
||||
|
||||
make -j${cpuCore} && make install && make clean
|
||||
@@ -108,9 +163,8 @@ Install_mysql()
|
||||
echo '5.6' > $serverPath/mysql/version.pl
|
||||
echo "${VERSION}安装完成"
|
||||
else
|
||||
# rm -rf ${mysqlDir}/mysql-5.6.50
|
||||
# rm -rf ${mysqlDir}/mysql-5.6.*
|
||||
echo "${VERSION}安装失败"
|
||||
echo 'install fail'>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
@@ -119,7 +173,7 @@ Install_mysql()
|
||||
Uninstall_mysql()
|
||||
{
|
||||
rm -rf $serverPath/mysql
|
||||
echo '卸载完成' > $install_tmp
|
||||
echo '卸载完成'
|
||||
}
|
||||
|
||||
action=$1
|
||||
|
||||
@@ -16,7 +16,46 @@ sysName=`uname`
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
mysqlDir=${serverPath}/source/mysql
|
||||
|
||||
VERSION=5.7.39
|
||||
VERSION=5.7.44
|
||||
|
||||
_os=`uname`
|
||||
echo "use system: ${_os}"
|
||||
if [ ${_os} == "Darwin" ]; then
|
||||
OSNAME='macos'
|
||||
elif grep -Eq "openSUSE" /etc/*-release; then
|
||||
OSNAME='opensuse'
|
||||
zypper refresh
|
||||
elif grep -Eq "FreeBSD" /etc/*-release; then
|
||||
OSNAME='freebsd'
|
||||
pkg install -y wget unzip
|
||||
elif grep -Eqi "Arch" /etc/issue || grep -Eq "Arch" /etc/*-release; then
|
||||
OSNAME='arch'
|
||||
echo y | pacman -Sy unzip
|
||||
elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then
|
||||
OSNAME='centos'
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then
|
||||
OSNAME='fedora'
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then
|
||||
OSNAME='rocky'
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; then
|
||||
OSNAME='alma'
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
|
||||
OSNAME='debian'
|
||||
apt update -y
|
||||
apt install -y devscripts
|
||||
apt install -y wget zip unzip
|
||||
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
|
||||
OSNAME='ubuntu'
|
||||
apt install -y wget zip unzip
|
||||
else
|
||||
OSNAME='unknow'
|
||||
fi
|
||||
|
||||
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
|
||||
|
||||
Install_mysql()
|
||||
@@ -24,14 +63,6 @@ Install_mysql()
|
||||
mkdir -p ${mysqlDir}
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
|
||||
if id mysql &> /dev/null ;then
|
||||
echo "mysql UID is `id -u www`"
|
||||
echo "mysql Shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd mysql
|
||||
useradd -g mysql mysql
|
||||
fi
|
||||
|
||||
if [ "$sysName" != "Darwin" ];then
|
||||
mkdir -p /var/log/mariadb
|
||||
touch /var/log/mariadb/mariadb.log
|
||||
@@ -69,7 +100,7 @@ Install_mysql()
|
||||
fi
|
||||
|
||||
#检测文件是否损坏.
|
||||
md5_mysql_ok=d949b0ef81c3f52f7ef0874066244221
|
||||
md5_mysql_ok=1a637fce4599d9bf5f1c81699f086274
|
||||
if [ -f ${mysqlDir}/mysql-boost-${VERSION}.tar.gz ];then
|
||||
md5_mysql=`md5sum ${mysqlDir}/mysql-boost-${VERSION}.tar.gz | awk '{print $1}'`
|
||||
if [ "${md5_mysql_ok}" == "${md5_mysql}" ]; then
|
||||
@@ -85,6 +116,30 @@ Install_mysql()
|
||||
cd ${mysqlDir} && tar -zxvf ${mysqlDir}/mysql-boost-${VERSION}.tar.gz
|
||||
fi
|
||||
|
||||
WHERE_DIR_GCC=/usr/bin/gcc
|
||||
WHERE_DIR_GPP=/usr/bin/g++
|
||||
if [ ! -f $WHERE_DIR_GCC ];then
|
||||
WHERE_DIR_GCC=`which gcc`
|
||||
fi
|
||||
|
||||
if [ ! -f $WHERE_DIR_GPP ];then
|
||||
WHERE_DIR_GPP=`which g++`
|
||||
fi
|
||||
|
||||
if [ "$OSNAME" == "ubuntu" ];then
|
||||
apt install -y libudev-dev
|
||||
apt install -y libtirpc-dev
|
||||
apt install -y libssl-dev
|
||||
apt install -y libgssglue-dev
|
||||
apt install -y software-properties-common
|
||||
add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
||||
|
||||
export PKG_CONFIG_PATH=/usr/lib/pkgconfig
|
||||
apt install -y gcc-11 g++-11
|
||||
WHERE_DIR_GCC=/usr/bin/gcc-11
|
||||
WHERE_DIR_GPP=/usr/bin/g++-11
|
||||
fi
|
||||
|
||||
OPTIONS=''
|
||||
##check openssl version
|
||||
OPENSSL_VERSION=`openssl version|awk '{print $2}'|awk -F '.' '{print $1}'`
|
||||
@@ -111,8 +166,8 @@ Install_mysql()
|
||||
-DDEFAULT_COLLATION=utf8mb4_general_ci \
|
||||
-DDOWNLOAD_BOOST=1 \
|
||||
$OPTIONS \
|
||||
-DCMAKE_C_COMPILER=/usr/bin/gcc \
|
||||
-DCMAKE_CXX_COMPILER=/usr/bin/g++ \
|
||||
-DCMAKE_C_COMPILER=${WHERE_DIR_GCC} \
|
||||
-DCMAKE_CXX_COMPILER=${WHERE_DIR_GPP} \
|
||||
-DWITH_BOOST=${mysqlDir}/mysql-${VERSION}/boost/
|
||||
make -j${cpuCore} && make install && make clean
|
||||
|
||||
@@ -123,7 +178,6 @@ Install_mysql()
|
||||
else
|
||||
# rm -rf ${mysqlDir}/mysql-${VERSION}
|
||||
echo "${VERSION}安装失败"
|
||||
echo 'install fail'>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
@@ -132,7 +186,7 @@ Install_mysql()
|
||||
Uninstall_mysql()
|
||||
{
|
||||
rm -rf $serverPath/mysql
|
||||
echo '卸载完成' > $install_tmp
|
||||
echo '卸载完成'
|
||||
}
|
||||
|
||||
action=$1
|
||||
|
||||
@@ -56,21 +56,12 @@ fi
|
||||
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
|
||||
|
||||
VERSION=8.0.34
|
||||
VERSION=8.0.37
|
||||
Install_mysql()
|
||||
{
|
||||
mkdir -p ${mysqlDir}
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
|
||||
|
||||
if id mysql &> /dev/null ;then
|
||||
echo "mysql UID is `id -u www`"
|
||||
echo "mysql Shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd mysql
|
||||
useradd -g mysql mysql
|
||||
fi
|
||||
|
||||
# ----- cpu start ------
|
||||
if [ -z "${cpuCore}" ]; then
|
||||
cpuCore="1"
|
||||
@@ -113,7 +104,7 @@ Install_mysql()
|
||||
fi
|
||||
|
||||
#检测文件是否损坏.
|
||||
md5_mysql_ok=c8cfab52fbde1cca55accb3113c235eb
|
||||
md5_mysql_ok=e0cb61cbf6e1144c452368c4535ae931
|
||||
if [ -f ${mysqlDir}/mysql-boost-${VERSION}.tar.gz ];then
|
||||
md5_mysql=`md5sum ${mysqlDir}/mysql-boost-${VERSION}.tar.gz | awk '{print $1}'`
|
||||
if [ "${md5_mysql_ok}" == "${md5_mysql}" ]; then
|
||||
@@ -216,7 +207,6 @@ Install_mysql()
|
||||
else
|
||||
# rm -rf ${mysqlDir}/mysql-${VERSION}
|
||||
echo "${VERSION}安装失败"
|
||||
echo 'install fail'>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
@@ -225,7 +215,7 @@ Install_mysql()
|
||||
Uninstall_mysql()
|
||||
{
|
||||
rm -rf $serverPath/mysql
|
||||
echo '卸载完成' > $install_tmp
|
||||
echo '卸载完成'
|
||||
}
|
||||
|
||||
action=$1
|
||||
|
||||
@@ -62,15 +62,6 @@ Install_mysql()
|
||||
mkdir -p ${mysqlDir}
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
|
||||
|
||||
if id mysql &> /dev/null ;then
|
||||
echo "mysql UID is `id -u www`"
|
||||
echo "mysql Shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd mysql
|
||||
useradd -g mysql mysql
|
||||
fi
|
||||
|
||||
# ----- cpu start ------
|
||||
if [ -z "${cpuCore}" ]; then
|
||||
cpuCore="1"
|
||||
@@ -216,7 +207,6 @@ Install_mysql()
|
||||
else
|
||||
# rm -rf ${mysqlDir}/mysql-${VERSION}
|
||||
echo "${VERSION}安装失败"
|
||||
echo 'install fail'>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
@@ -225,7 +215,7 @@ Install_mysql()
|
||||
Uninstall_mysql()
|
||||
{
|
||||
rm -rf $serverPath/mysql
|
||||
echo '卸载完成' > $install_tmp
|
||||
echo '卸载完成'
|
||||
}
|
||||
|
||||
action=$1
|
||||
|
||||
@@ -62,15 +62,6 @@ Install_mysql()
|
||||
mkdir -p ${mysqlDir}
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
|
||||
|
||||
if id mysql &> /dev/null ;then
|
||||
echo "mysql UID is `id -u www`"
|
||||
echo "mysql Shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd mysql
|
||||
useradd -g mysql mysql
|
||||
fi
|
||||
|
||||
# ----- cpu start ------
|
||||
if [ -z "${cpuCore}" ]; then
|
||||
cpuCore="1"
|
||||
@@ -215,7 +206,6 @@ Install_mysql()
|
||||
else
|
||||
# rm -rf ${mysqlDir}/mysql-${VERSION}
|
||||
echo "${VERSION}安装失败"
|
||||
echo 'install fail'>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
@@ -224,7 +214,7 @@ Install_mysql()
|
||||
Uninstall_mysql()
|
||||
{
|
||||
rm -rf $serverPath/mysql
|
||||
echo '卸载完成' > $install_tmp
|
||||
echo '卸载完成'
|
||||
}
|
||||
|
||||
action=$1
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user