Compare commits

..

774 Commits

Author SHA1 Message Date
Mr Chen
abc1d04e5e Merge pull request #966 from midoks/dev
常规优化
2026-11-05 17:06:24 +08:00
fec638007c Update setting.py 2026-11-05 16:49:15 +08:00
80f7a0de38 Update setting.py 2026-11-05 16:42:39 +08:00
a3bb9ac80a Update setting.py 2026-11-05 16:30:21 +08:00
3dcc6e3349 Update setting.py 2026-11-05 16:28:18 +08:00
60870a4e5d Update setting.py 2026-11-05 16:18:39 +08:00
ea635bc960 Update setting.py 2026-11-05 16:08:12 +08:00
749c8443ee Update setting.py 2026-11-05 16:06:46 +08:00
052120c25e Update setting.py 2026-11-05 16:05:48 +08:00
a2b3b86c43 Update setting.py 2026-11-05 16:05:37 +08:00
6d57e3dd40 Update mw.tpl 2026-11-05 15:45:41 +08:00
a67689d890 Update mw.tpl 2026-11-05 15:36:24 +08:00
b6bffedf06 Update mw.tpl 2026-11-05 15:34:52 +08:00
e07eaf4226 Update mw.tpl 2026-11-05 15:32:05 +08:00
dd9e9d4899 Update mw.tpl 2026-11-05 15:17:19 +08:00
cd1d80915a Update mw.tpl 2026-11-05 15:14:19 +08:00
40f64ab3e8 Update install.sh 2026-11-05 14:55:31 +08:00
69ba921ec4 Update index.py 2026-11-05 14:54:39 +08:00
255fbcd688 Update index.py 2026-11-05 14:35:35 +08:00
24e12b70c8 Update index.py 2026-11-05 14:35:02 +08:00
0feee48ea8 Update install.sh 2026-11-05 14:31:22 +08:00
5cd8c5ae2c Update index.py 2026-11-05 14:28:11 +08:00
28a75eaedc Update index.py 2026-11-05 14:26:12 +08:00
50d0794f4a Update index.py 2026-11-05 14:23:24 +08:00
755e53f4d7 Update index.py 2026-11-05 14:20:13 +08:00
1876027bd2 update 2026-11-05 14:14:23 +08:00
26b06f9bb2 Update index.py 2026-11-05 14:10:37 +08:00
8f67d35260 update 2026-11-05 13:40:46 +08:00
7fa78c78e2 更加优化匹配 2026-11-05 13:37:37 +08:00
ae7276300f Update install.sh 2026-11-05 11:57:54 +08:00
420816ff4e Update requirements.txt 2026-11-05 09:58:54 +08:00
df34a7ef9b Update plugin.py 2026-11-05 00:12:28 +08:00
e1b199c8d5 Update plugin.py 2026-11-05 00:07:29 +08:00
Mr Chen
e6060847ef Merge pull request #965 from midoks/dev
常规更新
2026-11-04 15:52:18 +08:00
7ff1530684 update 2026-11-04 15:35:08 +08:00
cd0ad7488e update 2026-11-04 15:33:18 +08:00
6a0f81154a Update index.py 2026-11-04 15:31:09 +08:00
Mr Chen
096c736c28 Merge pull request #964 from midoks/dev
常规优化
2026-11-04 14:51:09 +08:00
7d01a487dc Merge branch 'master' into dev 2026-11-04 14:47:28 +08:00
ba95ef1537 Update install.sh 2026-11-04 14:43:26 +08:00
01035018c4 Update install.sh 2026-11-04 14:43:07 +08:00
8aa12b979a Update install.sh 2026-11-04 14:40:26 +08:00
98dc9e5bd8 Update tool_cron.py 2026-11-04 14:34:10 +08:00
4ebadc28c9 Update tool_cron.py 2026-11-04 14:32:34 +08:00
02115226fa Update tool_cron.py 2026-11-04 14:31:51 +08:00
f661aea83c Update manticore.conf 2026-11-04 14:17:36 +08:00
cfd3abf97b Update manticore.conf 2026-11-04 14:15:16 +08:00
b5d1c8cfcf Update manticore.conf 2026-11-04 14:12:11 +08:00
98156cc1cb Update sql_mysql.py 2026-11-04 14:01:56 +08:00
33a0dc6014 Update my.cnf 2026-11-04 13:57:38 +08:00
95a6f86e5d Update sql_mysql.py 2026-11-04 13:52:16 +08:00
74ac55b01d Update info.json 2026-11-04 13:50:19 +08:00
518cc78670 Update none.conf 2026-11-04 13:45:04 +08:00
43727decf0 update 2026-11-04 13:12:33 +08:00
599b3a7f4a Update install.sh 2026-11-04 13:05:29 +08:00
bf6c18c57a Update install.sh 2026-11-04 13:04:06 +08:00
34838bb238 update 2026-11-04 12:58:55 +08:00
1a356e516c Update index.py 2026-11-04 12:45:23 +08:00
15e273aa6f Update index.py 2026-11-04 12:44:21 +08:00
Mr Chen
4c3d3bf41d Merge pull request #963 from midoks/dev
常规优化
2026-11-04 12:43:49 +08:00
f782bacc64 update 2026-11-04 12:41:48 +08:00
7e62ab62f9 Update index.py 2026-11-04 11:45:38 +08:00
aaa8644348 Update mariadb.js 2026-11-04 11:43:26 +08:00
53797c7f56 Update index.py 2026-11-04 11:42:18 +08:00
c9302f406e Update my.cnf 2026-11-04 11:10:00 +08:00
7ad881c8ad mysql 同时过滤系统表
replicate-wild-ignore-table = mysql.%
replicate-wild-ignore-table = information_schema.%
replicate-wild-ignore-table = performance_schema.%
replicate-wild-ignore-table = sys.%
2026-11-04 11:06:28 +08:00
015e57f96d update 2026-11-04 10:21:48 +08:00
84b94a172e Update index.py 2026-11-04 10:11:25 +08:00
c1380945ef Update index.py 2026-11-04 10:11:02 +08:00
2d80df003e Update my5.7.cnf 2026-11-04 01:16:28 +08:00
568cdaa0ad Update my5.7.cnf 2026-11-04 01:13:19 +08:00
d11e4807df Update my5.7.cnf 2026-11-04 01:12:00 +08:00
Mr Chen
f6bc08cec1 Merge pull request #962 from midoks/dev
update
2026-11-04 00:47:06 +08:00
d723afb96e update 2026-11-04 00:26:05 +08:00
Mr Chen
6c2aa089f3 Merge pull request #961 from midoks/dev
常规优化
2026-11-04 00:06:02 +08:00
35e1ff2e96 update 2026-11-04 00:04:52 +08:00
bee9e89ed5 Update index.py 2026-11-03 22:46:33 +08:00
d0b622906f Update index.py 2026-11-03 22:37:34 +08:00
56f7edcb55 update 2026-11-03 22:36:17 +08:00
4acbc0363f Merge branch 'master' into dev 2026-11-03 22:26:50 +08:00
79013db685 Merge branch 'master' into dev 2026-11-03 22:19:05 +08:00
Mr Chen
eb5b5e5ce8 Merge pull request #960 from midoks/dev
常规更新
2026-11-03 22:16:20 +08:00
b9e6469635 update 2026-11-03 22:04:11 +08:00
56ab927f8c update 2026-11-03 21:56:19 +08:00
3d74320e76 update 2026-11-03 21:25:14 +08:00
0371eaa37a Update index.py 2026-11-03 17:01:41 +08:00
713dbfcda5 Update index.py 2026-11-03 16:47:50 +08:00
93ef2848ed Update mariadb.js 2026-11-03 16:38:47 +08:00
8750cf0f74 Update mariadb.js 2026-11-03 16:38:38 +08:00
af32a1e54d Update index.py 2026-11-03 16:23:42 +08:00
2a7c63029a Update index.py 2026-11-03 15:56:48 +08:00
f8fe7bea19 Update index.py 2026-11-03 15:55:08 +08:00
ef2814bafe Update index.py 2026-11-03 14:14:09 +08:00
220fef5f4d Update index.py 2026-11-03 14:13:36 +08:00
2835c111d0 update 2026-11-03 14:10:41 +08:00
6d0dcf3112 Update index.py 2026-11-03 14:06:44 +08:00
28307ce8e8 Update index.py 2026-11-03 14:01:04 +08:00
282fbed37d Update index.py 2026-11-03 13:53:13 +08:00
101b6d06bc Update mysql-community.js 2026-11-03 13:46:27 +08:00
8de4c74696 update 2026-11-03 13:45:35 +08:00
ba62972820 update 2026-11-03 13:34:34 +08:00
ec512f50af update 2026-11-03 13:08:43 +08:00
3261f54649 update 2026-11-03 12:28:50 +08:00
ec38ba9e21 update 2026-11-03 12:22:57 +08:00
9e1dc94a08 Update install.sh 2026-11-03 12:19:41 +08:00
40a76ac81e 主从同步模式 切换功能 2026-11-03 12:12:16 +08:00
721245b9ad Update my26.10.cnf 2026-11-03 12:02:37 +08:00
cb4ae9b74f Update my26.7.cnf 2026-11-03 12:01:15 +08:00
Mr Chen
5524ecf4e0 Merge pull request #959 from midoks/dev
常规更新
2026-11-03 12:00:47 +08:00
dbb2718892 update 2026-11-03 11:59:39 +08:00
88fc903d80 update 2026-11-03 11:56:07 +08:00
Mr Chen
242c30f7cb Merge pull request #958 from midoks/dev
常规更新
2026-11-03 11:29:36 +08:00
c944b7c585 update 2026-11-03 11:17:45 +08:00
dc2e2695be update 2026-11-03 11:05:28 +08:00
f5b86ea189 update 2026-11-03 11:04:36 +08:00
b6c2f7f3a1 Update index.py 2026-11-03 10:57:31 +08:00
81003f75b7 Update backup.py 2026-11-03 10:55:25 +08:00
d6dc330083 Update postgresql.js 2026-11-03 10:53:49 +08:00
fd0cbe10fc update 2026-11-03 10:51:15 +08:00
4ed77e82be update 2026-11-03 10:29:58 +08:00
Mr Chen
de0e89f056 Merge pull request #957 from midoks/dev
常规优化
2026-11-03 10:22:32 +08:00
29da5146f6 数据类开启卸载检查 2026-11-03 10:19:24 +08:00
e951089b45 Update index.py 2026-11-03 10:14:05 +08:00
909d65ad83 update 2026-11-03 10:13:20 +08:00
27cac55b8f Update index.py 2026-11-03 10:06:26 +08:00
0ee6ae3713 Update index.py 2026-11-03 09:58:32 +08:00
fb97160cfb Update index.py 2026-11-03 09:58:04 +08:00
96b00526fe Update install.sh 2026-11-03 09:55:18 +08:00
909fe6d0f1 Update sql_postgresql.py 2026-11-03 09:54:01 +08:00
f2e9f4c5e8 update 2026-11-03 09:52:15 +08:00
3b629b1296 Merge branch 'master' into dev 2026-11-02 23:51:58 +08:00
5cee415030 Merge branch 'master' into dev 2026-11-02 23:49:49 +08:00
Mr Chen
141e52d42a Merge pull request #956 from midoks/dev
常规更新
2026-11-02 23:48:47 +08:00
1b21f3c814 Update app.js 2026-11-02 23:46:15 +08:00
4ddc2fef8e update 2026-11-02 23:42:40 +08:00
18b259a5a5 Update app.js 2026-11-02 23:35:06 +08:00
2e2288a691 update 2026-11-02 23:32:29 +08:00
d03ae1db7b Update app.js 2026-11-02 23:15:15 +08:00
418355a571 update 2026-11-02 23:12:34 +08:00
340b53aa62 update 2026-11-02 23:01:21 +08:00
dd0628a7fb Update install.sh 2026-11-02 22:50:47 +08:00
3e5b48d2ad Update index.py 2026-11-02 22:28:54 +08:00
Mr Chen
815148a722 Merge pull request #955 from midoks/dev
常规优化
2026-11-02 22:21:33 +08:00
47aadfd877 Merge branch 'master' into dev 2026-11-02 22:19:31 +08:00
42bfd9a934 update 2026-11-02 22:01:40 +08:00
55df1b7613 Update backup.py 2026-11-02 21:50:01 +08:00
6bc3fc5707 Update index.py 2026-11-02 21:42:33 +08:00
19771181dd update 2026-11-02 21:42:27 +08:00
f0b65332bd Update index.py 2026-11-02 21:28:35 +08:00
7dd8a1eb4f Update index.py 2026-11-02 21:24:39 +08:00
f584c18d7e Update index.py 2026-11-02 21:16:53 +08:00
b023044473 Update index.py 2026-11-02 21:13:07 +08:00
dfa7ffdb53 Update index.py 2026-11-02 21:08:45 +08:00
a5a6eb7e5f update 2026-11-02 21:07:24 +08:00
eac88f1d26 update 2026-11-02 21:03:09 +08:00
518f693948 Update index.py 2026-11-02 20:56:05 +08:00
43684e9b20 update 2026-11-02 20:53:54 +08:00
59a7bb5584 update 2026-11-02 20:49:31 +08:00
f623fd9dcf Update postgresql.js 2026-11-02 20:41:50 +08:00
9db36d45af update 2026-11-02 20:33:57 +08:00
ff5670797a Update backup.py 2026-11-02 20:31:56 +08:00
54ad7e5fd0 update 2026-11-02 20:10:08 +08:00
2970aa4b8c Update index.py 2026-11-02 20:08:36 +08:00
d2e5751542 Update index.py 2026-11-02 20:07:59 +08:00
ba5f6f4958 Update index.py 2026-11-02 20:07:11 +08:00
b220552f92 update 2026-11-02 20:04:47 +08:00
d02981cee5 Update backup.py 2026-11-02 19:46:25 +08:00
96d5246415 Update index.py 2026-11-02 19:35:17 +08:00
ea284049c0 update 2026-11-02 19:02:40 +08:00
5c44bb10d1 Update index.py 2026-11-02 18:55:21 +08:00
c7c834fb75 Update postgresql.js 2026-11-02 18:55:16 +08:00
2ade5e490c update 2026-11-02 18:40:38 +08:00
6c61d3f3c0 Update postgresql.js 2026-11-02 18:30:25 +08:00
ab19878a80 Update mw.tpl 2026-11-02 18:11:02 +08:00
c27abfde3c Update install_mac.sh 2026-11-02 17:54:06 +08:00
411b21cdec Update install_mac.sh 2026-11-02 17:48:46 +08:00
26e21e631d update 2026-11-02 17:46:47 +08:00
Mr Chen
653068f2c2 Merge pull request #954 from midoks/dev
常规优化
2026-11-02 17:42:54 +08:00
188c63826f mysql-community mac 2026-11-02 17:41:02 +08:00
1820fc724f Update install.sh 2026-11-02 17:32:37 +08:00
645519b983 update 2026-11-02 17:27:57 +08:00
f97e015bbc update 2026-11-02 17:22:03 +08:00
9d47a385f5 update 2026-11-02 16:56:59 +08:00
ca06c68d24 update 2026-11-02 16:53:59 +08:00
841873418c update 2026-11-02 16:32:58 +08:00
05a6f093ab update 2026-11-02 16:31:45 +08:00
a916104d33 update 2026-11-02 16:30:09 +08:00
4609c360ac mongodb命令导入 2026-11-02 16:18:22 +08:00
b3acf3647f Update mysql.js 2026-11-02 16:10:51 +08:00
400c9d1276 Update mysql.js 2026-11-02 15:09:57 +08:00
Mr Chen
59bd655bb1 Merge pull request #953 from midoks/dev
常规优化
2026-11-02 07:52:20 +08:00
8227253b74 update 2026-11-02 07:42:26 +08:00
4e5604dc27 Update mariadb.js 2026-11-02 07:36:44 +08:00
2e238e6982 Update index.py 2026-11-02 07:33:01 +08:00
c5df0f256c Update index.py 2026-11-02 07:32:03 +08:00
6bd73131ce Update index.py 2026-11-02 07:29:19 +08:00
309422a41c update 2026-11-02 07:26:34 +08:00
6aa7d9dc20 update 2026-11-02 07:24:45 +08:00
565e1cc882 Update index.py 2026-11-02 07:24:33 +08:00
Mr Chen
5c1e292da9 Merge pull request #952 from midoks/dev
常规优化
2026-11-01 19:44:53 +08:00
6db1ee133d update 2026-11-01 19:35:10 +08:00
Mr Chen
383cec2ee5 Merge pull request #951 from midoks/dev
兼容更新+mysql备份可指定到表备份
2026-11-01 15:45:08 +08:00
dfa2163407 Update plugin.py 2026-11-01 15:32:23 +08:00
ed9a9b7860 Update plugin.py 2026-11-01 15:26:22 +08:00
5af49dc081 Merge branch 'master' into dev 2026-11-01 14:51:45 +08:00
d4f425abf8 备份不走sqlite了 2026-11-01 14:49:39 +08:00
1867ee01f1 update 2026-11-01 14:45:00 +08:00
81fe83e0a1 update 2026-11-01 14:31:42 +08:00
f266ec86c0 Create backup.py 2026-11-01 14:22:44 +08:00
e5d6357fae update 2026-11-01 14:20:52 +08:00
7967b36088 Update backup.py 2026-11-01 14:03:52 +08:00
d7471fe882 Update index.py 2026-11-01 13:56:19 +08:00
b4b67c8f48 update 2026-11-01 13:56:02 +08:00
63ae895f12 Update index.py 2026-11-01 13:53:27 +08:00
5dd77ee747 Update backup.py 2026-11-01 13:50:33 +08:00
6071dfa5f1 Update index.py 2026-11-01 13:46:01 +08:00
11d8d813d2 update 2026-11-01 13:40:40 +08:00
f337a60dc1 Update index.py 2026-11-01 13:16:07 +08:00
33f66ab3b1 Update index.py 2026-11-01 13:14:27 +08:00
eb71732d20 Update index.py 2026-11-01 13:07:09 +08:00
fbc9340960 Update index.py 2026-11-01 13:01:15 +08:00
a2f14f4121 Update index.py 2026-11-01 12:26:38 +08:00
ce8c7474ce Update backup.py 2026-11-01 12:24:13 +08:00
85d9f1409a Update index.py 2026-11-01 12:19:10 +08:00
c29dfee004 Update backup.py 2026-11-01 12:12:04 +08:00
618f938462 update 2026-11-01 12:08:34 +08:00
4e7927f9bc Update crontab.py 2026-11-01 03:24:26 +08:00
212f29438d Update crontab.py 2026-11-01 03:16:28 +08:00
3b6d9c3310 Update crontab.py 2026-11-01 03:15:13 +08:00
c01cb01d71 Update crontab.py 2026-11-01 03:14:31 +08:00
712863b766 Update crontab.py 2026-11-01 03:11:14 +08:00
601a80950f Update crontab.py 2026-11-01 03:10:21 +08:00
9f46ceac33 Update crontab.js 2026-11-01 03:08:58 +08:00
ad9b9be7fe Update crontab.py 2026-11-01 03:05:36 +08:00
2be6ac36ef Update crontab.py 2026-11-01 03:04:11 +08:00
fdb8ca205f Update crontab.py 2026-11-01 03:01:49 +08:00
f1024c165a Update crontab.py 2026-11-01 02:58:01 +08:00
9efc85f10d Update crontab.py 2026-11-01 02:52:33 +08:00
dd592b40ee Update crontab.py 2026-11-01 02:52:02 +08:00
9103646150 Update crontab.py 2026-11-01 02:50:05 +08:00
cae2680862 Update crontab.py 2026-11-01 02:48:41 +08:00
e3099a946b Update crontab.py 2026-11-01 02:44:49 +08:00
3f1da50025 Update crontab.py 2026-11-01 02:41:36 +08:00
fbd70eb4f9 Update crontab.py 2026-11-01 02:40:11 +08:00
ef0d6d5265 Update crontab.py 2026-11-01 02:36:43 +08:00
1e6932cd01 Update crontab.py 2026-11-01 02:36:08 +08:00
d173586d49 Update crontab.py 2026-11-01 02:28:51 +08:00
717269dadc Update crontab.py 2026-11-01 02:25:23 +08:00
21c4f93e02 Update crontab.py 2026-11-01 02:18:09 +08:00
c36a03bfb3 Update index.py 2026-11-01 02:12:49 +08:00
a71927917c Update index.py 2026-11-01 02:06:55 +08:00
2f5d5835c5 Update config.inc.php 2026-11-01 01:46:11 +08:00
e95b42df77 Update __init__.py 2026-11-01 01:41:09 +08:00
5c6dbbbb0c Update index.py 2026-11-01 01:27:59 +08:00
a151516eab Update index.py 2026-11-01 01:16:10 +08:00
3a590c7feb Update index.py 2026-11-01 01:12:08 +08:00
e9f0e1962e update 2026-11-01 01:10:39 +08:00
c4fda1362d Update mw.py 2026-11-01 01:05:35 +08:00
f31343b2a5 Update index.py 2026-11-01 01:00:10 +08:00
90b414d373 Update index.py 2026-11-01 00:55:03 +08:00
3eab70db4c Update index.py 2026-11-01 00:46:11 +08:00
e0810bb8d6 Update index.py 2026-11-01 00:45:15 +08:00
96a32d5c8f 更加公用 2026-11-01 00:44:10 +08:00
d45cfb5fe8 Update crontab.js 2026-11-01 00:29:32 +08:00
08753ae96d mysql支持表备份 2026-11-01 00:27:45 +08:00
465e55848f Update crontab.py 2026-10-31 23:51:28 +08:00
4492a97155 Update crontab.js 2026-10-31 23:41:38 +08:00
ba46d568bf Update crontab.js 2026-10-31 22:55:35 +08:00
d87d5d5349 Update crontab.js 2026-10-31 18:54:29 +08:00
76ea3e3375 update 2026-10-31 18:54:26 +08:00
ef47145135 Update crontab.js 2026-10-31 18:12:30 +08:00
43a9ee7368 Update crontab.py 2026-10-31 18:12:24 +08:00
6646e0c46c Update crontab.py 2026-10-31 18:01:10 +08:00
535dbb2e37 Update __init__.py 2026-10-31 18:01:03 +08:00
035953c7f5 Update install.sh 2026-10-31 18:00:28 +08:00
6a9ce81d46 update 2026-10-31 17:16:19 +08:00
f2a6824632 Update ssh_terminal.py 2026-10-31 11:57:54 +08:00
594976373e Update requirements.txt 2026-10-31 11:54:09 +08:00
45704f1c31 update 2026-10-30 17:07:22 +08:00
ce57885343 Create rapira85.toml 2026-10-30 16:55:33 +08:00
4d143ef959 Update crontab.js 2026-10-30 10:47:18 +08:00
9a0f9a759c Update install.sh 2026-10-30 10:10:34 +08:00
6341f00f46 update 2026-10-30 10:09:58 +08:00
f517568251 Update crontab.js 2026-10-29 21:02:44 +08:00
1ff6d0c2cb Update crontab.js 2026-10-29 19:17:44 +08:00
5e28039573 update 2026-10-29 18:36:48 +08:00
Mr Chen
d7757bee0d Merge pull request #949 from midoks/dev
update
2026-10-29 12:01:57 +08:00
6b18511708 Update install.sh 2026-10-29 12:00:41 +08:00
4a3e0791d3 update 2026-10-29 11:52:00 +08:00
7c25d3f6c3 Update install.sh 2026-10-29 11:41:54 +08:00
8ef38674d7 Update install.sh 2026-10-29 11:24:40 +08:00
e84cbf1d76 Update install.sh 2026-10-29 11:24:24 +08:00
14f622d252 Update install.sh 2026-10-29 11:16:08 +08:00
8bb2bfacdc Update install.sh 2026-10-29 11:13:52 +08:00
191c4b1331 Update install.sh 2026-10-29 11:11:41 +08:00
7bed2b977e update 2026-10-29 11:11:28 +08:00
b6c09b2b37 update 2026-10-29 11:03:15 +08:00
Mr Chen
1bd5251dc0 Merge pull request #948 from midoks/dev
更新优化
2026-10-28 10:40:32 +08:00
ecf1b6b600 Update install.sh 2026-10-27 23:03:09 +08:00
22cca82967 Update install.sh 2026-10-27 23:02:43 +08:00
cd66e42b1a Update install.sh 2026-10-27 23:00:26 +08:00
d887fa1b50 Update install.sh 2026-10-27 22:59:57 +08:00
55870ca08a Update my9.7.cnf 2026-10-27 22:51:21 +08:00
2ce1d49386 Update install_generic.sh 2026-10-27 22:47:35 +08:00
a0226ccbcd Update install_generic.sh 2026-10-27 22:47:02 +08:00
de7c14ec62 Update index.py 2026-10-27 22:42:03 +08:00
0c2cfd6d9a Update index.py 2026-10-27 22:41:21 +08:00
4ca78b9a91 Update my26.10.cnf 2026-10-27 22:37:56 +08:00
8219c2d2ed Update install_generic.sh 2026-10-27 22:31:47 +08:00
9f22ce949c Update install_generic.sh 2026-10-27 22:28:29 +08:00
d76c21c54b Update install_generic.sh 2026-10-27 22:28:12 +08:00
30c5cee81a update 2026-10-27 22:24:42 +08:00
e2d0ac6d89 update 2026-10-27 22:11:37 +08:00
3578a65d6e Update my9.7.cnf 2026-10-27 22:04:14 +08:00
c8331b800b update 2026-10-27 21:58:20 +08:00
1e7dc18c21 update 2026-10-27 21:46:06 +08:00
046da1868e Update install_generic.sh 2026-10-27 21:38:37 +08:00
ef7068ebd2 Update install_generic.sh 2026-10-27 21:37:47 +08:00
0525667032 Update install_generic.sh 2026-10-27 21:34:15 +08:00
6198ca02da Update install_generic.sh 2026-10-27 21:32:05 +08:00
4d4fd90fc6 Update install.sh 2026-10-27 21:29:58 +08:00
acfc4d710b Update install.sh 2026-10-27 21:29:43 +08:00
4fd12f4d73 update 2026-10-27 21:23:42 +08:00
9a8bb9f94b update 2026-10-27 21:22:30 +08:00
170f758bc9 Update install.sh 2026-10-27 21:19:34 +08:00
8b7d563fac update 2026-10-27 21:18:03 +08:00
6f9e0cdd8f update 2026-10-27 21:16:58 +08:00
0a3af7a0c0 Create install_generic.sh 2026-10-27 21:16:25 +08:00
c90a2facac update 2026-10-27 21:15:35 +08:00
92d56bddab update 2026-10-27 21:07:39 +08:00
a3bab2da47 Update install.sh 2026-10-27 21:02:19 +08:00
d51a3ac1f7 Update info.json 2026-10-27 20:45:25 +08:00
04774bddc3 update 2026-10-27 20:45:00 +08:00
770f1532da update 2026-10-27 17:47:37 +08:00
d09872c2f3 update 2026-10-27 17:30:36 +08:00
e77369cd25 Update install.sh 2026-10-27 17:12:00 +08:00
69897a208c update 2026-10-27 17:10:57 +08:00
1f5c5ac66e update 2026-10-27 17:08:36 +08:00
3a7f8f09cb Update opcache.sh 2026-10-26 13:13:39 +08:00
77d2b9e323 update 2026-10-26 13:11:27 +08:00
d56c271cc4 update 2026-10-26 04:16:03 +08:00
b4aecf5d0c update 2026-10-26 04:15:29 +08:00
e55e23c845 Update rapira.js 2026-10-26 04:05:37 +08:00
e2977dbbc4 Update mcrypt.sh 2026-10-26 04:04:34 +08:00
8ad94ffeff Update install.sh 2026-10-26 04:02:58 +08:00
c94ff04dcf update 2026-10-26 04:00:20 +08:00
65f10ca22f Update sodium.sh 2026-10-26 03:53:59 +08:00
a1127b3bc0 Update sodium.sh 2026-10-26 03:52:48 +08:00
81c16d1a3d update 2026-10-26 03:47:17 +08:00
b1b4c82457 Update rapira.toml 2026-10-26 03:46:09 +08:00
515b22b103 update 2026-10-26 03:45:19 +08:00
c200165057 update 2026-10-26 03:24:02 +08:00
64c30893d5 update 2026-10-26 03:09:50 +08:00
98b8dce5fd up 2026-10-26 03:06:09 +08:00
0d9b7b6edf Update gd_old.sh 2026-10-26 02:59:15 +08:00
b72bb1fa87 update 2026-10-26 02:58:58 +08:00
d85131266c update 2026-10-26 02:56:59 +08:00
22da275f5b up 2026-10-26 02:51:34 +08:00
f6d65b9e33 update 2026-10-26 02:49:41 +08:00
ebc07becd0 update 2026-10-26 02:48:03 +08:00
024f2c2369 update 2026-10-26 02:45:33 +08:00
2b93fb684b update 2026-10-26 02:43:27 +08:00
b2daf6bf65 update 2026-10-26 02:37:33 +08:00
3ee0f553e9 update 2026-10-26 02:26:03 +08:00
f206da8278 Update apcu.sh 2026-10-26 02:07:49 +08:00
edbaeb37f5 update 2026-10-26 02:07:42 +08:00
46847833d0 update 2026-10-26 01:57:13 +08:00
4303a62b1b update 2026-10-26 01:12:09 +08:00
d6d5babf81 Update dispatcher.toml 2026-10-26 00:46:27 +08:00
8e5b10bda3 Update worker.toml 2026-10-26 00:45:45 +08:00
8e54ee987c Update index.py 2026-10-26 00:42:09 +08:00
929b30ce73 update 2026-10-26 00:38:38 +08:00
c085fa7066 update 2026-10-26 00:30:21 +08:00
783e71f189 update 2026-10-26 00:18:37 +08:00
ae1ffd313c Update doh.conf 2026-10-25 22:46:56 +08:00
122c0b5f64 Update doh.conf 2026-10-25 12:53:13 +08:00
21e496f22e Update doh.conf 2026-10-25 12:52:25 +08:00
d92b3039e2 Update doh.conf 2026-10-25 12:49:37 +08:00
ea57812191 Update info.json 2026-10-25 12:46:02 +08:00
d72238df45 update 2026-10-25 12:45:22 +08:00
55aab8d86d Update install.sh 2026-10-25 12:34:49 +08:00
f8d4d9e4cf update 2026-10-25 12:32:30 +08:00
90afa6446c Update install.sh 2026-10-25 09:58:41 +08:00
5e468c548a Update install.sh 2026-10-25 09:58:16 +08:00
48f4521ef6 Update install.sh 2026-10-25 09:55:12 +08:00
ccd48cecfb update 2026-10-25 09:52:31 +08:00
0757638b2e Update install.sh 2026-10-25 09:46:55 +08:00
68cb547d5f update 2026-10-25 08:13:29 +08:00
1f7c494d82 Update install.sh 2026-10-24 14:58:04 +08:00
Mr Chen
8e58783964 Merge pull request #947 from midoks/dev
redis在线更新支持
2026-10-24 14:14:35 +08:00
bfdc0639b6 update 2026-10-24 14:12:33 +08:00
337a7d87e4 Update install.sh 2026-10-24 14:08:47 +08:00
38c062220c redis 在线升级支持 2026-10-24 14:01:26 +08:00
f639acec86 Merge branch 'master' into dev 2026-10-24 12:54:12 +08:00
02ba38a01a Update install.sh 2026-10-24 12:30:18 +08:00
ea8487b14c up 2026-10-24 12:27:40 +08:00
Mr Chen
f0b613865b Merge pull request #946 from midoks/dev
0.19.0
2026-10-24 10:37:42 +08:00
b142f37045 Update install.sh 2026-10-24 02:04:36 +08:00
45eeb3c045 update 2026-10-24 02:03:38 +08:00
ab99d972cd update 2026-10-24 01:44:03 +08:00
08562a12a2 Update install.sh 2026-10-24 01:37:52 +08:00
d7e62bbfa1 update 2026-10-24 01:36:21 +08:00
5829c48995 update 2026-10-24 01:33:12 +08:00
cd133fc278 update 2026-10-24 01:24:21 +08:00
8a2a4d1a84 update 2026-10-24 01:03:12 +08:00
Mr Chen
a225b98432 Merge pull request #945 from midoks/dev
优化
2026-10-24 01:01:25 +08:00
1acd50b3f3 Update install.sh 2026-10-24 00:59:41 +08:00
5279fe0ba7 Update soft.js 2026-10-24 00:56:26 +08:00
a73f7d86a9 Update version.py 2026-10-24 00:47:15 +08:00
5fe7e4b43d update 2026-10-24 00:43:18 +08:00
d50d666fb2 Update install.sh 2026-10-24 00:42:30 +08:00
86229586f1 update 2026-10-24 00:42:06 +08:00
2947dea3dd Merge branch 'master' into dev 2026-10-24 00:38:28 +08:00
264534ff2c update 2026-10-24 00:38:16 +08:00
82655592d7 Update index.py 2026-10-24 00:35:57 +08:00
Mr Chen
85f90e8ce6 Merge pull request #944 from midoks/dev
优化
2026-10-24 00:29:19 +08:00
450ae37f05 Update index.py 2026-10-24 00:22:55 +08:00
07d0eff75b update 2026-10-24 00:16:33 +08:00
8697bea0d3 Update info.json 2026-10-23 23:59:14 +08:00
a06839fe20 Update info.json 2026-10-23 23:55:31 +08:00
6542113a21 Merge branch 'master' into dev 2026-10-23 23:53:11 +08:00
63d04b8c75 update 2026-10-23 23:50:05 +08:00
71b409a970 update 2026-10-23 23:48:31 +08:00
e0bcc720cc Update soft.html 2026-10-23 23:44:27 +08:00
8bcabd055b update 2026-10-23 23:38:02 +08:00
94597476ac update 2026-10-23 23:33:27 +08:00
a5172d4b5a update 2026-10-23 23:10:50 +08:00
ee79ea55db update 2026-10-23 23:04:31 +08:00
2230c2b632 update 2026-10-23 22:48:12 +08:00
9b231554ef update 2026-10-23 22:43:49 +08:00
ccc499359b Update fcgi_client.py 2026-10-23 22:38:02 +08:00
c5ba0dd8a2 openresty 支持在线升级 2026-10-23 22:31:44 +08:00
3811979f7e update 2026-10-23 22:14:26 +08:00
fb17b7e3a1 update 2026-10-23 22:08:10 +08:00
6ea79b8b28 支持插件更新功能 2026-10-23 22:03:48 +08:00
037e360e3d Update install.sh 2026-10-23 21:49:47 +08:00
3e4a995d5a Update info.json 2026-10-23 21:42:51 +08:00
9d7056184a Update public.js 2026-10-23 21:40:37 +08:00
8aad54b2eb Update index.py 2026-10-23 21:37:41 +08:00
9639dc0e19 Merge branch 'master' into dev 2026-10-23 19:45:14 +08:00
Mr Chen
1f816c4c09 Merge pull request #943 from midoks/dev
简单优化
2026-10-23 19:44:27 +08:00
d88c3d812e Create e.cfg 2026-10-23 19:40:00 +08:00
de3f060e8b Update requirements.txt 2026-10-23 19:32:50 +08:00
2c740726e2 Update lib.sh 2026-10-23 19:31:53 +08:00
01fcadf7c9 update 2026-10-23 19:30:25 +08:00
21378014c4 Update lib.sh 2026-10-23 19:29:50 +08:00
765e3d7d1a Update lib.sh 2026-10-23 19:29:11 +08:00
2bd77e5830 update 2026-10-23 19:20:46 +08:00
b5c61af33c Update plugin.py 2026-10-23 18:13:14 +08:00
ac7df862c1 Update info.json 2026-10-23 14:12:40 +08:00
ae30e8c740 update 2026-10-23 13:29:04 +08:00
db4cd40e35 Update sql_mysql.py 2026-10-23 13:19:34 +08:00
592cdc3e17 Update soft.html 2026-10-23 12:09:24 +08:00
Mr Chen
9a84276abf Merge pull request #942 from midoks/dev
优化
2026-10-22 16:52:22 +08:00
1c70d6381b Merge branch 'master' into dev 2026-10-22 16:51:48 +08:00
556da39be8 Update install.sh 2026-10-22 15:53:22 +08:00
59c8d02c7d Update install.sh 2026-10-22 15:52:03 +08:00
3b0b53d1b5 update 2026-10-22 15:44:47 +08:00
996cbfb279 Update install.sh 2026-10-22 15:37:43 +08:00
e47ad14cb1 Update install.sh 2026-10-22 15:36:50 +08:00
8921647180 update 2026-10-22 15:35:12 +08:00
Mr Chen
2d7933e715 Merge pull request #941 from midoks/dev
局部优化
2026-10-22 14:15:00 +08:00
cffe463779 update 2026-10-22 14:00:45 +08:00
2a0e7c090d Update install.sh 2026-10-22 13:47:58 +08:00
eab8ed9551 Update install.sh 2026-10-22 13:46:50 +08:00
Mr Chen
e9c3b5d135 Merge pull request #940 from midoks/dev
php 支持手动升级
2026-10-22 12:38:02 +08:00
59076d4750 update 2026-10-22 12:36:43 +08:00
8aa84d22a8 Update install.sh 2026-10-22 12:28:35 +08:00
cfb26034b1 Update install.sh 2026-10-22 12:27:30 +08:00
953980ee47 Update install.sh 2026-10-22 12:26:27 +08:00
994198517a Update install.sh 2026-10-22 12:26:07 +08:00
98728b2eb8 Update install.sh 2026-10-22 12:23:49 +08:00
6498606e69 update 2026-10-22 12:23:29 +08:00
Mr Chen
d17ba4d785 Merge pull request #939 from midoks/dev
php升级
2026-10-22 12:00:07 +08:00
e4eeed3559 update 2026-10-22 11:59:23 +08:00
b100204b37 Update rapira.toml 2026-10-18 11:01:26 +08:00
82ff3e3d0a Update rapira.js 2026-10-17 14:38:47 +08:00
0b2223bce0 Update rapira.js 2026-10-17 14:35:50 +08:00
a43b723b09 Update rapira.js 2026-10-17 14:34:17 +08:00
96551f49ca Update rapira.js 2026-10-17 14:32:51 +08:00
8e32d37985 Update rapira.toml 2026-10-17 14:21:49 +08:00
d1da238ddc update 2026-10-17 14:07:59 +08:00
7260a2be21 Create rapira.conf 2026-10-17 14:02:10 +08:00
7562d50e58 Update phpinfo.conf 2026-10-17 13:29:05 +08:00
e77ae8763b Update index.py 2026-10-17 13:28:22 +08:00
a0e51c75fe Update index.py 2026-10-17 13:22:00 +08:00
6021a5e6e2 Update enable-rapira.conf 2026-10-17 13:12:48 +08:00
e50e222955 Update index.py 2026-10-17 13:07:00 +08:00
531dd665c9 update 2026-10-17 13:02:17 +08:00
a79c0a1a9b update 2026-10-17 11:41:47 +08:00
9ef144c304 Update rapira.toml 2026-10-16 12:58:36 +08:00
5402af8df7 Update index.py 2026-10-16 12:38:11 +08:00
99802125dc Update index.py 2026-10-16 12:37:51 +08:00
705647cd3b Update rapira.toml 2026-10-16 11:54:05 +08:00
0ea2eeab7f Update rapira.toml 2026-10-16 11:53:31 +08:00
727cde1352 Update rapira.toml 2026-10-16 11:53:11 +08:00
6ef6358cbb update 2026-10-16 11:44:30 +08:00
6acb303ac9 update 2026-10-16 11:32:27 +08:00
a80e5492b8 Update index.html 2026-10-16 11:24:05 +08:00
4358b1a520 update 2026-10-16 11:11:00 +08:00
ad1a7c22a6 Update index.py 2026-10-16 11:01:33 +08:00
2f3af23e6d Update index.html 2026-10-15 16:23:17 +08:00
89a26d294d Update public.js 2026-10-15 15:43:36 +08:00
f83faeacac update 2026-10-15 15:42:08 +08:00
fb7c27c205 Update index.py 2026-10-15 15:37:08 +08:00
3f958c7083 Update index.html 2026-10-15 15:33:09 +08:00
60b6689318 Update index.py 2026-10-15 15:32:29 +08:00
ba94e81367 update 2026-10-15 15:05:36 +08:00
89c8c68b88 Update requirements.txt 2026-10-15 15:00:58 +08:00
e78ae7e4de Update requirements.txt 2026-10-15 15:00:32 +08:00
f87cadd3ce Update index.html 2026-10-15 14:59:44 +08:00
1631e149ea Update index.py 2026-10-15 14:58:02 +08:00
d84f585bff Update index.py 2026-10-15 14:52:00 +08:00
7e9091b341 update 2026-10-15 14:51:02 +08:00
7020d3e198 Update install.sh 2026-10-15 14:39:55 +08:00
9d8e0ded8f Update install.sh 2026-10-15 14:25:05 +08:00
090e8fa160 Create rapira.source.toml 2026-10-15 14:20:21 +08:00
83746675e7 Update install.sh 2026-10-15 14:19:57 +08:00
74d73d76cd Update index_php.py 2026-10-13 13:03:48 +08:00
6bfedde66d Update install.sh 2026-10-13 13:02:00 +08:00
554bee4040 Update install.sh 2026-10-13 13:01:27 +08:00
a1005adf04 Update install.sh 2026-10-13 11:43:52 +08:00
cbed47d825 update 2026-10-13 10:55:20 +08:00
abb7da896b Update index.py 2026-10-11 15:39:00 +08:00
e62a69ac45 update 2026-10-11 15:31:57 +08:00
769285736b update 2026-10-11 15:29:04 +08:00
8d2eaa94bd Update index.html 2026-10-11 15:07:48 +08:00
a31143e0e8 Update install.sh 2026-10-11 15:05:22 +08:00
584551f764 update 2026-10-11 15:04:11 +08:00
8b60a65bbd Update index.py 2026-10-11 14:52:34 +08:00
c13df7c25b Update index.py 2026-10-11 14:52:08 +08:00
ad30ba776c Update index.py 2026-10-11 14:51:43 +08:00
de3451993f Update install.sh 2026-10-11 14:45:56 +08:00
fde9b49f39 Update rapira.service.tpl 2026-10-11 14:39:51 +08:00
cff0e9442c Update install.sh 2026-10-11 14:34:11 +08:00
5cb57d89de Update install.sh 2026-10-11 14:29:32 +08:00
fadcbaa1bb Update install.sh 2026-10-11 14:29:01 +08:00
911554f6df Update install.sh 2026-10-11 14:27:46 +08:00
77b525d955 Update install.sh 2026-10-11 14:19:44 +08:00
b872a2bb53 Update install.sh 2026-10-11 14:19:29 +08:00
818444d4f4 Update install.sh 2026-10-11 14:17:47 +08:00
63e16e05aa Update install.sh 2026-10-11 13:56:53 +08:00
06743894a3 Update install.sh 2026-10-11 12:48:56 +08:00
2d665235c8 update 2026-10-11 12:43:17 +08:00
72311a2801 update 2026-10-09 12:42:45 +08:00
d7ba290ed3 up 2026-10-09 11:08:59 +08:00
e0d2984bae Update install.sh 2026-10-09 10:51:30 +08:00
ecdbe8d014 Update install.sh 2026-10-09 10:40:39 +08:00
7d57e320b8 Update install.sh 2026-10-09 10:40:27 +08:00
cf16b729f6 Create install.sh 2026-10-09 10:01:12 +08:00
366c5c91aa Update install.sh 2026-10-09 09:37:39 +08:00
173cf2985e Update install.sh 2026-10-09 09:17:39 +08:00
0bdba73f25 Update install.sh 2026-10-09 09:14:55 +08:00
24d25e69ad Update install.sh 2026-10-09 09:09:41 +08:00
d3e6297503 Update site.css 2026-10-08 21:30:53 +08:00
76b5f15115 update 2026-10-08 19:17:46 +08:00
cfa92b637a update 2026-10-08 18:52:56 +08:00
f07e75e508 init rapira 2026-10-08 18:42:21 +08:00
4220300731 Update site.css 2026-09-22 19:11:55 +08:00
Mr Chen
43b464866f Merge pull request #938 from midoks/dev
HDD和SSD磁盘识别
2026-09-22 16:31:43 +08:00
7bf5dbb4f3 Update site.css 2026-09-22 16:13:41 +08:00
9fe8453898 Update index.js 2026-09-22 16:05:43 +08:00
b421cf261f Update index.js 2026-09-22 16:02:45 +08:00
75d28763ee Update index.js 2026-09-22 15:58:28 +08:00
25533fa8bc Update main.py 2026-09-22 15:34:24 +08:00
04294e6cbe Update main.py 2026-09-22 15:28:38 +08:00
f0550ba6b3 Update main.py 2026-09-22 15:21:43 +08:00
88d0733d95 Update install.sh 2026-09-13 13:17:11 +08:00
74633e155a update 2026-09-13 12:59:14 +08:00
7d8d7a8c6f Create openssl_40.sh 2026-09-13 10:32:35 +08:00
Mr Chen
32956578b2 Merge pull request #937 from midoks/dev
bash符合标准
2026-09-11 22:52:09 +08:00
4efdf7606c update 2026-09-11 22:48:34 +08:00
a61644861b update 2026-09-11 22:39:42 +08:00
e60570e380 update 2026-09-11 22:25:42 +08:00
ad160cb23e update 2026-09-11 22:10:30 +08:00
73f58ced9a update 2026-09-11 21:57:55 +08:00
36ca82c1b4 update 2026-09-11 21:52:24 +08:00
acd46f4724 update 2026-09-11 21:28:59 +08:00
370ff99134 update 2026-09-11 21:10:03 +08:00
aa317ee2f5 update 2026-09-11 20:47:27 +08:00
44600b5657 update 2026-09-11 20:42:39 +08:00
ea45316a32 update 2026-09-11 20:32:22 +08:00
6cd13022f1 Update install.sh 2026-09-11 20:31:05 +08:00
91ff2f7550 update 2026-09-11 20:30:55 +08:00
483b5b090d Update install.sh 2026-09-11 20:18:46 +08:00
6087931c58 Update install.sh 2026-09-11 20:18:28 +08:00
9014fd8911 Update install.sh 2026-09-11 20:18:07 +08:00
76f7f51d80 Update install.sh 2026-09-11 20:15:43 +08:00
0c4902e01e Update install.sh 2026-09-11 20:13:34 +08:00
175fb089cd Update install.sh 2026-09-11 20:13:11 +08:00
7b8a4a38b3 Update install.sh 2026-09-11 20:12:33 +08:00
ebf920ed12 Update install.sh 2026-09-11 20:08:55 +08:00
bb8591f5e5 update 2026-09-11 20:06:25 +08:00
b8573e1f1f Update plugin.py 2026-09-11 20:04:59 +08:00
dacc1e5ad8 update 2026-09-11 20:00:47 +08:00
8cc64e32dd update 2026-09-11 19:55:44 +08:00
1d294cc3b1 Update index.py 2026-09-11 19:51:42 +08:00
f9da2e4391 update 2026-09-11 19:46:15 +08:00
3b78079cd2 Update install.sh 2026-09-11 19:35:40 +08:00
07a0a1be48 Update install.sh 2026-09-11 19:31:44 +08:00
837f95e571 Merge branch 'master' into dev 2026-09-09 01:45:29 +08:00
Mr Chen
909d818caa Merge pull request #936 from ramondelee/patch-2
Update freetype_new.sh
2026-09-09 01:44:12 +08:00
ramondelee
355ceebbd7 Update freetype_new.sh
修复freetype下载失败问题
2026-09-08 21:12:36 +08:00
6ae1370709 Merge branch 'master' into dev 2026-09-08 12:02:31 +08:00
Mr Chen
93b5d8b8b4 Merge pull request #935 from ramondelee/patch-1
Update freetype_old.sh
2026-09-08 12:02:10 +08:00
ramondelee
be461a15a9 Update freetype_old.sh
修复freetype下载失败问题
2026-09-07 22:23:11 +08:00
c239f35382 Update firewall.py 2026-09-02 08:25:34 +08:00
49d57af719 Update linux.conf 2026-08-27 13:36:19 +08:00
Mr Chen
19fc0fdc51 Merge pull request #934 from midoks/dev
常规更新
2026-08-26 18:16:57 +08:00
c1fd4fa24c Update __init__.py 2026-08-26 18:15:43 +08:00
7239b22759 update 2026-08-16 00:14:39 +08:00
f5fa94ae95 Update update.sh 2026-08-08 10:09:28 +08:00
Mr Chen
b679ea035d Merge pull request #933 from midoks/dev
常规优化
2026-07-22 13:05:42 +08:00
49bbca8faa Update index.py 2026-07-22 13:03:46 +08:00
8b86cd5e63 up 2026-07-22 13:00:43 +08:00
698e3ffd81 update 2026-07-22 12:55:33 +08:00
Mr Chen
c2284dcee5 Merge pull request #932 from midoks/dev
兼容Ubuntu 26.04 LTS
2026-07-21 20:43:06 +08:00
b68c9edc3e Update index.py 2026-07-21 20:37:12 +08:00
650365997a Update index.py 2026-07-21 20:36:34 +08:00
3279404595 Update info.json 2026-07-21 20:35:41 +08:00
d32a94dccf Update install.sh 2026-07-21 20:34:44 +08:00
80d846f247 Update install.sh 2026-07-21 20:31:08 +08:00
eadcbe336d Update install.sh 2026-07-21 20:26:57 +08:00
474d0f075f Update install.sh 2026-07-21 20:26:33 +08:00
2d6a41e19f Update install.sh 2026-07-21 12:03:36 +08:00
1f24944417 Update caddy.service.tpl 2026-07-21 11:51:42 +08:00
4ab3409e54 Update index.py 2026-07-21 11:43:14 +08:00
c3ad146303 update 2026-07-21 11:38:30 +08:00
745cd304fb Update install.sh 2026-07-21 00:33:05 +08:00
e6efefd1fd Update install.sh 2026-07-21 00:11:57 +08:00
1350404c58 Update install.sh 2026-07-21 00:10:03 +08:00
9cdd2274fa Update install.sh 2026-07-21 00:08:53 +08:00
cc204ad721 Update install.sh 2026-07-21 00:00:26 +08:00
8eb1614b31 Update install.sh 2026-07-20 23:50:41 +08:00
9c2e9627ec update 2026-07-20 23:48:18 +08:00
87123c526a update 2026-07-20 23:45:15 +08:00
7c3ebc6e35 Update ubuntu.sh 2026-07-20 23:42:08 +08:00
6c5bf63424 Update ubuntu.sh 2026-07-20 23:38:00 +08:00
13fd47e7d4 Update ubuntu.sh 2026-07-20 23:36:38 +08:00
fc1321584a Update ubuntu.sh 2026-07-20 23:36:25 +08:00
bab3ae16d3 Update ubuntu.sh 2026-07-20 23:33:35 +08:00
ab8498e519 Update ubuntu.sh 2026-07-20 23:33:13 +08:00
0e480c7ad8 update 2026-07-20 23:29:01 +08:00
7ed8558ff0 Update ubuntu.sh 2026-07-20 23:22:35 +08:00
4ed2f0caa9 update 2026-07-20 23:19:31 +08:00
f275eabe1b Update file.py 2026-07-20 23:08:01 +08:00
fe13ab1e5f Update file.py 2026-07-20 23:07:46 +08:00
6ed045cf94 update 2026-07-20 22:41:10 +08:00
ef333ff142 update 2026-07-20 22:23:37 +08:00
dac2f5240f Update install.sh 2026-07-20 22:18:45 +08:00
cebfc2fc91 update 2026-07-20 22:17:22 +08:00
1da865c1b2 Update install.sh 2026-07-20 16:46:29 +08:00
2abdaaa7ce Update install.sh 2026-07-20 16:45:08 +08:00
c62142cf6b Update requirements.txt 2026-07-20 16:04:57 +08:00
7c1820b6cd update 2026-07-20 15:59:27 +08:00
a24af95d24 Update install.sh 2026-07-20 15:39:32 +08:00
1326c282c8 Update requirements.txt 2026-07-20 15:33:13 +08:00
b7e84749f1 Update debian.sh 2026-07-20 15:26:10 +08:00
8a65158540 Update db.py 2026-07-20 15:21:46 +08:00
a576c521a2 Update ubuntu.sh 2026-07-20 15:17:24 +08:00
736a387a71 Update ubuntu.sh 2026-07-20 15:15:23 +08:00
090205c372 update 2026-07-20 13:41:03 +08:00
fda0bddc8f Update db.py 2026-07-20 13:26:23 +08:00
292b18468d Update db.py 2026-07-20 13:24:57 +08:00
47aab245fc Update panel_task.py 2026-07-20 12:42:24 +08:00
39bd601825 Update mw.py 2026-07-20 12:32:39 +08:00
b744adeb13 Update monitor.py 2026-07-20 11:46:30 +08:00
7b70f9fc99 Merge branch 'master' into dev 2026-07-19 22:06:00 +08:00
Mr Chen
0723f751b3 Merge pull request #930 from midoks/dependabot/pip/python-engineio-4.13.2
Bump python-engineio from 4.3.2 to 4.13.2
2026-07-19 22:05:47 +08:00
1fd8617a12 Update push_notice_msg.py 2026-07-17 23:21:19 +08:00
dependabot[bot]
2fec8fcef4 Bump python-engineio from 4.3.2 to 4.13.2
Bumps [python-engineio](https://github.com/miguelgrinberg/python-engineio) from 4.3.2 to 4.13.2.
- [Release notes](https://github.com/miguelgrinberg/python-engineio/releases)
- [Changelog](https://github.com/miguelgrinberg/python-engineio/blob/main/CHANGES.md)
- [Commits](https://github.com/miguelgrinberg/python-engineio/compare/v4.3.2...v4.13.2)

---
updated-dependencies:
- dependency-name: python-engineio
  dependency-version: 4.13.2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-14 21:18:01 +00:00
Mr Chen
51a48afa71 Merge pull request #929 from ccbkkb/patch-1
Fix return statement for unban IP function
2026-07-13 13:12:38 +08:00
ccbkkb
76919faca7 Fix return statement for unban IP function 2026-07-13 10:50:19 +08:00
Mr Chen
9bcbeaf1a5 Merge pull request #928 from midoks/dev
常规更新
2026-07-09 17:11:23 +08:00
d0de121721 Update update.sh 2026-07-09 15:14:16 +08:00
957e2db3d0 Update update.sh 2026-07-09 15:06:33 +08:00
fb0be5549d Update update.sh 2026-07-09 15:04:40 +08:00
8a9132d557 Update update.sh 2026-07-09 14:52:08 +08:00
04d10435c2 Update update.sh 2026-07-09 14:51:29 +08:00
92543e10fa Update update.sh 2026-07-09 14:46:38 +08:00
cd427dcbf3 Update update.sh 2026-07-09 14:46:26 +08:00
Mr Chen
ddb5e0285b Merge pull request #927 from midoks/dev
常规更新
2026-07-09 14:24:08 +08:00
75610a4559 Update crontab.js 2026-07-09 14:22:26 +08:00
b8f7a45f61 Update push_notice_msg.py 2026-07-09 12:58:16 +08:00
Mr Chen
37d5ce719e Merge pull request #926 from midoks/dev
常规更新
2026-07-08 16:47:46 +08:00
ef9053aa7e Update webstats_index.py 2026-07-08 16:47:05 +08:00
018fcb7afb Update index.py 2026-07-08 16:46:45 +08:00
5cc9a67152 Update mw.py 2026-07-07 23:54:17 +08:00
54895f1d0a Update mw.py 2026-07-07 23:38:29 +08:00
91dfecf882 up 2026-07-07 23:36:34 +08:00
2f09e227d1 Update tool_migrate.py 2026-07-07 23:12:23 +08:00
5d0463836e Update mw.py 2026-07-07 23:11:02 +08:00
Mr Chen
fb6499cb35 Merge pull request #925 from midoks/dev
常规更新
2026-07-07 02:35:02 +08:00
0bbfb58e67 Update index.py 2026-07-07 02:32:34 +08:00
Mr Chen
fcd780a7d3 Merge pull request #924 from midoks/dev
常规更新
2026-07-07 02:19:41 +08:00
4f4d1e7580 Update webstats_common.lua 2026-07-07 02:15:57 +08:00
6e2a8e0a12 up 2026-07-07 02:12:09 +08:00
817b4b36c7 Update webstats.conf 2026-07-07 02:06:03 +08:00
Mr Chen
0ba89cbb9e Merge pull request #923 from midoks/dev
常规更新
2026-07-06 21:13:07 +08:00
4e3e7864be Update tool_migrate.py 2026-07-06 21:02:13 +08:00
6f51eaa298 update 2026-07-06 20:59:32 +08:00
39bd87e868 Update tool_migrate.py 2026-07-06 20:54:00 +08:00
18443aab60 Update tool_migrate.py 2026-07-06 20:49:20 +08:00
b88ea7aa3c update 2026-07-06 20:32:36 +08:00
6a6f6e6062 Update tool_migrate.py 2026-07-06 20:27:17 +08:00
5839dbcd6b Update tool_migrate.py 2026-07-06 20:05:10 +08:00
b46f45569e Update tool_migrate.py 2026-07-06 20:01:23 +08:00
5cdc5af8cd Update tool_migrate.py 2026-07-06 19:50:13 +08:00
4f38a9f3ff Update tool_migrate.py 2026-07-06 19:49:58 +08:00
9c83695187 Create tool_migrate.py 2026-07-06 19:44:14 +08:00
f9be534101 update 2026-07-06 19:24:36 +08:00
58ab48ac15 Update webstats_common.lua 2026-07-06 19:11:48 +08:00
f34e93192d Update webstats_common.lua 2026-07-06 19:10:17 +08:00
31106f2b13 Update webstats_common.lua 2026-07-06 19:03:27 +08:00
468cc54cf5 Update webstats_common.lua 2026-07-06 18:55:25 +08:00
728a38c55c Update webstats_log.lua 2026-07-06 18:35:05 +08:00
Mr Chen
b2b23b0e3b Merge pull request #922 from midoks/dev
常规更新
2026-07-05 15:51:08 +08:00
167dd11548 Update webstats_log.lua 2026-07-05 15:47:23 +08:00
03fdbf2604 Merge branch 'master' into dev 2026-07-05 15:43:18 +08:00
edbdec8370 Update init.sql 2026-07-05 15:42:44 +08:00
8f1c9f9471 up 2026-07-05 15:38:54 +08:00
d35d16943d up 2026-07-05 15:34:56 +08:00
3ac4270dee Update stats.js 2026-07-05 15:30:16 +08:00
90777e08ff update 2026-07-05 15:28:56 +08:00
b47d1262ac Update push_notice_msg.py 2026-07-05 15:11:57 +08:00
e28081a7c5 Update stats.js 2026-07-05 15:04:05 +08:00
5f7d6c1488 Create webstats_common.lua.bk1.txt 2026-07-05 14:46:32 +08:00
59385e11be Merge branch 'master' into dev 2026-07-05 14:21:28 +08:00
Mr Chen
a668d88791 Merge pull request #921 from midoks/dev
常规更新
2026-07-05 14:13:11 +08:00
e62bd7c5a6 Update webstats_log.lua 2026-07-05 14:07:31 +08:00
1ad3d2f187 Update webstats_log.lua 2026-07-05 13:41:19 +08:00
bf06af14ed Update webstats_log.lua 2026-07-05 13:24:37 +08:00
Mr Chen
805c96f260 Merge pull request #920 from midoks/dev
常规更新
2026-07-05 12:33:28 +08:00
8ccba2f6d5 Update webstats_log.lua 2026-07-05 04:08:00 +08:00
2e9f01d3ee Update webstats_log.lua 2026-07-05 04:05:19 +08:00
d1dcdd4f25 Update webstats_common.lua 2026-07-05 03:58:34 +08:00
60958d1403 Update webstats_common.lua 2026-07-05 03:56:13 +08:00
5530b14f36 Update webstats_common.lua 2026-07-05 03:36:39 +08:00
64c9942ee1 Update webstats_common.lua 2026-07-05 03:36:26 +08:00
bc1437dac4 Update webstats_init_worker.lua 2026-07-05 03:27:35 +08:00
1d9576e838 Update webstats_log.lua 2026-07-05 03:27:11 +08:00
8b275a5df4 Update webstats_log.lua 2026-07-05 03:18:14 +08:00
40d9334dcf Update index.py 2026-07-05 02:45:28 +08:00
98c0242819 Update index.py 2026-07-05 02:39:23 +08:00
a2fb03f9b8 Update index.py 2026-07-05 02:31:20 +08:00
98815ac5c3 update 2026-07-05 02:29:29 +08:00
073dd20c96 update 2026-07-05 01:16:02 +08:00
23af9085a9 update 2026-07-05 00:51:14 +08:00
bcaec6b6ee Update install.sh 2026-07-04 23:42:10 +08:00
4063bea922 Update webstats_common.lua 2026-07-04 23:02:54 +08:00
9f864b3407 Update webstats_common.lua 2026-07-04 22:56:49 +08:00
01ac598e39 Update webstats_common.lua 2026-07-04 22:43:20 +08:00
77a0d3af36 Update webstats_common.lua 2026-07-04 22:35:03 +08:00
8d34bbea47 Update webstats_common.lua 2026-07-04 22:33:43 +08:00
be18e98001 Update webstats_common.lua 2026-07-04 22:23:56 +08:00
754e0f98f9 Update webstats_common.lua 2026-07-04 22:23:43 +08:00
07f893b6a1 Update webstats_common.lua 2026-07-04 22:21:17 +08:00
Mr Chen
c1497ec44e Merge pull request #919 from midoks/dev
常规更新
2026-07-03 12:05:30 +08:00
55d4784fe2 Update webstats_common.lua 2026-07-02 14:30:04 +08:00
f26e8bc520 update 2026-07-02 14:22:10 +08:00
7b5f1a4253 up 2026-07-02 14:12:32 +08:00
1058fb7e1f Update webstats_log.lua 2026-07-02 14:01:50 +08:00
0f1b95cdfc up 2026-07-02 13:54:31 +08:00
8ea16fcd85 Update webstats_common.lua 2026-07-02 13:32:22 +08:00
b4b9496980 Update webstats_common.lua 2026-07-02 13:15:12 +08:00
8dfd26361f Update webstats_common.lua 2026-07-02 13:06:32 +08:00
cb5bd32b86 Update webstats_common.lua 2026-07-02 13:02:31 +08:00
2584330d40 update 2026-07-02 12:52:05 +08:00
ebe6333ac9 up 2026-07-02 12:50:35 +08:00
534892280e up 2026-07-02 12:45:28 +08:00
df05cf69cf Update tool_migrate.py 2026-07-02 12:27:43 +08:00
2f782cf6a2 Update db.py 2026-07-02 12:26:19 +08:00
6f483c17e6 Create tool_migrate_bak.py 2026-07-02 11:42:13 +08:00
e64610a2dc Update mw.py 2026-06-30 20:18:46 +08:00
643 changed files with 33713 additions and 4723 deletions

1
.gitignore vendored
View File

@@ -196,3 +196,4 @@ plugins/goedge-happy
/plugins/choose-linux-python
*.md5
/bak
*.tmp

View File

@@ -108,11 +108,11 @@ docker run -itd --name mw-server --privileged=true -p 7200:7200 -p 80:80 -p 443:
```
### 版本更新 0.18.6
### 版本更新 0.19.0
- 常规优化。
### JSDelivr安装地址
### 增加在线更新支持。
- 初始安装

4
cli.sh
View File

@@ -19,12 +19,12 @@ fi
mw_start_task()
{
isStart=$(ps aux |grep 'panel_task.py'|grep -v grep|awk '{print $2}')
if [ "$isStart" == '' ];then
if [ "$isStart" = '' ];then
echo -e "starting mw-tasks... \c"
cd $DIR && python3 panel_task.py >> ${DIR}/logs/panel_task.log 2>&1 &
sleep 0.3
isStart=$(ps aux |grep 'panel_task.py'|grep -v grep|awk '{print $2}')
if [ "$isStart" == '' ];then
if [ "$isStart" = '' ];then
echo -e "\033[31mfailed\033[0m"
echo '------------------------------------------------------'
tail -n 20 $DIR/logs/panel_task.log

View File

@@ -80,6 +80,7 @@ def runPanelTask():
# 站点过期检查
siteEdateCheck()
# echo "True" > /www/server/mdserver-web/logs/panel_task.lock
lock_file = mw.getTriggerTaskLockFile()
try:
if os.path.exists(lock_file):

View File

@@ -606,7 +606,7 @@ def runHookDstDomain(row):
if mw.isAppleSystem():
user = getRunUser()
cmd += "source /Users/"+user+"/.zshrc\n"
cmd += ". /Users/"+user+"/.zshrc\n"
cmd_data = getDnsapiData(row['dnsapi_id'])
# print(cmd_data)

View File

@@ -13,7 +13,7 @@ VERSION=$2
# acme.sh --uninstall
# source /Users/xxx/.zshrc
# . /Users/xxx/.zshrc
# https://github.com/acmesh-official/acme.sh/wiki/dnsapi
# https://docs.dnspod.com/api-legacy/domains.html#get-the-domain-list
@@ -24,7 +24,7 @@ VERSION=$2
if [ -f ${rootPath}/bin/activate ];then
source ${rootPath}/bin/activate
. ${rootPath}/bin/activate
fi
# pip install cloudflare
@@ -47,7 +47,7 @@ Uninstall_App()
}
action=$1
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_App
else
Uninstall_App

View File

@@ -16,16 +16,16 @@ sysArch=`arch`
sysName=`uname`
ALIST_ARCH_NAME=amd64
if [ "$sysArch" == "arm64" ];then
if [ "$sysArch" = "arm64" ];then
ALIST_ARCH_NAME=arm64
elif [ "$sysArch" == "x86_64" ]; then
elif [ "$sysArch" = "x86_64" ]; then
ALIST_ARCH_NAME=amd64
elif [ "$sysArch" == "aarch64" ]; then
elif [ "$sysArch" = "aarch64" ]; then
ALIST_ARCH_NAME=arm64
fi
ALIST_NAME=linux
if [ "$sysName" == "Darwin" ];then
if [ "$sysName" = "Darwin" ];then
ALIST_NAME=darwin
fi
@@ -86,7 +86,7 @@ Uninstall_App()
}
action=$1
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_App
else
Uninstall_App

View File

@@ -27,7 +27,7 @@ else
fi
NGINX_IDS=`ps -ef|grep nginx | grep -v grep| awk '{print $2}'`
if [ "$NGINX_IDS" == "" ];then
if [ "$NGINX_IDS" = "" ];then
ps -ef|grep nginx| grep -v grep| awk '{print $2}' | xargs kill -9
systemctl start "$service_name"
echo "OpenResty未运行,正在启动服务..."

View File

@@ -38,7 +38,7 @@ else
useradd -g www -s /bin/bash www
fi
if [ "${action}" == "upgrade" ];then
if [ "${action}" = "upgrade" ];then
sh -x $curPath/versions/$2/install.sh $1
echo "${VERSION}" > $serverPath/apache/version.pl
@@ -53,12 +53,12 @@ if [ "${action}" == "upgrade" ];then
fi
if [ "${2}" == "" ];then
if [ "${2}" = "" ];then
echo '缺少安装脚本版本...'
exit 0
fi
if [ "${action}" == "uninstall" ];then
if [ "${action}" = "uninstall" ];then
if [ -f /usr/lib/systemd/system/httpd.service ] || [ -f /lib/systemd/system/httpd.service ];then
systemctl stop httpd
rm -rf /usr/systemd/system/httpd.service
@@ -75,7 +75,7 @@ fi
sh -x $curPath/versions/$2/install.sh $1
if [ "${action}" == "install" ] && [ -d $serverPath/apache ];then
if [ "${action}" = "install" ] && [ -d $serverPath/apache ];then
echo "${VERSION}" > $serverPath/apache/version.pl
mkdir -p $serverPath/web_conf/php/conf

View File

@@ -14,12 +14,12 @@ sysName=`uname`
action=$1
type=$2
VERSION=2.4.66
VERSION=2.4.68
apacheDir=${serverPath}/source/apache
Install_App()
{
if [ "${action}" == "install" ];then
if [ "${action}" = "install" ];then
if [ -d $serverPath/apache ];then
exit 0
fi
@@ -71,7 +71,7 @@ Install_App()
cd ${apacheDir} && tar -jxf apr-${APR_VERSION}.tar.bz2
cd ${apacheDir}/apr-${APR_VERSION} && ./configure --prefix=${serverPath}/apache/apr
make -j${cpuCore} && make install
if [ "$?" == "0" ];then
if [ "$?" = "0" ];then
# 检查 APR 配置文件
APR_CONFIG=$(find ${serverPath}/apache/apr -name "apr-*config" | head -1)
if [ -z "$APR_CONFIG" ];then
@@ -90,7 +90,7 @@ Install_App()
cd ${apacheDir} && tar -jxf apr-util-${APR_UTIL_VERSION}.tar.bz2
cd ${apacheDir}/apr-util-${APR_UTIL_VERSION} && ./configure --prefix=${serverPath}/apache/apr-util --with-apr=${serverPath}/apache/apr
make -j${cpuCore} && make install
if [ "$?" == "0" ];then
if [ "$?" = "0" ];then
# 检查 APR-util 配置文件
APU_CONFIG=$(find ${serverPath}/apache/apr-util -name "apu-*config" | head -1)
if [ -z "$APU_CONFIG" ];then
@@ -163,9 +163,9 @@ Uninstall_App()
}
action=$1
if [ "${1}" == "install" ];then
if [ "${1}" = "install" ];then
Install_App
elif [ "${1}" == "upgrade" ];then
elif [ "${1}" = "upgrade" ];then
Install_App
else
Uninstall_App

View File

@@ -24,7 +24,7 @@ Uninstall_App()
}
action=$1
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_App $2
else
Uninstall_App $2

View File

@@ -27,7 +27,7 @@ else
fi
NGINX_IDS=`ps -ef|grep caddy | grep -v grep| awk '{print $2}'`
if [ "$NGINX_IDS" == "" ];then
if [ "$NGINX_IDS" = "" ];then
ps -ef|grep caddy| grep -v grep| awk '{print $2}' | xargs kill -9
systemctl start "$service_name"
echo "caddy未运行,正在启动服务..."

View File

@@ -109,7 +109,7 @@ def initDreplace():
caddy_file = getConf()
if not os.path.exists(caddy_file):
caddy_file_tpl = getConfTpl()
content = mw.readFile(systemServiceTpl)
content = mw.readFile(caddy_file_tpl)
content = content.replace('{$SERVER_PATH}', service_path)
mw.writeFile(caddy_file, content)

View File

@@ -20,9 +20,9 @@ After=network.target network-online.target
Requires=network-online.target
[Service]
Type=notify
User=caddy
Group=caddy
Type=simple
User=www
Group=www
ExecStart={$SERVER_PATH}/caddy/bin/caddy run --environ --config {$SERVER_PATH}/caddy/Caddyfile
ExecReload={$SERVER_PATH}/caddy/bin/caddy reload --config {$SERVER_PATH}/caddy/Caddyfile --force
TimeoutStopSec=5s

View File

@@ -3,7 +3,7 @@ PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/hom
export PATH
# cd /Users/midoks/Desktop/mwdev/server/mdserver-web/plugins/caddy && bash install.sh install 1.21.4
# cd /www/server/mdserver-web/plugins/caddy && bash install.sh install 1.21.4
# cd /www/server/mdserver-web/plugins/caddy && bash install.sh install 2.11
# cd /www/server/mdserver-web/plugins/caddy && bash install.sh install 1.29.2
# cd /www/server/mdserver-web/plugins/caddy && bash install.sh upgrade 1.29.2
@@ -33,7 +33,7 @@ else
useradd -g www -s /bin/bash www
fi
if [ "${action}" == "upgrade" ];then
if [ "${action}" = "upgrade" ];then
sh -x $curPath/versions/$2/install.sh $1
echo "${VERSION}" > $serverPath/caddy/version.pl
@@ -45,12 +45,12 @@ if [ "${action}" == "upgrade" ];then
fi
if [ "${2}" == "" ];then
if [ "${2}" = "" ];then
echo '缺少安装脚本版本...'
exit 0
fi
if [ "${action}" == "uninstall" ];then
if [ "${action}" = "uninstall" ];then
if [ -f /usr/lib/systemd/system/caddy.service ] || [ -f /lib/systemd/system/caddy.service ];then
systemctl stop caddy
rm -rf /usr/systemd/system/caddy.service
@@ -67,7 +67,7 @@ fi
sh -x $curPath/versions/$2/install.sh $1
if [ "${action}" == "install" ] && [ -d $serverPath/caddy ];then
if [ "${action}" = "install" ] && [ -d $serverPath/caddy ];then
echo "${VERSION}" > $serverPath/caddy/version.pl
#初始化

View File

@@ -30,6 +30,7 @@ case $(uname -m) in
x86_64) ARCH_NAME="amd64" ;;
arm) ARCH_NAME="arm64" ;;
arm64) ARCH_NAME="arm64" ;;
aarch64) ARCH_NAME="arm64" ;;
esac
VERSION=2.11.2
@@ -38,7 +39,7 @@ caddyDir=${serverPath}/source/caddy
Install_App()
{
if [ "${action}" == "install" ];then
if [ "${action}" = "install" ];then
if [ -d $serverPath/caddy ];then
exit 0
fi
@@ -59,7 +60,7 @@ Install_App()
mkdir -p cd $serverPath/source/caddy/caddy
cd $serverPath/source/caddy/caddy && tar -zxvf ${caddyDir}/$FILE_NAME
if [ "$OSNAME" == "mac" ];then
if [ "$OSNAME" = "mac" ];then
xattr -cr caddy
fi
@@ -78,9 +79,9 @@ Uninstall_App()
}
action=$1
if [ "${1}" == "install" ];then
if [ "${1}" = "install" ];then
Install_App
elif [ "${1}" == "upgrade" ];then
elif [ "${1}" = "upgrade" ];then
Install_App
else
Uninstall_App

View File

@@ -142,6 +142,7 @@ def initConf():
"/www/server/rsyncd",
"/www/server/acme_pandominassl_apply",
"/www/server/sphinx/index",
"/www/server/manticoresearch",
"/www/server/mongodb/logs",
"/www/server/php/53/var/log",
"/www/server/php/54/var/log",

View File

@@ -13,7 +13,7 @@ serverPath=$(dirname "$rootPath")
VERSION=$2
if [ -f ${rootPath}/bin/activate ];then
source ${rootPath}/bin/activate
. ${rootPath}/bin/activate
fi
@@ -35,7 +35,7 @@ Uninstall_app()
}
action=$1
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_app
else
Uninstall_app

View File

@@ -16,16 +16,16 @@ sysArch=`arch`
sysName=`uname`
ALIST_ARCH_NAME=amd64
if [ "$sysArch" == "arm64" ];then
if [ "$sysArch" = "arm64" ];then
ALIST_ARCH_NAME=arm64
elif [ "$sysArch" == "x86_64" ]; then
elif [ "$sysArch" = "x86_64" ]; then
ALIST_ARCH_NAME=amd64
elif [ "$sysArch" == "aarch64" ]; then
elif [ "$sysArch" = "aarch64" ]; then
ALIST_ARCH_NAME=aarch64
fi
ALIST_NAME=linux
if [ "$sysName" == "Darwin" ];then
if [ "$sysName" = "Darwin" ];then
ALIST_NAME=darwin
fi
@@ -83,7 +83,7 @@ Uninstall_App()
}
action=$1
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_App
else
Uninstall_App

View File

@@ -15,7 +15,7 @@ from pprint import pprint
sys.path.append(os.getcwd() + "/class/core")
import mw
# cd /www/server/mdserver-web && source bin/activate
# cd /www/server/mdserver-web && . bin/activate
# python3 plugins/cryptocurrency_trade/ccxt/public_data/data.py run
# python3 plugins/cryptocurrency_trade/ccxt/public_data/data.py long

View File

@@ -6,7 +6,7 @@ curPath=`pwd`
# bash plugins/cryptocurrency_trade/ccxt/public_data/data.sh
if [ -f ${curPath}/bin/activate ];then
source ${curPath}/bin/activate
. ${curPath}/bin/activate
fi
python3 plugins/cryptocurrency_trade/ccxt/public_data/data.py long

View File

@@ -11,7 +11,7 @@ from decimal import Decimal
sys.path.append(os.getcwd() + "/plugins/cryptocurrency_trade/strategy")
import common
# cd /www/server/mdserver-web && source bin/activate
# cd /www/server/mdserver-web && . bin/activate
# python3 plugins/cryptocurrency_trade/ccxt/strategy/func_test.py run
# common.notifyMsg("任务开始")

View File

@@ -1,4 +1,4 @@
# cd /www/server/mdserver-web && source bin/activate
# cd /www/server/mdserver-web && . bin/activate
# python3 plugins/cryptocurrency_trade/ccxt/strategy/gate_100.py run
# python3 plugins/cryptocurrency_trade/ccxt/strategy/gate_100.py long

View File

@@ -11,7 +11,7 @@ from pprint import pprint
sys.path.append(os.getcwd() + "/plugins/cryptocurrency_trade/strategy")
import common
# cd /www/server/mdserver-web && source bin/activate
# cd /www/server/mdserver-web && . bin/activate
# python3 plugins/cryptocurrency_trade/ccxt/strategy/hammer_robot.py run

View File

@@ -1,4 +1,4 @@
# cd /www/server/mdserver-web && source bin/activate
# cd /www/server/mdserver-web && . bin/activate
# python3 plugins/cryptocurrency_trade/ccxt/strategy/macd_kdj.py run
# python3 plugins/cryptocurrency_trade/ccxt/strategy/macd_kdj.py long

View File

@@ -1,4 +1,4 @@
# cd /www/server/mdserver-web && source bin/activate
# cd /www/server/mdserver-web && . bin/activate
# python3 plugins/cryptocurrency_trade/ccxt/strategy/momentun_trade.py run
# python3 plugins/cryptocurrency_trade/ccxt/strategy/momentun_trade.py long

View File

@@ -1,4 +1,4 @@
# cd /www/server/mdserver-web && source bin/activate
# cd /www/server/mdserver-web && . bin/activate
# python3 plugins/cryptocurrency_trade/ccxt/strategy/notify_demo.py run
# python3 plugins/cryptocurrency_trade/ccxt/strategy/notify_demo.py long

View File

@@ -1,4 +1,4 @@
# cd /www/server/mdserver-web && source bin/activate
# cd /www/server/mdserver-web && . bin/activate
# python3 plugins/cryptocurrency_trade/ccxt/strategy/on_g_test.py t_buy_open
# python3 plugins/cryptocurrency_trade/ccxt/strategy/on_g_test.py t_buy_close

View File

@@ -1,4 +1,4 @@
# cd /www/server/mdserver-web && source bin/activate
# cd /www/server/mdserver-web && . bin/activate
# python3 plugins/cryptocurrency_trade/ccxt/strategy/online_macd_trade.py run
# python3 plugins/cryptocurrency_trade/ccxt/strategy/online_macd_trade.py long

View File

@@ -1,4 +1,4 @@
# cd /www/server/mdserver-web && source bin/activate
# cd /www/server/mdserver-web && . bin/activate
# python3 plugins/cryptocurrency_trade/ccxt/strategy/online_test.py t_buy_open
# python3 plugins/cryptocurrency_trade/ccxt/strategy/online_test.py t_buy_close

View File

@@ -11,7 +11,7 @@ from pprint import pprint
sys.path.append(os.getcwd() + "/plugins/cryptocurrency_trade/strategy")
import common
# cd /www/server/mdserver-web && source bin/activate
# cd /www/server/mdserver-web && . bin/activate
# python3 plugins/cryptocurrency_trade/ccxt/strategy/rsi_robot.py run

View File

@@ -1,4 +1,4 @@
# cd /www/server/mdserver-web && source bin/activate
# cd /www/server/mdserver-web && . bin/activate
# python3 plugins/cryptocurrency_trade/ccxt/strategy/vega_trade.py run
# python3 plugins/cryptocurrency_trade/ccxt/strategy/vega_trade.py long

View File

@@ -5,7 +5,7 @@ pip install git+https://github.com/catalyst-team/catalyst@master --upgrade
cd /www/server/mdserver-web && python3 plugins/cryptocurrency_trade/ccxt/test/p1.py
cd /Users/midoks/Desktop/mwdev/server/mdserver-web && source bin/activate
cd /Users/midoks/Desktop/mwdev/server/mdserver-web && . bin/activate
python3 plugins/cryptocurrency_trade/ccxt/test/p1.py
'''

View File

@@ -5,7 +5,7 @@ pip install git+https://github.com/catalyst-team/catalyst@master --upgrade
cd /www/server/mdserver-web && python3 plugins/cryptocurrency_trade/ccxt/test/p1.py
cd /Users/midoks/Desktop/mwdev/server/mdserver-web && source bin/activate
cd /Users/midoks/Desktop/mwdev/server/mdserver-web && . bin/activate
python3 plugins/cryptocurrency_trade/ccxt/test/p1.py
'''

View File

@@ -9,10 +9,10 @@ from catalyst import run_algorithm
from catalyst.api import order, record, symbol
'''
cd /Users/midoks/Desktop/mwdev/server/mdserver-web && source bin/activate
cd /Users/midoks/Desktop/mwdev/server/mdserver-web && / bin/activate
cd /www/server/mdserver-web && source bin/activate && source activate catalys
cd /www/server/mdserver-web && . bin/activate && source activate catalys
cd /Users/midoks/Desktop/mwdev/server/mdserver-web && python3 plugins/cryptocurrency_trade/ccxt/test/p_test.py
catalyst ingest-exchange -x binance -i btc_usdt -f minute

View File

@@ -1,5 +1,5 @@
[program:{$NAME}]
command=bash -c "cd {$RUN_ROOT} && source bin/activate && python3 {$ABS_FILE} long"
command=bash -c "cd {$RUN_ROOT} && . bin/activate && python3 {$ABS_FILE} long"
directory={$RUN_ROOT}
autorestart=true
startsecs=3

View File

@@ -1,5 +1,5 @@
[program:{$NAME}]
command=bash -c "cd {$RUN_ROOT} && source bin/activate && python3 plugins/cryptocurrency_trade/ccxt/public_data/data.py long"
command=bash -c "cd {$RUN_ROOT} && . bin/activate && python3 plugins/cryptocurrency_trade/ccxt/public_data/data.py long"
directory={$RUN_ROOT}
autorestart=true
startsecs=3

View File

@@ -14,7 +14,7 @@ VERSION=$2
# pip3 install ccxt
if [ -f ${rootPath}/bin/activate ];then
source ${rootPath}/bin/activate
. ${rootPath}/bin/activate
fi
pip3 install ccxt
pip3 install pandas
@@ -56,7 +56,7 @@ Uninstall_App()
}
action=$1
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_App
else
Uninstall_App

View File

@@ -26,7 +26,7 @@ Uninstall_App()
}
action=$1
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_App
else
Uninstall_App

View File

@@ -37,6 +37,7 @@ class nosqlMemcached():
__DB_HOST = '127.0.0.1'
__DB_CONN = None
__DB_ERR = None
__DB_STATUS = None
__DB_LOCAL = None
@@ -48,19 +49,36 @@ class nosqlMemcached():
if self.__DB_HOST in ['127.0.0.1', 'localhost']:
mem_path = "{}/memcached".format(mw.getServerDir())
if not os.path.exists(mem_path): return False
if not os.path.exists(mem_path):
self.__DB_STATUS = 'not_installed'
return False
if not self.__DB_LOCAL:
if not self.__config:
self.__DB_STATUS = 'not_installed'
return False
self.__DB_PORT = int(self.__config['port'])
try:
self.__DB_CONN = pymemcache.client.base.PooledClient((self.__DB_HOST,self.__DB_PORT), max_pool_size=4)
# PooledClient 是惰性连接,探测一次,服务未启动时及时返回 False
self.__DB_CONN.version()
self.__DB_STATUS = None
return self.__DB_CONN
except pymemcache.exceptions.MemcacheError:
self.__DB_STATUS = 'not_running'
return False
except (ConnectionRefusedError, OSError):
self.__DB_STATUS = 'not_running'
return False
except Exception:
self.__DB_ERR = mw.getTracebackInfo()
self.__DB_STATUS = 'not_running'
return False
# 连接状态:not_installed 未安装 / not_running 未启动 / None 正常
def get_status(self):
return self.__DB_STATUS
# 获取配置项
def get_options(self, get=None):
@@ -95,11 +113,20 @@ class nosqlMemcachedCtr():
instance = nosqlMemcached()
return instance
def _connect(self, sid):
obj = self.getInstanceBySid(sid)
conn = obj.conn()
if conn is False:
if obj.get_status() == 'not_installed':
return None, mw.returnData(False, '未安装')
return None, mw.returnData(False, '未启动')
return conn, None
def getItems(self, args):
sid = args['sid']
mem_instance = self.getInstanceBySid(sid).conn()
if mem_instance is False:
return mw.returnData(False,'无法链接')
mem_instance, err = self._connect(sid)
if err:
return err
result = {}
m_items = mem_instance.stats('items')
@@ -122,9 +149,9 @@ class nosqlMemcachedCtr():
def getKeyList(self, args):
sid = args['sid']
mem_instance = self.getInstanceBySid(sid).conn()
if mem_instance is False:
return mw.returnData(False,'无法链接')
mem_instance, err = self._connect(sid)
if err:
return err
p = 1
@@ -194,9 +221,9 @@ class nosqlMemcachedCtr():
def delVal(self, args):
sid = args['sid']
mem_instance = self.getInstanceBySid(sid).conn()
if mem_instance is False:
return mw.returnData(False,'无法链接')
mem_instance, err = self._connect(sid)
if err:
return err
key = args['key']
mem_instance.delete(key)
@@ -205,9 +232,9 @@ class nosqlMemcachedCtr():
def setKv(self, args):
sid = args['sid']
mem_instance = self.getInstanceBySid(sid).conn()
if mem_instance is False:
return mw.returnData(False,'无法链接')
mem_instance, err = self._connect(sid)
if err:
return err
key = args['key']
val = args['val']
@@ -217,9 +244,9 @@ class nosqlMemcachedCtr():
def clear(self, args):
sid = args['sid']
mem_instance = self.getInstanceBySid(sid).conn()
if mem_instance is False:
return mw.returnData(False,'无法链接')
mem_instance, err = self._connect(sid)
if err:
return err
mem_instance.flush_all()
return mw.returnData(True,'清空成功!')

View File

@@ -127,6 +127,7 @@ class nosqlMongodb():
__DB_HOST = '127.0.0.1'
__DB_CONN = None
__DB_ERR = None
__DB_STATUS = None
__DB_LOCAL = None
@@ -138,29 +139,51 @@ class nosqlMongodb():
if self.__DB_HOST in ['127.0.0.1', 'localhost']:
mgdb_path = "{}/mongodb".format(mw.getServerDir())
if not os.path.exists(mgdb_path): return False
if not os.path.exists(mgdb_path):
self.__DB_STATUS = 'not_installed'
return False
if not self.__DB_LOCAL:
if not self.__config:
self.__DB_STATUS = 'not_installed'
return False
self.__DB_PORT = int(self.__config['port'])
auth = getConfAuth()
port = getConfPort()
mg_root = pSqliteDb('config').where('id=?', (1,)).getField('mg_root')
# print(auth,self.__DB_HOST,port, self.__DB_PASS)
try:
if auth == 'disabled':
self.__DB_CONN = pymongo.MongoClient(host=self.__DB_HOST, port=port, directConnection=True)
self.__DB_CONN = pymongo.MongoClient(host=self.__DB_HOST, port=port, directConnection=True, serverSelectionTimeoutMS=3000)
else:
self.__DB_CONN = pymongo.MongoClient(host=self.__DB_HOST, port=port, directConnection=True, username='root',password=mg_root)
self.__DB_CONN = pymongo.MongoClient(host=self.__DB_HOST, port=port, directConnection=True, username='root',password=mg_root, serverSelectionTimeoutMS=3000)
self.__DB_CONN.admin.command('ping')
# 节点处于 recovering/startup 时 ping 仍会成功,但读写会抛 NotPrimaryError
try:
hello = self.__DB_CONN.admin.command('hello')
except Exception:
# MongoDB < 5.0 没有 hello 命令
hello = self.__DB_CONN.admin.command('isMaster')
if not (hello.get('isWritablePrimary') or hello.get('ismaster') or hello.get('secondary')):
self.__DB_ERR = 'MongoDB 节点当前不是 primary 或 secondary 状态'
return False
self.__DB_STATUS = None
self.__DB_ERR = None
return self.__DB_CONN
except pymongo.errors.ConnectionFailure:
self.__DB_STATUS = 'not_running'
return False
except Exception as e:
# print(e)
self.__DB_ERR = mw.getTracebackInfo()
except Exception:
self.__DB_STATUS = 'not_running'
return False
# 连接状态:not_installed 未安装 / not_running 未启动 / None 正常
def get_status(self):
return self.__DB_STATUS
def get_err(self):
return self.__DB_ERR
# 获取配置项
def get_options(self, get=None):
result = {}
@@ -202,11 +225,23 @@ class nosqlMongodbCtr():
instance = nosqlMongodb()
return instance
def _connect(self, sid):
obj = self.getInstanceBySid(sid)
conn = obj.mgdb_conn()
if conn is False:
if obj.get_status() == 'not_installed':
return None, mw.returnData(False, '未安装')
err = obj.get_err()
if err:
return None, mw.returnData(False, err)
return None, mw.returnData(False, '未启动')
return conn, None
def getDbList(self, args):
sid = args['sid']
mgdb_instance = self.getInstanceBySid(sid).mgdb_conn()
if mgdb_instance is False:
return mw.returnData(False,'无法链接')
mgdb_instance, err = self._connect(sid)
if err:
return err
result = {}
doc_list = mgdb_instance.list_database_names()
@@ -221,9 +256,9 @@ class nosqlMongodbCtr():
sid = args['sid']
name = args['name']
mgdb_instance = self.getInstanceBySid(sid).mgdb_conn()
if mgdb_instance is False:
return mw.returnData(False,'无法链接.')
mgdb_instance, err = self._connect(sid)
if err:
return err
result = {}
collections = mgdb_instance[name].list_collection_names()
@@ -242,9 +277,9 @@ class nosqlMongodbCtr():
if 'size' in args:
size = args['size']
mgdb_instance = self.getInstanceBySid(sid).mgdb_conn()
if mgdb_instance is False:
return mw.returnData(False,'无法链接')
mgdb_instance, err = self._connect(sid)
if err:
return err
db_instance = mgdb_instance[db]
collection_instance = db_instance[collection]
@@ -303,9 +338,9 @@ class nosqlMongodbCtr():
db = args['db']
collection = args['collection']
mgdb_instance = self.getInstanceBySid(sid).mgdb_conn()
if mgdb_instance is False:
return mw.returnData(False,'无法链接')
mgdb_instance, err = self._connect(sid)
if err:
return err
db_instance = mgdb_instance[db]
collection_instance = db_instance[collection]

View File

@@ -32,6 +32,7 @@ class nosqlRedis():
__DB_HOST = '127.0.0.1'
__DB_CONN = None
__DB_ERR = None
__DB_STATUS = None
__DB_LOCAL = None
@@ -44,9 +45,13 @@ class nosqlRedis():
if self.__DB_HOST in ['127.0.0.1', 'localhost']:
redis_path = "{}/redis".format(mw.getServerDir())
if not os.path.exists(redis_path):
self.__DB_STATUS = 'not_installed'
return False
if not self.__DB_LOCAL:
if not self.__config:
self.__DB_STATUS = 'not_installed'
return False
self.__DB_PASS = self.__config['requirepass']
self.__DB_PORT = int(self.__config['port'])
@@ -55,13 +60,20 @@ class nosqlRedis():
redis_pool = redis.ConnectionPool(host=self.__DB_HOST, port=self.__DB_PORT, password=self.__DB_PASS, db=db_idx, socket_timeout=3)
self.__DB_CONN = redis.Redis(connection_pool=redis_pool)
self.__DB_CONN.ping()
self.__DB_STATUS = None
return self.__DB_CONN
except redis.exceptions.ConnectionError:
self.__DB_STATUS = 'not_running'
return False
except Exception:
self.__DB_ERR = mw.getTracebackInfo()
self.__DB_STATUS = 'not_running'
return False
# 连接状态:not_installed 未安装 / not_running 未启动 / None 正常
def get_status(self):
return self.__DB_STATUS
# 获取配置项
def get_options(self, get=None):
@@ -112,12 +124,21 @@ class nosqlRedisCtr():
instance = nosqlRedis()
return instance
def _connect(self, sid, idx=0):
obj = self.getInstanceBySid(sid)
conn = obj.redis_conn(idx)
if conn is False:
if obj.get_status() == 'not_installed':
return None, mw.returnData(False, '未安装')
return None, mw.returnData(False, '未启动')
return conn, None
def getList(self, args):
sid = args['sid']
redis_instance = self.getInstanceBySid(sid).redis_conn(0)
if redis_instance is False:
return mw.returnData(False,'无法链接')
redis_instance, err = self._connect(sid, 0)
if err:
return err
redis_info = redis_instance.info()
@@ -166,7 +187,9 @@ class nosqlRedisCtr():
if 'search' in args and args['search'] != '':
search = args['search']
redis_instance = self.getInstanceBySid(sid).redis_conn(idx)
redis_instance, err = self._connect(sid, idx)
if err:
return err
total = redis_instance.dbsize()
@@ -251,7 +274,9 @@ class nosqlRedisCtr():
val = args["val"]
endtime = args["endtime"]
redis_instance = self.getInstanceBySid(sid).redis_conn(idx)
redis_instance, err = self._connect(sid, idx)
if err:
return err
redis_info = redis_instance.info()
if redis_info['role'] == 'slave':
@@ -268,7 +293,9 @@ class nosqlRedisCtr():
sid = args['sid']
idx = args['idx']
name = args["name"]
redis_instance = self.getInstanceBySid(sid).redis_conn(idx)
redis_instance, err = self._connect(sid, idx)
if err:
return err
redis_info = redis_instance.info()
if redis_info['role'] == 'slave':
@@ -281,7 +308,9 @@ class nosqlRedisCtr():
sid = args['sid']
idx = args['idx']
keys = args["keys"]
redis_instance = self.getInstanceBySid(sid).redis_conn(idx)
redis_instance, err = self._connect(sid, idx)
if err:
return err
redis_info = redis_instance.info()
if redis_info['role'] == 'slave':
@@ -297,7 +326,9 @@ class nosqlRedisCtr():
idxs = args['idxs']
for idx in idxs:
redis_instance = self.getInstanceBySid(sid).redis_conn(idx)
redis_instance, err = self._connect(sid, idx)
if err:
return err
redis_info = redis_instance.info()
if redis_info['role'] == 'slave':

View File

@@ -31,6 +31,7 @@ class nosqlMySQL():
__DB_HOST = '127.0.0.1'
__DB_CONN = None
__DB_ERR = None
__DB_STATUS = None
__DB_SOCKET = None
__DB_LOCAL = None
@@ -45,13 +46,19 @@ class nosqlMySQL():
def conn(self):
if self.__sid is None:
self.__DB_STATUS = 'not_installed'
return False
if self.__sid is not None:
mycnf_path = "{}/{}/etc/my.cnf".format(mw.getServerDir(),self.__sid)
if not os.path.exists(mycnf_path):
self.__DB_STATUS = 'not_installed'
return False
if not self.__config:
self.__DB_STATUS = 'not_installed'
return False
self.__DB_PORT = int(self.__config['port'])
self.__DB_USER = self.__config['username']
self.__DB_PASS = self.__config['password']
@@ -65,11 +72,19 @@ class nosqlMySQL():
if self.__DB_SOCKET != '':
db.setSocket(self.__DB_SOCKET)
# 实际连通性检查:服务未启动或账号错误时返回 False,调用方统一提示
db.query('select 1')
self.__DB_STATUS = None
return db
except Exception:
self.__DB_ERR = mw.get_error_info()
self.__DB_ERR = mw.getTracebackInfo()
self.__DB_STATUS = 'not_running'
return False
# 连接状态:not_installed 未安装 / not_running 未启动 / None 正常
def get_status(self):
return self.__DB_STATUS
def sqliteDb(self, db_pos_name, dbname='databases'):
mydb_path = mw.getServerDir() +'/'+db_pos_name
name = 'mysql'
@@ -84,7 +99,7 @@ class nosqlMySQL():
result['host'] = '127.0.0.1'
result['username'] = 'root'
if sid in ['mysql', 'mysql-apt', 'mysql-yum', 'mysql-community']:
if sid in ['mysql', 'mysql-apt', 'mysql-yum', 'mysql-community','mariadb']:
my_cnf_path = "{}/{}/etc/my.cnf".format(mw.getServerDir(),sid)
if not os.path.exists(my_cnf_path):
return False
@@ -136,6 +151,10 @@ class nosqlMySQL():
local_mysql_yum = "{}/mysql-community/etc/my.cnf".format(mw.getServerDir())
if os.path.exists(local_mysql_yum):
data.append({'name':'本地服务器[Tar]', 'val':'mysql-community'})
local_mysql_yum = "{}/mariadb/etc/my.cnf".format(mw.getServerDir())
if os.path.exists(local_mysql_yum):
data.append({'name':'本地服务器[mariadb]', 'val':'mariadb'})
return mw.returnData(True, 'ok', data)
@singleton
@@ -153,11 +172,20 @@ class nosqlMySQLCtr():
instance.setSid(sid)
return instance
def _connect(self, sid):
obj = self.getInstanceBySid(sid)
conn = obj.conn()
if conn is False:
if obj.get_status() == 'not_installed':
return None, mw.returnData(False, '未安装')
return None, mw.returnData(False, '未启动')
return conn, None
def getDbList(self, args):
sid = args['sid']
my_instance = self.getInstanceBySid(sid).conn()
if my_instance is False:
return mw.returnData(False,'无法链接')
my_instance, err = self._connect(sid)
if err:
return err
result = {}
db_list = my_instance.query('show databases')
@@ -172,9 +200,9 @@ class nosqlMySQLCtr():
sid = args['sid']
db = args['db']
my_instance = self.getInstanceBySid(sid).conn()
if my_instance is False:
return mw.returnData(False,'无法链接')
my_instance, err = self._connect(sid)
if err:
return err
sql = "select * from information_schema.tables where table_schema = '"+db+"'"
table_list = my_instance.query(sql)
@@ -226,9 +254,9 @@ class nosqlMySQLCtr():
else:
where_sql = ' where '+args_where['field'] + " like '%"+args_where['value']+"%' "
my_instance = self.getInstanceBySid(sid).conn()
if my_instance is False:
return mw.returnData(False,'无法链接')
my_instance, err = self._connect(sid)
if err:
return err
my_instance.setDbName(db)
sql = 'select count(*) as num from ' + table + where_sql
@@ -268,9 +296,9 @@ class nosqlMySQLCtr():
sql = 'show processlist';
sid = args['sid']
my_instance = self.getInstanceBySid(sid).conn()
if my_instance is False:
return mw.returnData(False,'无法链接')
my_instance, err = self._connect(sid)
if err:
return err
result = my_instance.query(sql)
rdata = {}
@@ -281,9 +309,9 @@ class nosqlMySQLCtr():
sql = 'show status';
sid = args['sid']
my_instance = self.getInstanceBySid(sid).conn()
if my_instance is False:
return mw.returnData(False,'无法链接')
my_instance, err = self._connect(sid)
if err:
return err
result = my_instance.query(sql)
rdata = {}
@@ -294,9 +322,9 @@ class nosqlMySQLCtr():
sql = "show status like 'Com_%'";
sid = args['sid']
my_instance = self.getInstanceBySid(sid).conn()
if my_instance is False:
return mw.returnData(False,'无法链接')
my_instance, err = self._connect(sid)
if err:
return err
result = my_instance.query(sql)
rdata = {}
@@ -331,9 +359,9 @@ class nosqlMySQLCtr():
def getNetList(self, args):
from datetime import datetime
sid = args['sid']
my_instance = self.getInstanceBySid(sid).conn()
if my_instance is False:
return mw.returnData(False,'无法链接')
my_instance, err = self._connect(sid)
if err:
return err
rdata = []
row = {}
@@ -369,9 +397,9 @@ class nosqlMySQLCtr():
def getTopnList(self, args):
sid = args['sid']
my_instance = self.getInstanceBySid(sid).conn()
if my_instance is False:
return mw.returnData(False,'无法链接')
my_instance, err = self._connect(sid)
if err:
return err
is_performance_schema = my_instance.find("SELECT @@performance_schema")
if is_performance_schema is None:
@@ -399,9 +427,9 @@ class nosqlMySQLCtr():
# 查看重复或冗余的索引
def getRedundantIndexes(self, args):
sid = args['sid']
my_instance = self.getInstanceBySid(sid).conn()
if my_instance is False:
return mw.returnData(False,'无法链接')
my_instance, err = self._connect(sid)
if err:
return err
is_performance_schema = my_instance.find("SELECT @@performance_schema")
if is_performance_schema["@@performance_schema"] == 0:
@@ -417,9 +445,9 @@ class nosqlMySQLCtr():
def redundantIndexesCmd(self, args):
sid = args['sid']
my_instance = self.getInstanceBySid(sid).conn()
if my_instance is False:
return mw.returnData(False,'无法链接')
my_instance, err = self._connect(sid)
if err:
return err
is_performance_schema = my_instance.find("SELECT @@performance_schema")
if is_performance_schema["@@performance_schema"] == 0:
@@ -442,29 +470,53 @@ class nosqlMySQLCtr():
from decimal import Decimal
sid = args['sid']
my_instance = self.getInstanceBySid(sid).conn()
if my_instance is False:
return mw.returnData(False,'无法链接')
my_instance, err = self._connect(sid)
if err:
return err
my_instance.execute("SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''))")
# ANY_VALUE 是 MySQL 5.7+ 的函数,MariaDB 不支持(报 FUNCTION ANY_VALUE does not exist);
# 上面已去掉 ONLY_FULL_GROUP_BY,MariaDB 可直接取非聚合字段
ver = my_instance.find("SELECT @@version as db_version")
is_mariadb = ver is not None and 'MariaDB' in str(ver.get('db_version', ''))
def any_val(expr):
return expr if is_mariadb else 'ANY_VALUE(' + expr + ')'
data = my_instance.query(
"""
SELECT t.TABLE_SCHEMA as TABLE_SCHEMA, t.TABLE_NAME as TABLE_NAME, t.ENGINE as ENGINE,
IFNULL(t.DATA_LENGTH/1024/1024/1024, 0) as DATA_LENGTH,
IFNULL(t.INDEX_LENGTH/1024/1024/1024, 0) as INDEX_LENGTH,
IFNULL((DATA_LENGTH+INDEX_LENGTH)/1024/1024/1024, 0) AS TOTAL_LENGTH,
c.column_name AS COLUMN_NAME, c.data_type AS DATA_TYPE, c.COLUMN_TYPE AS COLUMN_TYPE,
t.AUTO_INCREMENT AS AUTO_INCREMENT, locate('unsigned', c.COLUMN_TYPE) = 0 AS IS_SIGNED
FROM information_schema.TABLES t
JOIN information_schema.COLUMNS c ON t.TABLE_SCHEMA = c.TABLE_SCHEMA AND t.table_name=c.table_name
WHERE t.TABLE_SCHEMA NOT IN ('mysql', 'information_schema', 'performance_schema', 'sys')
GROUP BY TABLE_NAME
ORDER BY TOTAL_LENGTH DESC, AUTO_INCREMENT DESC;
"""
SELECT t.TABLE_SCHEMA as TABLE_SCHEMA, t.TABLE_NAME as TABLE_NAME,
{engine} as ENGINE,
{data_length} as DATA_LENGTH,
{index_length} as INDEX_LENGTH,
{total_length} AS TOTAL_LENGTH,
{column_name} AS COLUMN_NAME, {data_type} AS DATA_TYPE,
{column_type} AS COLUMN_TYPE,
{auto_increment} AS AUTO_INCREMENT,
{is_signed} AS IS_SIGNED
FROM information_schema.TABLES t
JOIN information_schema.COLUMNS c ON t.TABLE_SCHEMA = c.TABLE_SCHEMA AND t.table_name=c.table_name
WHERE t.TABLE_SCHEMA NOT IN ('mysql', 'information_schema', 'performance_schema', 'sys')
GROUP BY t.TABLE_SCHEMA, t.TABLE_NAME
ORDER BY TOTAL_LENGTH DESC, AUTO_INCREMENT DESC
""".format(
engine=any_val("t.ENGINE"),
data_length=any_val("IFNULL(t.DATA_LENGTH/1024/1024/1024, 0)"),
index_length=any_val("IFNULL(t.INDEX_LENGTH/1024/1024/1024, 0)"),
total_length=any_val("IFNULL((t.DATA_LENGTH+t.INDEX_LENGTH)/1024/1024/1024, 0)"),
column_name=any_val("c.column_name"),
data_type=any_val("c.data_type"),
column_type=any_val("c.COLUMN_TYPE"),
auto_increment=any_val("t.AUTO_INCREMENT"),
is_signed=any_val("locate('unsigned', c.COLUMN_TYPE) = 0"),
)
)
if data is None:
return mw.returnData(True, 'ok', [])
if isinstance(data, Exception):
return mw.returnData(False, '查询失败: ' + str(data))
for i in range(len(data)):
row = data[i]
@@ -515,9 +567,9 @@ class nosqlMySQLCtr():
# 查看应用端IP连接数总和
def getConnCount(self, args):
sid = args['sid']
my_instance = self.getInstanceBySid(sid).conn()
if my_instance is False:
return mw.returnData(False,'无法链接')
my_instance, err = self._connect(sid)
if err:
return err
data = my_instance.query(
"SELECT user,db,substring_index(HOST,':',1) AS Client_IP,count(1) AS count FROM information_schema.PROCESSLIST "
@@ -539,9 +591,9 @@ class nosqlMySQLCtr():
# 快速找出没有主键的表
def getFpkInfo(self, args):
sid = args['sid']
my_instance = self.getInstanceBySid(sid).conn()
if my_instance is False:
return mw.returnData(False,'无法链接')
my_instance, err = self._connect(sid)
if err:
return err
data = my_instance.query(
"""
@@ -561,9 +613,9 @@ class nosqlMySQLCtr():
def getLockSql(self, args):
sid = args['sid']
my_instance = self.getInstanceBySid(sid).conn()
if my_instance is False:
return mw.returnData(False,'无法链接')
my_instance, err = self._connect(sid)
if err:
return err
data = my_instance.query(
"""
@@ -592,9 +644,9 @@ class nosqlMySQLCtr():
def killLockPid(self, args):
sid = args['sid']
my_instance = self.getInstanceBySid(sid).conn()
if my_instance is False:
return mw.returnData(False,'无法链接')
my_instance, err = self._connect(sid)
if err:
return err
pid = args['pid']
my_instance.execute('kill %s' % pid)
@@ -602,9 +654,9 @@ class nosqlMySQLCtr():
def killAllLock(self, args):
sid = args['sid']
my_instance = self.getInstanceBySid(sid).conn()
if my_instance is False:
return mw.returnData(False,'无法链接')
my_instance, err = self._connect(sid)
if err:
return err
data = self.getLockSql(args)
if data['status']:
@@ -619,9 +671,9 @@ class nosqlMySQLCtr():
def getDeadlockInfo(self, args):
sid = args['sid']
my_instance = self.getInstanceBySid(sid).conn()
if my_instance is False:
return mw.returnData(False,'无法链接')
my_instance, err = self._connect(sid)
if err:
return err
data = my_instance.find("SHOW ENGINE INNODB STATUS")
if data is not None:
@@ -634,29 +686,45 @@ class nosqlMySQLCtr():
def getSlaveStatus(self, args):
sid = args['sid']
my_instance = self.getInstanceBySid(sid).conn()
if my_instance is False:
return mw.returnData(False,'无法链接')
my_instance, err = self._connect(sid)
if err:
return err
slave_info = my_instance.find('SHOW SLAVE STATUS')
if slave_info is None:
# MySQL 8.0.22+ 使用 SHOW REPLICA STATUS,MySQL 9.0 已移除 SHOW SLAVE STATUS
slave_data = my_instance.query('SHOW REPLICA STATUS')
if isinstance(slave_data, Exception):
# 兼容 MySQL 8.0.22 以下及旧版 MariaDB
slave_data = my_instance.query('SHOW SLAVE STATUS')
if isinstance(slave_data, Exception):
return mw.returnData(False, '获取主从状态失败: ' + str(slave_data))
if slave_data is None or len(slave_data) == 0:
return mw.returnData(True, 'ok', '未开启从库!')
slave_info = slave_data[0]
# 兼容新旧字段名: MySQL 8.0.22+ 将 Slave_*/Seconds_Behind_Master 重命名为 Replica_*/Seconds_Behind_Source
io_running = slave_info.get('Replica_IO_Running', slave_info.get('Slave_IO_Running'))
sql_running = slave_info.get('Replica_SQL_Running', slave_info.get('Slave_SQL_Running'))
seconds_behind = slave_info.get('Seconds_Behind_Source', slave_info.get('Seconds_Behind_Master'))
msg = ''
if slave_info['Auto_Position'] != 1:
if slave_info.get('Auto_Position') != 1:
msg += '你没有开启基于GTID全局事务ID复制,请确保CHANGE MASTER TO MASTER_AUTO_POSITION = 1.\n'
if slave_info['Slave_IO_Running'] == 'Yes' and slave_info['Slave_SQL_Running'] == 'Yes':
if slave_info['Seconds_Behind_Master'] == 0:
if io_running == 'Yes' and sql_running == 'Yes':
if seconds_behind == 0:
msg = "同步正常,无延迟"
return mw.returnData(True, 'ok', msg)
else:
return mw.returnData(True, 'ok', '同步正常,但有延迟,延迟时间为:%s' % slave_info['Seconds_Behind_Master'])
return mw.returnData(True, 'ok', '同步正常,但有延迟,延迟时间为:%s' % seconds_behind)
else:
msg = '主从复制报错,请检查\nSlave_IO_Running状态值是:%s, | Slave_SQL_Running状态值是:%s\nLast_Error错误信息是:%s\nLast_SQL_Error错误信息是:%s\n' \
% (slave_info['Slave_IO_Running'], slave_info['Slave_SQL_Running'], slave_info['Last_Error'], slave_info['Last_SQL_Error'])
error_dict = my_instance.find('select LAST_ERROR_NUMBER,LAST_ERROR_MESSAGE,LAST_ERROR_TIMESTAMP from performance_schema.replication_applier_status_by_worker ORDER BY LAST_ERROR_TIMESTAMP desc limit 1')
% (io_running, sql_running, slave_info.get('Last_Error'), slave_info.get('Last_SQL_Error'))
error_data = my_instance.query('select LAST_ERROR_NUMBER,LAST_ERROR_MESSAGE,LAST_ERROR_TIMESTAMP from performance_schema.replication_applier_status_by_worker ORDER BY LAST_ERROR_TIMESTAMP desc limit 1')
if isinstance(error_data, Exception) or not error_data:
msg += 'MySQL Replication Health is NOT OK!'
return mw.returnData(True, 'ok', msg)
error_dict = error_data[0]
msg += '错误号是:%s \n' % error_dict['LAST_ERROR_NUMBER']
msg += '错误信息是:%s \n' % error_dict['LAST_ERROR_MESSAGE']
msg += '报错时间是:%s \n' % error_dict['LAST_ERROR_TIMESTAMP']

View File

@@ -0,0 +1,825 @@
# coding:utf-8
import sys
import os
import re
import json
import time
import psycopg2
import psycopg2.extras
web_dir = os.getcwd() + "/web"
if os.path.exists(web_dir):
sys.path.append(web_dir)
os.chdir(web_dir)
import core.mw as mw
PG_SYSTEM_SCHEMAS = ('pg_catalog', 'information_schema', 'pg_toast')
def getPluginName():
return 'postgresql'
def getServerDir():
return mw.getServerDir() + '/' + getPluginName()
def getConf():
return getServerDir() + '/data/postgresql.conf'
def isInstalled():
return os.path.exists(getConf())
def getPort():
content = mw.readFile(getConf())
if content:
tmp = re.search(r'^[#\s]*port\s*=\s*(\d+)', content, re.M)
if tmp:
return int(tmp.groups()[0])
return 5432
def getSocketDir():
sock_name = '.s.PGSQL.' + str(getPort())
for sock_dir in ['/tmp', getServerDir()]:
if os.path.exists(sock_dir + '/' + sock_name):
return sock_dir
return ''
def quoteIdent(name):
return '"' + str(name).replace('"', '""') + '"'
def quoteTable(name):
return '.'.join(quoteIdent(x) for x in str(name).split('.'))
def fmtValue(value):
if value is None:
return None
if isinstance(value, (dict, list, tuple)):
return json.dumps(value, ensure_ascii=False, default=str)
if isinstance(value, (bytes, bytearray, memoryview)):
return bytes(value).hex()
if isinstance(value, (int, float, str, bool)):
return value
return str(value)
def fmtRows(rows):
ret = []
for row in rows:
item = {}
for k in row:
item[k] = fmtValue(row[k])
ret.append(item)
return ret
class PgClient:
def __init__(self, database='postgres'):
self.database = database
self.status = None
self.error = None
self.conn = None
def connect(self):
if not isInstalled():
self.status = 'not_installed'
return False
try:
host = getSocketDir()
if host == '':
host = '127.0.0.1'
self.conn = psycopg2.connect(database=self.database,
user='postgres',
host=host,
port=getPort(),
connect_timeout=3)
self.conn.autocommit = True
return True
except psycopg2.OperationalError as e:
msg = str(e).strip()
if 'does not exist' in msg:
self.status = 'db_not_found'
elif 'authentication' in msg or 'password' in msg:
self.status = 'auth_error'
else:
self.status = 'not_running'
self.error = msg
except Exception as e:
self.status = 'not_running'
self.error = str(e)
return False
def query(self, sql, params=()):
cur = self.conn.cursor(cursor_factory=psycopg2.extras.RealDictCursor)
try:
# 无参数时不能传空 tuple,否则 SQL 里的 % 会被当作占位符
if params:
cur.execute(sql, params)
else:
cur.execute(sql)
rows = cur.fetchall()
return [dict(x) for x in rows]
finally:
cur.close()
def one(self, sql, params=()):
rows = self.query(sql, params)
if len(rows) == 0:
return None
return rows[0]
def execute(self, sql, params=()):
cur = self.conn.cursor()
try:
if params:
cur.execute(sql, params)
else:
cur.execute(sql)
return cur.rowcount
finally:
cur.close()
def close(self):
if self.conn:
self.conn.close()
self.conn = None
def openClient(args, database='postgres'):
client = PgClient(database)
if client.connect():
return client, None
if client.status == 'not_installed':
msg = '未安装'
elif client.status == 'not_running':
msg = '未启动'
elif client.status == 'db_not_found':
msg = '数据库不存在'
elif client.status == 'auth_error':
msg = '连接失败,请检查数据库认证配置'
else:
msg = client.error or '连接失败'
return None, mw.returnData(False, msg)
# 服务器列表
def get_server_list(args):
data = []
if isInstalled():
data.append({'name': '本地服务器', 'val': 'postgresql'})
return mw.returnData(True, 'ok', data)
# 数据库列表
def get_db_list(args):
client, err = openClient(args)
if err:
return err
try:
rows = client.query("select datname from pg_database where datistemplate = false order by datname")
result = {'list': [x['datname'] for x in rows]}
return mw.returnData(True, 'ok', result)
finally:
client.close()
# 数据表列表
def get_table_list(args):
db = args.get('db', '')
client, err = openClient(args, db)
if err:
return err
try:
sql = """
select n.nspname as schemaname, c.relname as tablename
from pg_class c
join pg_namespace n on n.oid = c.relnamespace
where c.relkind in ('r', 'p', 'v', 'm', 'f')
and n.nspname not in ('pg_catalog', 'information_schema', 'pg_toast')
and n.nspname not like 'pg_temp%'
order by n.nspname, c.relname
"""
rows = client.query(sql)
table_list = []
for x in rows:
if x['schemaname'] == 'public':
table_list.append(x['tablename'])
else:
table_list.append(x['schemaname'] + '.' + x['tablename'])
result = {'list': table_list}
return mw.returnData(True, 'ok', result)
finally:
client.close()
# 数据列表
def get_data_list(args):
db = args.get('db', '')
table = args.get('table', '')
p = 1
size = 10
if 'p' in args:
p = int(args['p'])
if 'size' in args:
size = int(args['size'])
start_index = (p - 1) * size
if table == '':
page_args = {}
page_args['count'] = 0
page_args['tojs'] = 'pgGetDataList'
page_args['p'] = 1
page_args['row'] = size
rdata = {}
rdata['page'] = mw.getPage(page_args)
rdata['list'] = []
rdata['count'] = 0
return mw.returnData(True, 'ok', rdata)
where_sql = ''
where_params = []
args_where = {}
if 'where' in args and isinstance(args['where'], dict):
args_where = args['where']
field = args_where.get('field', '')
if field and field != '0':
field_sql = quoteIdent(field)
value = str(args_where.get('value', ''))
if 'id' in field.lower():
where_sql = ' where ' + field_sql + ' = %s'
where_params.append(value)
else:
where_sql = ' where ' + field_sql + ' like %s'
where_params.append('%' + value + '%')
client, err = openClient(args, db)
if err:
return err
try:
try:
sql = 'select count(*) as num from ' + quoteTable(table) + where_sql
count_row = client.one(sql, tuple(where_params))
count = int(count_row['num'])
sql = 'select * from ' + quoteTable(table) + where_sql + ' limit %s offset %s'
params = tuple(where_params) + (size, start_index)
rows = client.query(sql, params)
rows = fmtRows(rows)
except psycopg2.errors.UndefinedTable:
return mw.returnData(False, '数据表不存在:' + table)
except psycopg2.errors.UndefinedColumn:
return mw.returnData(False, '字段不存在,请刷新后重试')
except psycopg2.Error as e:
return mw.returnData(False, '查询失败:' + str(e).strip())
page_args = {}
page_args['count'] = count
page_args['tojs'] = 'pgGetDataList'
page_args['p'] = p
page_args['row'] = size
rdata = {}
rdata['page'] = mw.getPage(page_args)
rdata['list'] = rows
rdata['count'] = count
rdata['soso_field'] = ''
if field and field != '0':
rdata['soso_field'] = field
return mw.returnData(True, 'ok', rdata)
finally:
client.close()
# 进程列表
def get_proccess_list(args):
client, err = openClient(args)
if err:
return err
try:
sql = """
select pid, usename as "user", datname as db,
coalesce(host(client_addr), '本地') as host,
application_name as command, state, query as info,
backend_start, xact_start, query_start,
wait_event_type, wait_event
from pg_stat_activity
where pid <> pg_backend_pid()
and backend_type = 'client backend'
order by pid
"""
rows = fmtRows(client.query(sql))
result = {'list': rows}
return mw.returnData(True, 'ok', result)
finally:
client.close()
# 状态列表
def get_status_list(args):
client, err = openClient(args)
if err:
return err
try:
sql = """
select name, setting, coalesce(unit, '') as unit,
category, short_desc
from pg_settings
order by name
"""
rows = fmtRows(client.query(sql))
result = {'list': rows}
return mw.returnData(True, 'ok', result)
finally:
client.close()
# 统计列表
def get_stats_list(args):
client, err = openClient(args)
if err:
return err
try:
sql = """
select datname as db,
numbackends as conn,
xact_commit as commit, xact_rollback as rollback,
blks_read, blks_hit,
tup_returned, tup_fetched, tup_inserted, tup_updated, tup_deleted,
deadlocks, conflicts, temp_files, temp_bytes,
round(100.0 * blks_hit / nullif(blks_hit + blks_read, 0), 2) as cache_hit_ratio
from pg_stat_database
where datname is not null
order by datname
"""
rows = fmtRows(client.query(sql))
result = {'list': rows}
return mw.returnData(True, 'ok', result)
finally:
client.close()
def _dbStatSnapshot(client):
sql = """
select coalesce(sum(tup_fetched), 0) as fetched,
coalesce(sum(tup_inserted), 0) as inserted,
coalesce(sum(tup_updated), 0) as updated,
coalesce(sum(tup_deleted), 0) as deleted,
coalesce(sum(xact_commit), 0) as commits
from pg_stat_database
"""
row = client.one(sql)
return {
'fetched': int(row['fetched']),
'inserted': int(row['inserted']),
'updated': int(row['updated']),
'deleted': int(row['deleted']),
'commits': int(row['commits']),
}
# QPS/TPS 指标
def get_net_list(args):
from datetime import datetime
client, err = openClient(args)
if err:
return err
try:
row1 = _dbStatSnapshot(client)
time.sleep(1)
row2 = _dbStatSnapshot(client)
max_conn = client.one("select setting from pg_settings where name = 'max_connections'")
conn_row = client.one("select count(*) as num from pg_stat_activity where backend_type = 'client backend'")
row = {}
row['current_time'] = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
row['select'] = row2['fetched'] - row1['fetched']
row['insert'] = row2['inserted'] - row1['inserted']
row['update'] = row2['updated'] - row1['updated']
row['delete'] = row2['deleted'] - row1['deleted']
row['conn'] = conn_row['num']
row['max_conn'] = max_conn['setting']
# PostgreSQL 的 pg_stat 不提供网络字节计数器
row['recv_mbps'] = '-'
row['send_mbps'] = '-'
rdata = []
rdata.append(row)
return mw.returnData(True, 'ok', rdata)
finally:
client.close()
# 查询执行次数最频繁的前N条SQL语句
def get_topn_list(args):
client, err = openClient(args)
if err:
return err
try:
avail = client.one("""
select default_version, installed_version
from pg_available_extensions
where name = 'pg_stat_statements'
""")
if avail is None:
return mw.returnData(False, '当前 PostgreSQL 未提供 pg_stat_statements 扩展(缺少 contrib 模块),无法使用该功能。')
# 先检查 shared_preload_libraries —— pg_stat_statements 必须预加载
preload = client.one("select setting from pg_settings where name = 'shared_preload_libraries'")
libs = (preload or {}).get('setting', '') or ''
if 'pg_stat_statements' not in libs:
return mw.returnData(False, "pg_stat_statements 扩展必须在启动时预加载。\n"
"请在 postgresql.conf 添加 shared_preload_libraries = 'pg_stat_statements' 后重启 PostgreSQL。")
# 再检查扩展是否已 CREATE
ext = client.one("select to_regclass('pg_stat_statements') as v")
if ext is None or ext['v'] is None:
return mw.returnData(False, "pg_stat_statements 扩展已预加载,但尚未启用。\n"
"请在当前数据库执行 CREATE EXTENSION pg_stat_statements;")
version_num = int(client.one('show server_version_num')['server_version_num'])
if version_num >= 130000:
total_col = 'total_exec_time'
max_col = 'max_exec_time'
mean_col = 'mean_exec_time'
else:
total_col = 'total_time'
max_col = 'max_time'
mean_col = 'mean_time'
sql = """
select s.query,
coalesce(d.datname, '-') as db,
'-' as last_seen,
s.calls as exec_count,
round(s.{max_col}::numeric, 2) as max_latency,
round(s.{mean_col}::numeric, 2) as avg_latency
from pg_stat_statements s
left join pg_database d on d.oid = s.dbid
""".format(max_col=max_col, mean_col=mean_col)
filter_db = args.get('filter_db', 'no')
if filter_db == 'yes':
sql += ' where d.datname is not null '
sql += ' order by s.calls desc limit 20'
rows = fmtRows(client.query(sql))
return mw.returnData(True, 'ok', rows)
finally:
client.close()
def _redundantIndexes(client):
sql = """
select n.nspname as table_schema,
t.relname as table_name,
ic.relname as redundant_index_name,
coalesce((
select string_agg(a.attname, ',' order by k.ord)
from unnest(i.indkey) with ordinality as k(attnum, ord)
join pg_attribute a on a.attrelid = i.indrelid and a.attnum = k.attnum
), '') as redundant_index_columns,
'DROP INDEX ' || quote_ident(n.nspname) || '.' || quote_ident(ic.relname) as sql_drop_index
from pg_index i
join pg_class t on t.oid = i.indrelid
join pg_namespace n on n.oid = t.relnamespace
join pg_class ic on ic.oid = i.indexrelid
where n.nspname not in ('pg_catalog', 'information_schema', 'pg_toast')
and not exists (
select 1 from pg_constraint con where con.conindid = i.indexrelid
)
and exists (
select 1
from pg_index i2
join pg_class ic2 on ic2.oid = i2.indexrelid
where i2.indrelid = i.indrelid
and i2.indkey = i.indkey
and i2.indclass = i.indclass
and i2.indcollation = i.indcollation
and i2.indpred is not distinct from i.indpred
and i2.indexprs is not distinct from i.indexprs
and i2.indexrelid <> i.indexrelid
and ic2.relname < ic.relname
)
order by 1, 2, 3
"""
return fmtRows(client.query(sql))
# 查看重复或冗余的索引
def get_redundant_indexes(args):
client, err = openClient(args)
if err:
return err
try:
rows = _redundantIndexes(client)
return mw.returnData(True, 'ok', rows)
finally:
client.close()
# 删除重复或冗余的索引
def redundant_indexes_cmd(args):
client, err = openClient(args)
if err:
return err
try:
rows = _redundantIndexes(client)
index = int(args['index'])
if index >= len(rows):
return mw.returnData(False, '索引不存在,请刷新后重试')
client.execute(rows[index]['sql_drop_index'])
return mw.returnData(True, '执行成功!')
finally:
client.close()
# 统计库里每个表的大小
def get_table_info(args):
client, err = openClient(args)
if err:
return err
try:
sql = """
select n.nspname as "TABLE_SCHEMA",
c.relname as "TABLE_NAME",
case c.relkind
when 'r' then 'table'
when 'p' then 'partitioned table'
when 'v' then 'view'
when 'm' then 'materialized view'
else c.relkind::text
end as "ENGINE",
c.reltuples as rows_estimate,
pg_relation_size(c.oid) as data_bytes,
pg_indexes_size(c.oid) as index_bytes,
pg_total_relation_size(c.oid) as total_bytes,
coalesce((
select string_agg(a.attname, ',' order by k.ord)
from pg_index i
join unnest(i.indkey) with ordinality as k(attnum, ord) on true
join pg_attribute a on a.attrelid = i.indrelid and a.attnum = k.attnum
where i.indrelid = c.oid and i.indisprimary
), '-') as "COLUMN_NAME",
coalesce((
select string_agg(format_type(a.atttypid, a.atttypmod), ',' order by k.ord)
from pg_index i
join unnest(i.indkey) with ordinality as k(attnum, ord) on true
join pg_attribute a on a.attrelid = i.indrelid and a.attnum = k.attnum
where i.indrelid = c.oid and i.indisprimary
), '-') as "COLUMN_TYPE"
from pg_class c
join pg_namespace n on n.oid = c.relnamespace
where c.relkind in ('r', 'p', 'v', 'm')
and n.nspname not in ('pg_catalog', 'information_schema', 'pg_toast')
and n.nspname not like 'pg_temp%'
order by total_bytes desc
"""
rows = client.query(sql)
for i in range(len(rows)):
row = rows[i]
row['DATA_LENGTH'] = round(float(row['data_bytes'] or 0) / 1024 / 1024 / 1024, 2)
row['INDEX_LENGTH'] = round(float(row['index_bytes'] or 0) / 1024 / 1024 / 1024, 2)
row['TOTAL_LENGTH'] = round(float(row['total_bytes'] or 0) / 1024 / 1024 / 1024, 2)
# PostgreSQL 没有 AUTO_INCREMENT,使用 SEQUENCE / IDENTITY
row['AUTO_INCREMENT'] = '-'
row['RESIDUAL_AUTO_INCREMENT'] = '使用 SEQUENCE/IDENTITY'
row['ROWS_ESTIMATE'] = int(row['rows_estimate'] or 0)
del row['data_bytes']
del row['index_bytes']
del row['total_bytes']
return mw.returnData(True, 'ok', fmtRows(rows))
finally:
client.close()
# 查看应用端IP连接数总和
def get_conn_count(args):
client, err = openClient(args)
if err:
return err
try:
sql = """
select usename as "user",
coalesce(datname, '空') as db,
coalesce(host(client_addr), '本地') as "Client_IP",
count(*) as count
from pg_stat_activity
where backend_type = 'client backend'
group by usename, datname, client_addr
order by count desc
"""
rows = fmtRows(client.query(sql))
return mw.returnData(True, 'ok', rows)
finally:
client.close()
# 快速找出没有主键的表
def get_fpk_info(args):
client, err = openClient(args)
if err:
return err
try:
sql = """
select n.nspname as table_schema, c.relname as table_name
from pg_class c
join pg_namespace n on n.oid = c.relnamespace
where c.relkind in ('r', 'p')
and n.nspname not in ('pg_catalog', 'information_schema', 'pg_toast')
and not exists (
select 1 from pg_index i
where i.indrelid = c.oid and i.indisprimary
)
order by n.nspname, c.relname
"""
rows = fmtRows(client.query(sql))
return mw.returnData(True, 'ok', rows)
finally:
client.close()
# 查看当前锁阻塞的SQL
def get_lock_sql(args):
client, err = openClient(args)
if err:
return err
try:
sql = """
select coalesce(a.backend_xid::text, '-') as trx_id,
'等待锁' as trx_state,
a.xact_start as trx_started,
a.pid as processlist_id,
a.query as info,
a.usename as "user",
coalesce(host(a.client_addr), '本地') as host,
a.datname as db,
coalesce(a.wait_event_type, '-') as command,
a.state,
'SELECT pg_cancel_backend(' || a.pid || ')' as sql_kill_blocking_query,
pg_blocking_pids(a.pid) as blocking_pids
from pg_stat_activity a
where cardinality(pg_blocking_pids(a.pid)) > 0
and a.backend_type = 'client backend'
order by a.xact_start
"""
rows = fmtRows(client.query(sql))
return mw.returnData(True, 'ok', rows)
finally:
client.close()
# 终止阻塞会话
def kill_lock_pid(args):
client, err = openClient(args)
if err:
return err
try:
pid = int(args['pid'])
data = client.one('select pg_terminate_backend(%s) as ok', (pid,))
if data is None or data['ok'] is not True:
return mw.returnData(False, '结束会话失败,请检查会话是否存在')
return mw.returnData(True, '执行成功!')
finally:
client.close()
# 终止所有阻塞会话
def kill_all_lock(args):
client, err = openClient(args)
if err:
return err
try:
sql = """
select distinct unnest(pg_blocking_pids(pid)) as pid
from pg_stat_activity
where cardinality(pg_blocking_pids(pid)) > 0
and backend_type = 'client backend'
"""
rows = client.query(sql)
count = 0
for x in rows:
data = client.one('select pg_terminate_backend(%s) as ok', (x['pid'],))
if data is not None and data['ok'] is True:
count += 1
return mw.returnData(True, '执行成功,已结束 %s 个阻塞会话' % count)
finally:
client.close()
# 查看死锁信息
def get_deadlock_info(args):
client, err = openClient(args)
if err:
return err
try:
deadlocks = client.one('select coalesce(sum(deadlocks), 0) as num from pg_stat_database')
locks = client.query("""
select pid, usename as "user", datname as db, state,
coalesce(wait_event_type, '-') as wait_event_type,
query
from pg_stat_activity
where cardinality(pg_blocking_pids(pid)) > 0
and backend_type = 'client backend'
""")
msg = 'PostgreSQL 不保存历史死锁明细,仅提供累计次数与当前锁等待。\n'
msg += '数据库累计死锁次数:%s\n' % deadlocks['num']
if len(locks) == 0:
msg += '当前没有处于锁等待的会话。'
else:
msg += '当前锁等待会话:\n'
for x in locks:
msg += 'pid=%s user=%s db=%s state=%s wait=%s\nquery=%s\n' % (
x['pid'], x['user'], x['db'], x['state'], x['wait_event_type'], x['query'])
return mw.returnData(True, 'ok', msg)
finally:
client.close()
# 查看主从复制信息
def get_slave_status(args):
client, err = openClient(args)
if err:
return err
try:
recovery = client.one('select pg_is_in_recovery() as recovery')['recovery']
if recovery is False:
reps = client.query("""
select client_addr, application_name, state, sync_state,
sent_lsn, write_lsn, flush_lsn, replay_lsn,
coalesce(replay_lag::text, '-') as replay_lag
from pg_stat_replication
""")
if len(reps) == 0:
return mw.returnData(True, 'ok', '未开启主从复制:当前为主库,且没有复制的从库连接。')
msg = '当前为主库,从库复制状态:\n'
for x in reps:
msg += '从库地址:%s 应用:%s\n' % (x['client_addr'], x['application_name'])
msg += '状态:%s 同步模式:%s\n' % (x['state'], x['sync_state'])
msg += 'sent_lsn=%s write_lsn=%s flush_lsn=%s replay_lsn=%s\n' % (
x['sent_lsn'], x['write_lsn'], x['flush_lsn'], x['replay_lsn'])
msg += 'replay_lag=%s\n\n' % x['replay_lag']
return mw.returnData(True, 'ok', msg)
# 当前为从库
lag = client.one("""
select coalesce(extract(epoch from (now() - pg_last_xact_replay_timestamp()))::int, 0) as lag
""")
lsn = client.one("""
select pg_last_wal_receive_lsn() as receive_lsn,
pg_last_wal_replay_lsn() as replay_lsn,
pg_last_xact_replay_timestamp() as replay_time
""")
msg = '当前为从库,复制状态:\n'
msg += 'receive_lsn=%s\n' % lsn['receive_lsn']
msg += 'replay_lsn=%s\n' % lsn['replay_lsn']
msg += '最近回放时间=%s\n' % lsn['replay_time']
msg += '延迟时间:%s 秒' % lag['lag']
return mw.returnData(True, 'ok', msg)
finally:
client.close()

View File

@@ -6,6 +6,7 @@
<div class="tabs-item" data-name="mongodb">Mongodb</div>
<div class="tabs-item" data-name="memcached">Memcached</div>
<div class="tabs-item" data-name="mysql">MySQL</div>
<div class="tabs-item" data-name="postgresql">PostgreSQL</div>
</div>
</div>
@@ -16,6 +17,99 @@
<div class="prompt_description">当前未安装本地服务器,<a class="btlink install_server" href="/soft/index">点击安装</a></div>
</div>
<!-- postgresql start -->
<div class="tab-con hide" id="postgresql" style="padding: 0px;">
<div class="col-md-12" style="padding: 0px;overflow: hidden;">
<div class="tootls_group tootls_top">
<div class="pull-left">
<div class="pgserver_list" style="float:left;">
<select name="sid" class="bt-input-text c5 mr5">
<option value="0">本地服务器</option>
</select>
</div>
<div class="postgresql_db_list" style="float:left;">
<select name="postgresql_db" class="bt-input-text c5 mr5">
<option value="0">数据库空</option>
</select>
</div>
<div class="postgresql_table_list" style="float:left;">
<select name="postgresql_table" class="bt-input-text c5 mr5">
<option value="0">数据表空</option>
</select>
</div>
<div class="field" style="float:left;">
<select name="postgresql_field_key" class="bt-input-text c5 mr5" style="width:80px;">
<option value="0">无字段</option>
</select>
</div>
<div class="value" style="float:left;">
<input name="postgresql_field_value" type="text" class="bt-input-text" placeholder="请输入查找内容">
</div>
<div style="float:left;">
<button id="postgresql_find" type="button" class="btn btn-success btn-sm mr5 ml5" >查找</button>
<button id="postgresql_common" type="button" class="btn btn-success btn-sm mr5 ml5">常用功能</button>
</div>
</div>
</div>
<div style="position: relative;">
<div id="postgresql_table" class="postgresql_table divtable mtb10">
<table class="table table-hover">
<thead style="position: relative;z-index: 1;">
<tr>
<th><span>编号</span></th>
<th><span>操作类型</span></th>
<th><span>详情</span></th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
<div class="postgresql_list_page page">
<div><span class="Pcurrent">0</span><span class="Pcount">共0条</span></div>
</div>
</div>
<hr style="border:none;" />
<div class="col-md-12" style="padding-left: 3px;">
<div id="postgresql_list_tab" style="padding-top:0px;">
<div class="tab-nav">
<span data-name="proccess" class="on">进程</span>
<span data-name="status" class="">状态</span>
<span data-name="stats" class="">统计</span>
</div>
</div>
<div style="position: relative;">
<div id="postgresql_ot_table" class="divtable">
<table class="table table-hover">
<thead style="position: relative;z-index: 1;">
<tr>
<th><span>编号</span></th>
<th><span>操作类型</span></th>
<th><span>详情</span></th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
</div>
</div>
<!-- postgresql end -->
<!-- mysql start -->
<!-- show w-full -->
<div class="tab-con hide" id="mysql" style="padding: 0px;">

View File

@@ -143,6 +143,60 @@ function myPostCBN(method, args, callback){
},'json');
}
function pgPostCB(method, args, callback){
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
var req_data = {};
req_data['name'] = 'data_query';
req_data['func'] = method;
req_data['script']='sql_postgresql';
args['version'] = '';
if (typeof(args) == 'string' && args == ''){
req_data['args'] = JSON.stringify(toArrayObject(args));
} else {
req_data['args'] = JSON.stringify(args);
}
$.post('/plugins/callback', req_data, function(data) {
layer.close(loadT);
if (!data.status){
layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']});
return;
}
if(typeof(callback) == 'function'){
callback(data);
}
},'json');
}
function pgPostCBN(method, args, callback){
var req_data = {};
req_data['name'] = 'data_query';
req_data['func'] = method;
req_data['script']='sql_postgresql';
args['version'] = '';
if (typeof(args) == 'string' && args == ''){
req_data['args'] = JSON.stringify(toArrayObject(args));
} else {
req_data['args'] = JSON.stringify(args);
}
$.post('/plugins/callback', req_data, function(data) {
if (!data.status){
layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']});
return;
}
if(typeof(callback) == 'function'){
callback(data);
}
},'json');
}
function selectTab(tab = 'redis'){
$('.tab-view-box .tab-con').addClass('hide').removeClass('show').removeClass('w-full');
@@ -163,6 +217,7 @@ function initTabFunc(tab){
case 'mongodb':initTabMongodb();break;
case 'memcached':initTabMemcached();break;
case 'mysql':initTabMySQL();break;
case 'postgresql':initTabPostgresql();break;
case 'default:':initTabRedis();break;
}
}
@@ -237,7 +292,7 @@ function initTabMemcached(){
$('#memcached_clear_all').unbind('click').click(function(){
var sid = memcachedGetSid();
memPostCB('clear',{'sid':sid} ,function(rdata){
// console.log(rdata);
console.log("xxx",rdata);
showMsg(rdata.data.msg,function(){
if (rdata.data.status){
memcachedGetList();
@@ -927,6 +982,7 @@ function mysqlInitField(f, data){
function mysqlGetServerList(call_func){
closeInstallLayer();
myPostCBN('get_server_list', {}, function(rdata){
var rdata = rdata.data;
if (rdata.data.length != 0){
@@ -951,7 +1007,10 @@ function mysqlGetServerList(call_func){
}
closeInstallLayer();
} else {
showInstallLayer();
layer.msg(rdata.data.msg,{ icon: 7, time: 2000, shade: 0.3 });
setTimeout(function(){
showInstallLayer();
},2050);
}
});
}
@@ -1201,9 +1260,9 @@ function memcachedGetItem(){
function memcachedGetList(){
var sid = memcachedGetSid();
closeInstallLayer();
memPostCB('get_items',{'sid':sid} ,function(rdata){
if (rdata.data.status){
var items = rdata.data.data['items'];
var content = '';
for (var i = 0; i < items.length; i++) {
@@ -1219,10 +1278,14 @@ function memcachedGetList(){
memcachedGetKeyList(1);
});
closeInstallLayer();
memcachedGetKeyList(1);
} else {
showInstallLayer();
layer.msg(rdata.data.msg,{ icon: 7, time: 2000, shade: 0.3 });
setTimeout(function(){
showInstallLayer();
},2050);
}
memcachedGetKeyList(1);
});
}
@@ -1386,7 +1449,6 @@ function mongodbInitField(f, data){
var mogodb_db_list;
function mongodbCollectionName(){
// console.log(mogodb_db_list);
var v = mogodb_db_list.getValue('value');
if (v.length == 0){
// console.log($('#mongodb').data('collection'));
@@ -1397,6 +1459,7 @@ function mongodbCollectionName(){
function mongodbGetList(){
var sid = mongodbGetSid();
closeInstallLayer();
mgdbPostCB('get_db_list',{'sid':sid} ,function(rdata){
// console.log(rdata);
if (rdata.data.status){
@@ -1423,7 +1486,11 @@ function mongodbGetList(){
closeInstallLayer();
} else {
showInstallLayer();
layer.msg(rdata.data.msg,{ icon: 7, time: 2000, shade: 0.3 });
setTimeout(function(){
showInstallLayer();
},2050);
}
});
}
@@ -1606,6 +1673,7 @@ function redisGetIdx(){
function redisGetList(){
var sid = redisGetSid();
closeInstallLayer();
redisPostCB('get_list',{'sid':sid} ,function(rdata){
if (rdata.data.status){
var list = rdata.data.data;
@@ -1627,7 +1695,10 @@ function redisGetList(){
redisGetKeyList(1);
closeInstallLayer();
} else {
showInstallLayer();
layer.msg(rdata.data.msg,{ icon: 7, time: 1000, shade: 0.3 });
setTimeout(function(){
showInstallLayer();
},1050);
}
});
}
@@ -1936,3 +2007,663 @@ function redisBatchClear(){
}
// ------------------------- redis end ---------------------------------
// ------------------------- postgresql start -------------------------------
var pg_timer = null;
var pg_last_error = '';
function pgToastError(msg){
// 轮询失败时避免每 2 秒重复弹出相同的提示
if (!msg || pg_last_error == msg){
return;
}
pg_last_error = msg;
layer.msg(msg,{icon:7,time:2500});
}
function pgHtml(v){
if (v === null || v === undefined){
return '';
}
return String(v).replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;');
}
function pgGetSid(){
return $('#postgresql select[name=sid]').val();
}
function pgGetDbName(){
return $('#postgresql .postgresql_db_list select[name=postgresql_db]').val();
}
function pgGetTableName(){
var table = $('#postgresql .postgresql_table_list select[name=postgresql_table]').val();
if (!table || table == '0'){
return '';
}
return table;
}
function pgShowNotice(title, msg){
layer.open({
type: 1,
title: title,
area: ['560px', '260px'],
closeBtn: 1,
shadeClose: false,
content: '<div class="bt-form pd20"><pre style="white-space:pre-wrap;word-break:break-all;margin:0;line-height:1.8;">'+pgHtml(msg)+'</pre></div>'
});
}
function pgModalTable(title, list, width, height){
if (!list || list.length == 0){
layer.msg('暂无数据',{icon:7});
return;
}
var fields = mongodbGetDataFields(list);
var thead = '';
for (var i = 0; i < fields.length; i++){
thead += '<th>'+pgHtml(fields[i])+'</th>';
}
var tbody = '';
for (var i = 0; i < list.length; i++){
tbody += '<tr>';
for (var j = 0; j < fields.length; j++){
var f = fields[j];
var val = (f in list[i]) ? list[i][f] : '';
tbody += '<td title="'+pgHtml(val)+'">'+pgHtml(val)+'</td>';
}
tbody += '</tr>';
}
layer.open({
type: 1,
title: title,
area: [width || '900px', height || '420px'],
closeBtn: 1,
shadeClose: false,
content: '<div class="bt-form pd20 divtable taskdivtable" style="height:'+(parseInt(height || '420') - 80)+'px;overflow:auto;">\
<table class="table table-hover">\
<thead><tr>'+thead+'</tr></thead>\
<tbody>'+tbody+'</tbody>\
</table>\
</div>'
});
}
function pgInitField(f, data){
var option_html = '<option value="0">无字段</option>';
for (var i = 0; i < f.length; i++){
if (data['soso_field'] == f[i]){
option_html += '<option value="'+pgHtml(f[i])+'" selected>'+pgHtml(f[i])+'</option>';
} else {
option_html += '<option value="'+pgHtml(f[i])+'">'+pgHtml(f[i])+'</option>';
}
}
$('#postgresql select[name="postgresql_field_key"]').html(option_html);
}
function initTabPostgresql(){
clearInterval(pg_timer);
pg_last_error = '';
pgGetServerList(function(){
pgGetDbList();
pgProcessList();
clearInterval(pg_timer);
pg_timer = setInterval(function(){
var name = $('#postgresql_list_tab .tab-nav span.on').data('name');
pgRunPgTab(name);
var fname = $('#cutTab .tabs-item.active').data('name');
if (fname != 'postgresql'){
clearInterval(pg_timer);
}
}, 2000);
});
$('#postgresql_list_tab .tab-nav span').unbind('click').click(function(){
$('#postgresql_list_tab .tab-nav span').removeClass('on');
$(this).addClass('on');
var name = $(this).data('name');
pgRunPgTab(name);
});
$('#postgresql_find').unbind('click').click(function(){
var val = $('#postgresql input[name="postgresql_field_value"]').val();
if (val == ''){
layer.msg('搜索不能为空!',{icon:7});
return;
}
pgGetDataList(1);
});
pgCommonFunc();
}
function pgRunPgTab(name){
switch(name){
case 'proccess':pgProcessList();break;
case 'status':pgStatusList();break;
case 'stats':pgStatsList();break;
}
}
function pgGetServerList(call_func){
closeInstallLayer();
pgPostCBN('get_server_list', {}, function(rdata){
var data = rdata.data;
if (data.data && data.data.length != 0){
var items = data.data;
var content = '';
for (var i = 0; i < items.length; i++){
var t = items[i];
if (i == 0){
content += '<option value="'+t['val']+'" selected>'+t['name']+'</option>';
} else {
content += '<option value="'+t['val']+'">'+t['name']+'</option>';
}
}
$('#postgresql select[name=sid]').html(content);
$('#postgresql select[name=sid]').change(function(){
pgGetDbList();
});
if (typeof(call_func) == 'function'){
call_func();
}
closeInstallLayer();
} else {
layer.msg('当前未安装 PostgreSQL',{icon:7,time:2000,shade:0.3});
setTimeout(function(){
showInstallLayer();
},2050);
}
});
}
function pgGetDbList(){
var sid = pgGetSid();
pgPostCBN('get_db_list',{'sid':sid}, function(rdata){
var data = rdata.data;
if (!data.status){
layer.msg(data.msg,{icon:7,time:2500});
return;
}
var items = data.data['list'];
if (items.length == 0){
$('#postgresql .postgresql_db_list select[name=postgresql_db]').html('<option value="0">数据库空</option>');
$('#postgresql .postgresql_table_list select[name=postgresql_table]').html('<option value="0">数据表空</option>');
$('#postgresql_table thead tr').html('');
$('#postgresql_table tbody').html('');
$('.postgresql_list_page').html('<div><span class="Pcurrent">0</span><span class="Pcount">共0条</span></div>');
return;
}
var content = '';
for (var i = 0; i < items.length; i++){
var name = items[i];
if (i == 0){
content += '<option value="'+pgHtml(name)+'" selected>database['+pgHtml(name)+']</option>';
} else {
content += '<option value="'+pgHtml(name)+'">database['+pgHtml(name)+']</option>';
}
}
$('#postgresql .postgresql_db_list select[name=postgresql_db]').html(content);
$('#postgresql .postgresql_db_list select[name=postgresql_db]').change(function(){
pgGetTableList(1);
});
pgGetTableList(1);
});
}
function pgGetTableList(p){
var sid = pgGetSid();
var db = pgGetDbName();
if (!db || db == '0'){
return;
}
pgPostCBN('get_table_list',{'sid':sid,'db':db}, function(rdata){
var data = rdata.data;
if (!data.status){
layer.msg(data.msg,{icon:7,time:2500});
return;
}
var items = data.data['list'];
if (items.length == 0){
$('#postgresql .postgresql_table_list select[name=postgresql_table]').html('<option value="0">数据表空</option>');
$('#postgresql_table thead tr').html('');
$('#postgresql_table tbody').html('');
$('.postgresql_list_page').html('<div><span class="Pcurrent">0</span><span class="Pcount">共0条</span></div>');
return;
}
var content = '';
for (var i = 0; i < items.length; i++){
var name = items[i];
if (i == 0){
content += '<option value="'+pgHtml(name)+'" selected>table['+pgHtml(name)+']</option>';
} else {
content += '<option value="'+pgHtml(name)+'">table['+pgHtml(name)+']</option>';
}
}
$('#postgresql .postgresql_table_list select[name=postgresql_table]').html(content);
$('#postgresql .postgresql_table_list select[name=postgresql_table]').change(function(){
pgGetDataList(1);
});
pgGetDataList(1);
});
}
function pgGetDataList(p){
var sid = pgGetSid();
var db = pgGetDbName();
var table = pgGetTableName();
var pg_field = $('#postgresql select[name="postgresql_field_key"]').val();
var pg_value = $('#postgresql input[name="postgresql_field_value"]').val();
var request_data = {
'sid': sid,
'db': db,
'table': table,
'p': p,
'size': 10
};
if (pg_field != '0' && pg_field){
request_data['where'] = {field: pg_field, value: pg_value};
} else {
request_data['where'] = {};
}
pgPostCB('get_data_list', request_data, function(rdata){
var data = rdata.data;
if (!data.status){
layer.msg(data.msg,{icon:7,time:2500});
return;
}
var rdata2 = data.data;
var dlist = rdata2['list'];
var fields = mongodbGetDataFields(dlist);
if (fields.length != 0){
pgInitField(fields, rdata2);
}
var header_field = '';
for (var i = 0; i < fields.length; i++){
header_field += '<th>'+pgHtml(fields[i])+'</th>';
}
$('#postgresql_table thead tr').html(header_field);
var tbody = '';
for (var i = 0; i < dlist.length; i++){
tbody += '<tr>';
for (var j = 0; j < fields.length; j++){
var f = fields[j];
var val = (f in dlist[i]) ? dlist[i][f] : '';
tbody += '<td title="'+pgHtml(val)+'">'+pgHtml(val)+'</td>';
}
tbody += '</tr>';
}
$('#postgresql_table tbody').html(tbody);
$('#postgresql .postgresql_list_page').html(rdata2['page']);
});
}
function pgRenderOtTable(dlist){
var fields = mongodbGetDataFields(dlist);
var header_field = '';
for (var i = 0; i < fields.length; i++){
header_field += '<th>'+pgHtml(fields[i])+'</th>';
}
$('#postgresql_ot_table thead tr').html(header_field);
var tbody = '';
for (var i = 0; i < dlist.length; i++){
tbody += '<tr>';
for (var j = 0; j < fields.length; j++){
var f = fields[j];
var val = (f in dlist[i]) ? dlist[i][f] : '';
tbody += '<td title="'+pgHtml(val)+'">'+pgHtml(val)+'</td>';
}
tbody += '</tr>';
}
$('#postgresql_ot_table tbody').html(tbody);
}
function pgProcessList(){
pgPostCBN('get_proccess_list',{'sid':pgGetSid()}, function(rdata){
var data = rdata.data;
if (!data.status){
pgToastError(data.msg);
return;
}
pg_last_error = '';
pgRenderOtTable(data.data['list']);
});
}
function pgStatusList(){
pgPostCBN('get_status_list',{'sid':pgGetSid()}, function(rdata){
var data = rdata.data;
if (!data.status){
pgToastError(data.msg);
return;
}
pg_last_error = '';
pgRenderOtTable(data.data['list']);
});
}
function pgStatsList(){
pgPostCBN('get_stats_list',{'sid':pgGetSid()}, function(rdata){
var data = rdata.data;
if (!data.status){
pgToastError(data.msg);
return;
}
pg_last_error = '';
pgRenderOtTable(data.data['list']);
});
}
function pgCommonFunc(){
$('#postgresql_common').unbind('click').click(function(){
layer.open({
type: 1,
title: "PostgreSQL常用功能",
area: ['600px', '200px'],
closeBtn: 1,
shadeClose: false,
content: '<div class="bt-form pd20">\
<button style="margin-bottom: 8px;" id="pg_top_nsql" type="button" class="btn btn-default btn-sm">查询执行次数最频繁的前N条SQL语句</button>\
<button style="margin-bottom: 8px;" id="pg_net_stat" type="button" class="btn btn-default btn-sm">PostgreSQL服务器的QPS/TPS指标</button>\
<button style="margin-bottom: 8px;" id="pg_redundant_indexes" type="button" class="btn btn-default btn-sm">查看重复或冗余的索引</button>\
<button style="margin-bottom: 8px;" id="pg_table_info" type="button" class="btn btn-default btn-sm">统计库里每个表的大小</button>\
<button style="margin-bottom: 8px;" id="pg_conn_count" type="button" class="btn btn-default btn-sm">查看应用端IP连接数总和</button>\
<button style="margin-bottom: 8px;" id="pg_fpk_info" type="button" class="btn btn-default btn-sm">快速找出没有主键的表</button>\
<button style="margin-bottom: 8px;" id="pg_lock_sql" type="button" class="btn btn-default btn-sm">查看当前锁阻塞的SQL</button>\
<button style="margin-bottom: 8px;" id="pg_deadlock_info" type="button" class="btn btn-default btn-sm">查看死锁信息</button>\
<button style="margin-bottom: 8px;" id="pg_slave_status" type="button" class="btn btn-default btn-sm">查看主从复制信息</button>\
</div>',
success:function(i,l){
$('#pg_top_nsql').click(function(){ pgCommonFuncTopN(); });
$('#pg_net_stat').click(function(){ pgCommonFuncNet(); });
$('#pg_redundant_indexes').click(function(){ pgCommonFuncRedundantIndexes(); });
$('#pg_table_info').click(function(){ pgCommonFuncTableInfo(); });
$('#pg_conn_count').click(function(){ pgCommonFuncConnCount(); });
$('#pg_fpk_info').click(function(){ pgCommonFuncFpkInfo(); });
$('#pg_lock_sql').click(function(){ pgCommonFuncLockSQL(); });
$('#pg_deadlock_info').click(function(){ pgCommonFuncDeadlockInfo(); });
$('#pg_slave_status').click(function(){ pgCommonFuncSlaveStatus(); });
}
});
});
}
function pgCommonFuncTopN(){
pgPostCBN('get_topn_list',{'sid':pgGetSid()}, function(rdata){
var data = rdata.data;
if (!data.status){
pgShowNotice('查询执行次数最频繁的前N条SQL语句', data.msg);
return;
}
pgModalTable('查询执行次数最频繁的前N条SQL语句', data.data, '1000px', '450px');
});
}
function pgCommonFuncNet(){
pgPostCBN('get_net_list',{'sid':pgGetSid()}, function(rdata){
var data = rdata.data;
if (!data.status){
pgShowNotice('PostgreSQL服务器的QPS/TPS指标', data.msg);
return;
}
pgModalTable('PostgreSQL服务器的QPS/TPS指标(网络带宽需在系统层监控)', data.data, '1000px', '360px');
});
}
function pgCommonFuncRedundantIndexes(){
function renderList(){
pgPostCBN('get_redundant_indexes',{'sid':pgGetSid()}, function(rdata){
var data = rdata.data;
if (!data.status){
layer.msg(data.msg,{icon:7,time:2500});
return;
}
var items = data.data;
if (items.length == 0){
layer.msg('没有发现重复或冗余的索引',{icon:7});
return;
}
var tbody = '';
for (var i = 0; i < items.length; i++){
tbody += '<tr>\
<td>'+pgHtml(items[i]['table_schema'])+'</td>\
<td>'+pgHtml(items[i]['table_name'])+'</td>\
<td>'+pgHtml(items[i]['redundant_index_name'])+'</td>\
<td>'+pgHtml(items[i]['redundant_index_columns'])+'</td>\
<td><a class="pg_drop_index btlink" index="'+i+'">删除</a></td>\
</tr>';
}
layer.open({
type: 1,
title: "查看重复或冗余的索引",
area: ['1000px', '420px'],
closeBtn: 1,
shadeClose: false,
content: '<div class="bt-form pd20 divtable taskdivtable">\
<table class="table table-hover" id="pg_redundant_table">\
<thead><tr>\
<th>库名</th><th>表名</th><th>冗余索引</th><th>字段</th><th>操作</th>\
</tr></thead>\
<tbody>'+tbody+'</tbody>\
</table>\
</div>',
success: function(){
$('#pg_redundant_table .pg_drop_index').click(function(){
var index = $(this).attr('index');
layer.confirm('确定删除索引 '+pgHtml(items[index]['redundant_index_name'])+' ?', {btn:['确定','取消']}, function(li){
pgPostCB('redundant_indexes_cmd', {'sid':pgGetSid(),'index':index}, function(r2){
var d = r2.data;
showMsg(d.msg,function(){
if (d.status){
layer.close(li);
renderList();
}
},{icon: d.status ? 1 : 2}, 2000);
});
});
});
}
});
});
}
renderList();
}
function pgCommonFuncTableInfo(){
pgPostCBN('get_table_info',{'sid':pgGetSid()}, function(rdata){
var data = rdata.data;
if (!data.status){
pgShowNotice('统计库里每个表的大小(单位 GB)', data.msg);
return;
}
pgModalTable('统计库里每个表的大小(单位 GB)', data.data, '1200px', '460px');
});
}
function pgCommonFuncConnCount(){
pgPostCBN('get_conn_count',{'sid':pgGetSid()}, function(rdata){
var data = rdata.data;
if (!data.status){
pgShowNotice('查看应用端IP连接数总和', data.msg);
return;
}
pgModalTable('查看应用端IP连接数总和', data.data, '700px', '420px');
});
}
function pgCommonFuncFpkInfo(){
pgPostCBN('get_fpk_info',{'sid':pgGetSid()}, function(rdata){
var data = rdata.data;
if (!data.status){
layer.msg(data.msg,{icon:7,time:2500});
return;
}
pgModalTable('快速找出没有主键的表', data.data, '800px', '400px');
});
}
function pgCommonFuncLockSQL(){
function renderSQL(){
pgPostCBN('get_lock_sql',{'sid':pgGetSid()}, function(rdata){
var data = rdata.data;
if (!data.status){
layer.msg(data.msg,{icon:7,time:2500});
return;
}
var items = data.data;
var tbody = '';
for (var i = 0; i < items.length; i++){
var t = '<tr>';
t += '<td>'+pgHtml(items[i]['trx_id'])+'</td>';
t += '<td>'+pgHtml(items[i]['trx_state'])+'</td>';
t += '<td>'+pgHtml(items[i]['trx_started'])+'</td>';
t += '<td>'+pgHtml(items[i]['processlist_id'])+'</td>';
t += '<td title="'+pgHtml(items[i]['info'])+'">'+pgHtml(items[i]['info'])+'</td>';
t += '<td>'+pgHtml(items[i]['user'])+'</td>';
t += '<td>'+pgHtml(items[i]['host'])+'</td>';
t += '<td>'+pgHtml(items[i]['db'])+'</td>';
t += '<td>'+pgHtml(items[i]['command'])+'</td>';
t += '<td>'+pgHtml(items[i]['state'])+'</td>';
t += '<td>'+pgHtml(items[i]['sql_kill_blocking_query'])+'</td>';
t += '<td><a class="exec btlink" index="'+i+'">执行</a></td>';
t += '</tr>';
tbody += t;
}
$('#pg_lock_table tbody').html(tbody);
$('#pg_lock_table tbody .exec').click(function(){
var index = $(this).attr('index');
var pid = items[index]['processlist_id'];
pgPostCB('kill_lock_pid', {'sid':pgGetSid(),'pid':pid}, function(r2){
var d = r2.data;
showMsg(d.msg,function(){
if (d.status){
renderSQL();
}
},{icon: d.status ? 1 : 2}, 2000);
});
});
});
}
layer.open({
type: 1,
title: "查看当前锁阻塞的SQL",
area: ['1100px', '420px'],
closeBtn: 1,
shadeClose: false,
content: '<div class="bt-form pd20 divtable taskdivtable">\
<div class="mr20 pull-left" style="border-right: 1px solid #ccc; padding-right: 20px;">\
<button id="pg_kill_all" type="button" class="btn btn-default btn-sm">关闭所有阻塞</button>\
</div>\
<hr />\
<table class="table table-hover" id="pg_lock_table">\
<thead><tr>\
<th>事务ID</th><th>事务状态</th><th>执行时间</th><th>线程ID</th>\
<th>Info</th><th>user</th><th>host</th><th>db</th>\
<th>command</th><th>state</th><th>kill</th><th>操作</th>\
</tr></thead>\
<tbody></tbody>\
</table>\
</div>',
success:function(){
renderSQL();
$('#pg_kill_all').unbind('click').click(function(){
pgPostCB('kill_all_lock', {'sid':pgGetSid()}, function(r2){
var d = r2.data;
showMsg(d.msg,function(){
if (d.status){
renderSQL();
}
},{icon: d.status ? 1 : 2}, 2000);
});
});
}
});
}
function pgCommonFuncDeadlockInfo(){
function renderText(){
pgPostCBN('get_deadlock_info',{'sid':pgGetSid()}, function(rdata){
var data = rdata.data;
if (!data.status){
layer.msg(data.msg,{icon:7,time:2500});
return;
}
$('#pg_info_log').val(data.data);
});
}
layer.open({
type: 1,
title: "查看死锁信息",
area: ['800px', '400px'],
closeBtn: 1,
shadeClose: false,
content: '<div class="bt-form pd15">\
<textarea readonly="" style="margin: 0px;height: 330px;width: 100%;background-color: #333;color:#fff; padding:0 5px" id="pg_info_log"></textarea>\
</div>',
success:function(){
renderText();
}
});
}
function pgCommonFuncSlaveStatus(){
function renderText(){
pgPostCBN('get_slave_status',{'sid':pgGetSid()}, function(rdata){
var data = rdata.data;
if (!data.status){
layer.msg(data.msg,{icon:7,time:2500});
return;
}
$('#pg_info_log').val(data.data);
});
}
layer.open({
type: 1,
title: "查看主从复制信息",
area: ['800px', '400px'],
closeBtn: 1,
shadeClose: false,
content: '<div class="bt-form pd15">\
<textarea readonly="" style="margin: 0px;height: 330px;width: 100%;background-color: #333;color:#fff; padding:0 5px" id="pg_info_log"></textarea>\
</div>',
success:function(){
renderText();
}
});
}
// ------------------------- postgresql end ---------------------------------

View File

@@ -13,7 +13,7 @@ serverPath=$(dirname "$rootPath")
VERSION=$2
if [ -f ${rootPath}/bin/activate ];then
source ${rootPath}/bin/activate
. ${rootPath}/bin/activate
fi
# {
@@ -40,7 +40,7 @@ fi
Install_Docker()
{
# which docker
# if [ "$?" == "0" ];then
# if [ "$?" = "0" ];then
# echo '安装已经完成docker'
# exit 0
# fi
@@ -69,7 +69,7 @@ Uninstall_Docker()
{
CMD=yum
which apt
if [ "$?" == "0" ];then
if [ "$?" = "0" ];then
CMD=apt
fi
@@ -97,7 +97,7 @@ Uninstall_Docker()
}
action=$1
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_Docker
else
Uninstall_Docker

View File

@@ -135,9 +135,6 @@ def initDreplace():
return ''
def appOp(method):
initDreplace()
if not mw.isAppleSystem():

View File

@@ -2,7 +2,7 @@
"ps": "DNS over HTTPS(DoH)是一种通过HTTPS协议加密域名解析请求的技术!",
"name": "doh",
"title": "DoH",
"versions": ["0.9.15"],
"versions": ["0.9.15","0.10.0"],
"tip": "soft",
"install_pre_inspection":false,
"uninstall_pre_inspection":true,

View File

@@ -9,9 +9,9 @@ Type=simple
User=www
Group=www
WorkingDirectory={$SERVER_PATH}/doh
# /www/server/doh/doh-proxy -u 127.0.0.1:53 -l 127.0.0.1:3000
# /www/server/doh/doh-proxy -u 127.0.0.1:53 -l 127.0.0.1:3198
# /www/server/doh/doh-proxy -h
ExecStart={$SERVER_PATH}/doh/doh-proxy -u 127.0.0.1:53 -l 127.0.0.1:3000
ExecStart={$SERVER_PATH}/doh/doh-proxy -u 127.0.0.1:53 -l 127.0.0.1:3198
Restart=always
RemainAfterExit=yes
#AmbientCapabilities=CAP_NET_BIND_SERVICE

View File

@@ -8,7 +8,7 @@ rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
if [ -f ${rootPath}/bin/activate ];then
source ${rootPath}/bin/activate
. ${rootPath}/bin/activate
fi
@@ -43,7 +43,7 @@ Install_App()
echo '正在安装脚本文件...'
version=$1
if [ "macos" == "$OSNAME" ];then
if [ "macos" = "$OSNAME" ];then
echo "not support!"
exit
else
@@ -59,22 +59,16 @@ Install_App()
if [ -f $serverPath/source/doh/$file_xz ];then
cd $serverPath/source/doh && tar -xjf $file_xz
fi
echo "mv $serverPath/source/doh/doh-proxy $serverPath/doh"
if [ -f $serverPath/source/doh/doh-proxy ];then
echo "mv $serverPath/source/doh/doh-proxy $serverPath/doh"
mv $serverPath/source/doh/doh-proxy $serverPath/doh
fi
if [ -d $serverPath/doh ];then
echo $version > $serverPath/doh/version.pl
cd ${rootPath} && python3 plugins/doh/index.py start
cd ${rootPath} && python3 plugins/doh/index.py initd_install
fi
echo $version > $serverPath/doh/version.pl
echo 'install doh success'
}
@@ -95,7 +89,7 @@ Uninstall_App()
action=$1
version=$2
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_App $version
else
Uninstall_App $version

View File

@@ -13,13 +13,13 @@ serverPath=$(dirname "$rootPath")
VERSION=$2
if [ -f ${rootPath}/bin/activate ];then
source ${rootPath}/bin/activate
. ${rootPath}/bin/activate
fi
OSNAME=`bash ${rootPath}/scripts/getos.sh`
if [ "" == "$OSNAME" ];then
if [ "" = "$OSNAME" ];then
OSNAME=`cat ${rootPath}/data/osname.pl`
fi
@@ -83,7 +83,7 @@ Uninstall_App()
}
action=$1
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_App
else
Uninstall_App

View File

@@ -14,16 +14,16 @@ sysArch=`arch`
sysName=`uname`
DZ_ARCH_NAME=amd64
if [ "$sysArch" == "arm64" ];then
if [ "$sysArch" = "arm64" ];then
DZ_ARCH_NAME=arm64
elif [ "$sysArch" == "x86_64" ]; then
elif [ "$sysArch" = "x86_64" ]; then
DZ_ARCH_NAME=amd64
elif [ "$sysArch" == "aarch64" ]; then
elif [ "$sysArch" = "aarch64" ]; then
DZ_ARCH_NAME=aarch64
fi
DZ_NAME=linux
if [ "$sysName" == "Darwin" ];then
if [ "$sysName" = "Darwin" ];then
DZ_NAME=darwin
fi
Install_App()
@@ -78,7 +78,7 @@ Uninstall_App()
}
action=$1
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_App
else
Uninstall_App

View File

@@ -328,7 +328,7 @@ def setBlackIp():
mw.execShell('fail2ban-client -vvv set {jail} unbanip {ip}'.format(jail=d, ip=ip))
mw.writeFile(getBlackFile(), json.dumps([]))
return nw.returnJson(True, "禁止IP成功")
return mw.returnJson(True, "禁止IP成功")
# 检查IP格式
for ip in add_ip_list:

View File

@@ -67,7 +67,7 @@ Uninstall_App()
}
action=$1
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_App
else
Uninstall_App

View File

@@ -3,9 +3,9 @@ PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
function version_gt() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1"; }
function version_le() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" == "$1"; }
function version_le() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" = "$1"; }
function version_lt() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" != "$1"; }
function version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" == "$1"; }
function version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" = "$1"; }
# cd /www/server/mdserver-web/plugins/gdrive && /bin/bash install.sh install 2.0
@@ -22,7 +22,7 @@ PATH=$PATH:${rootPath}/bin
export PATH
# if [ -f ${rootPath}/bin/activate ];then
# source ${rootPath}/bin/activate
# . ${rootPath}/bin/activate
# fi
VERSION=$2
@@ -43,9 +43,9 @@ Install_App()
echo "python3 < 3.10"
cd ${GDDIR} && python3 -m venv .
fi
cd ${GDDIR} && source ${GDDIR}/bin/activate
cd ${GDDIR} && . ${GDDIR}/bin/activate
else
cd ${GDDIR} && source ${GDDIR}/bin/activate
cd ${GDDIR} && . ${GDDIR}/bin/activate
fi
tmp=`python3 -V 2>&1|awk '{print $2}'`
@@ -101,7 +101,7 @@ action=$1
type=$2
echo $action $type
if [ "${action}" == 'install' ];then
if [ "${action}" = 'install' ];then
Install_App
else
Uninstall_App

View File

@@ -2,7 +2,7 @@
"ps": "Gitea是一个开源社区驱动的轻量级代码托管解决方案。",
"name": "gitea",
"title": "Gitea",
"versions": ["1.17.2","1.18.5","1.22.1","1.24.3"],
"versions": ["1.17.2","1.18.5","1.22.1","1.24.3","1.25.3"],
"tip": "soft",
"install_pre_inspection":false,
"uninstall_pre_inspection":true,

View File

@@ -2,16 +2,22 @@
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
# cd /www/server/mdserver-web/plugins/gitea && bash install.sh upgrade 1.25.3
action=$1
version=$2
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
if [ -f ${rootPath}/bin/activate ];then
source ${rootPath}/bin/activate
. ${rootPath}/bin/activate
fi
URL_DOWNLOAD=https://dl.gitea.com
@@ -25,11 +31,11 @@ getBit(){
}
Install_Rsync(){
if [ "$OSNAME" == "debian" ] || [ "$OSNAME" == "ubuntu" ];then
if [ "$OSNAME" = "debian" ] || [ "$OSNAME" = "ubuntu" ];then
apt install -y rsync
elif [[ "$OSNAME" == "arch" ]]; then
elif [[ "$OSNAME" = "arch" ]]; then
echo y | pacman -Sy rsync
elif [[ "$OSNAME" == "macos" ]]; then
elif [[ "$OSNAME" = "macos" ]]; then
# brew install rsync
# brew install lsyncd
echo "ok"
@@ -66,7 +72,7 @@ Install_App()
git config --global push.default simple
if [ "macos" == "$OSNAME" ];then
if [ "macos" = "$OSNAME" ];then
file=gitea-${version}-darwin-10.12-amd64
else
file=gitea-${version}-linux-amd64
@@ -87,20 +93,21 @@ Install_App()
chown -R www:www $serverPath/gitea
fi
if [ -d $serverPath/gitea ];then
echo $version > $serverPath/gitea/version.pl
if [ -d $serverPath/gitea ] && [ "${action}" = 'install' ] ;then
cd ${rootPath} && python3 plugins/gitea/index.py start
cd ${rootPath} && python3 plugins/gitea/index.py initd_install
fi
echo $version > $serverPath/gitea/version.pl
echo 'install success'
if [ "$action" = "upgrade" ];then
which systemctl && systemctl restart gitea
fi
}
Uninstall_App()
{
if [ -f /usr/lib/systemd/system/gitea.service ];then
systemctl stop gitea
systemctl disable gitea
@@ -116,11 +123,10 @@ Uninstall_App()
echo 'uninstall success'
}
action=$1
version=$2
if [ "${1}" == 'install' ];then
if [ "${action}" = 'install' ] || [ "$action" = "upgrade" ];then
Install_App $version
else
elif [ "${action}" = 'uninstall' ];then
Uninstall_App $version
else
echo "OPTIONS ERROR"
fi

View File

@@ -8,7 +8,7 @@ rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
if [ -f ${rootPath}/bin/activate ];then
source ${rootPath}/bin/activate
. ${rootPath}/bin/activate
fi
@@ -16,7 +16,7 @@ GOGS_DOWNLOAD='https://dl.gogs.io'
getOs(){
os=`uname`
if [ "Darwin" == "$os" ];then
if [ "Darwin" = "$os" ];then
echo 'darwin'
else
echo 'linux'
@@ -48,7 +48,7 @@ Install_gogs()
git config --global push.default simple
if [ "darwin" == "$os" ];then
if [ "darwin" = "$os" ];then
file=gogs_${version}_darwin_amd64.zip
else
file=gogs_${version}_linux_amd64.zip
@@ -100,7 +100,7 @@ Uninstall_gogs()
action=$1
version=$2
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_gogs $version
else
Uninstall_gogs $version

View File

@@ -21,16 +21,16 @@ Install_App()
mkdir -p $serverPath/source/gorse
SYSNAME=linux
if [ "$sysName" == "Darwin" ];then
if [ "$sysName" = "Darwin" ];then
SYSNAME=darwin
fi
ARCH="amd64"
if [ "$sysArch" == "x86_64" ];then
if [ "$sysArch" = "x86_64" ];then
ARCH="amd64"
elif [ "$sysArch" == "aarch64" ];then
elif [ "$sysArch" = "aarch64" ];then
ARCH="arm64"
elif [ "$sysArch" == "arm64" ];then
elif [ "$sysArch" = "arm64" ];then
ARCH="arm64"
else
ARCH="amd64"
@@ -88,7 +88,7 @@ Uninstall_App()
}
action=$1
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_App
else
Uninstall_App

View File

@@ -18,17 +18,17 @@ sysName=`uname`
echo "use system: ${sysName}"
OSNAME=`bash ${rootPath}/scripts/getos.sh`
if [ "" == "$OSNAME" ];then
if [ "" = "$OSNAME" ];then
OSNAME=`cat ${rootPath}/data/osname.pl`
fi
if [ "macos" == "$OSNAME" ];then
if [ "macos" = "$OSNAME" ];then
echo "不支持Macox"
exit
fi
if [ -f ${rootPath}/bin/activate ];then
source ${rootPath}/bin/activate
. ${rootPath}/bin/activate
fi
if id grafana &> /dev/null ;then
@@ -78,7 +78,7 @@ Uninstall_App()
}
action=$1
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_App
else
Uninstall_App

View File

@@ -17,11 +17,11 @@ sysArch=`arch`
sysName=`uname`
ARCH_NAME=amd64
if [ "$sysArch" == "arm64" ];then
if [ "$sysArch" = "arm64" ];then
ARCH_NAME=arm64
elif [ "$sysArch" == "x86_64" ]; then
elif [ "$sysArch" = "x86_64" ]; then
ARCH_NAME=amd64
elif [ "$sysArch" == "aarch64" ]; then
elif [ "$sysArch" = "aarch64" ]; then
ARCH_NAME=aarch64
fi
@@ -54,7 +54,7 @@ Uninstall_App()
}
action=${1}
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_App
else
Uninstall_App

View File

@@ -22,7 +22,7 @@ else
useradd -g haproxy haproxy
fi
if [ "${2}" == "" ];then
if [ "${2}" = "" ];then
echo '缺少安装脚本...'
exit 0
fi
@@ -32,7 +32,7 @@ if [ ! -d $curPath/versions/$2 ];then
exit 0
fi
if [ "${action}" == "uninstall" ];then
if [ "${action}" = "uninstall" ];then
if [ -f /usr/lib/systemd/system/haproxy.service ] || [ -f /lib/systemd/system/haproxy.service ];then
systemctl stop haproxy
@@ -45,7 +45,7 @@ fi
sh -x $curPath/versions/$2/install.sh $1
if [ "${action}" == "install" ] && [ -d $serverPath/haproxy ];then
if [ "${action}" = "install" ] && [ -d $serverPath/haproxy ];then
#初始化
cd ${rootPath} && python3 ${rootPath}/plugins/haproxy/index.py start ${type}
cd ${rootPath} && python3 ${rootPath}/plugins/haproxy/index.py initd_install ${type}

View File

@@ -26,12 +26,12 @@ Install_App()
LOCAL_ADDR=common
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
if [ ! -z "$cn" ] || [ "$?" == "0" ] ;then
if [ ! -z "$cn" ] || [ "$?" = "0" ] ;then
LOCAL_ADDR=cn
fi
if [ "${LOCAL_ADDR}" == "cn" ];then
if [ "${LOCAL_ADDR}" = "cn" ];then
if [ ! -f ${APP_DIR}/haproxy-${VERSION}.tar.gz ];then
wget -O ${APP_DIR}/haproxy-${VERSION}.tar.gz https://dl.midoks.icu/soft/haproxy/haproxy-${VERSION}.tar.gz
fi
@@ -39,7 +39,7 @@ Install_App()
if [ ! -f ${APP_DIR}/haproxy-${VERSION}.tar.gz ];then
if [ $sysName == 'Darwin' ]; then
if [ $sysName = 'Darwin' ]; then
wget --no-check-certificate -O ${APP_DIR}/haproxy-${VERSION}.tar.gz https://www.haproxy.org/download/${MIN_VERSION}/src/haproxy-${VERSION}.tar.gz
else
curl -sSLo ${APP_DIR}/haproxy-${VERSION}.tar.gz https://www.haproxy.org/download/${MIN_VERSION}/src/haproxy-${VERSION}.tar.gz
@@ -53,7 +53,7 @@ Install_App()
cd ${APP_DIR} && tar -zxvf haproxy-${VERSION}.tar.gz
if [ "$OSNAME" == "macos" ];then
if [ "$OSNAME" = "macos" ];then
cd ${APP_DIR}/haproxy-${VERSION} && make TARGET=osx && make install PREFIX=$serverPath/haproxy
else
cd ${APP_DIR}/haproxy-${VERSION} && make TARGET=linux-glibc && make install PREFIX=$serverPath/haproxy
@@ -94,7 +94,7 @@ Uninstall_App()
}
action=$1
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_App
else
Uninstall_App

View File

@@ -26,12 +26,12 @@ Install_App()
LOCAL_ADDR=common
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
if [ ! -z "$cn" ] || [ "$?" == "0" ] ;then
if [ ! -z "$cn" ] || [ "$?" = "0" ] ;then
LOCAL_ADDR=cn
fi
if [ "${LOCAL_ADDR}" == "cn" ];then
if [ "${LOCAL_ADDR}" = "cn" ];then
if [ ! -f ${APP_DIR}/haproxy-${VERSION}.tar.gz ];then
wget -O ${APP_DIR}/haproxy-${VERSION}.tar.gz https://dl.midoks.icu/soft/haproxy/haproxy-${VERSION}.tar.gz
fi
@@ -39,7 +39,7 @@ Install_App()
if [ ! -f ${APP_DIR}/haproxy-${VERSION}.tar.gz ];then
if [ $sysName == 'Darwin' ]; then
if [ $sysName = 'Darwin' ]; then
wget --no-check-certificate -O ${APP_DIR}/haproxy-${VERSION}.tar.gz https://www.haproxy.org/download/${MIN_VERSION}/src/haproxy-${VERSION}.tar.gz
else
curl -sSLo ${APP_DIR}/haproxy-${VERSION}.tar.gz https://www.haproxy.org/download/${MIN_VERSION}/src/haproxy-${VERSION}.tar.gz
@@ -53,7 +53,7 @@ Install_App()
cd ${APP_DIR} && tar -zxvf haproxy-${VERSION}.tar.gz
if [ "$OSNAME" == "macos" ];then
if [ "$OSNAME" = "macos" ];then
cd ${APP_DIR}/haproxy-${VERSION} && make TARGET=osx && make install PREFIX=$serverPath/haproxy
else
cd ${APP_DIR}/haproxy-${VERSION} && make TARGET=linux-glibc && make install PREFIX=$serverPath/haproxy
@@ -94,7 +94,7 @@ Uninstall_App()
}
action=$1
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_App
else
Uninstall_App

View File

@@ -26,12 +26,12 @@ Install_App()
LOCAL_ADDR=common
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
if [ ! -z "$cn" ] || [ "$?" == "0" ] ;then
if [ ! -z "$cn" ] || [ "$?" = "0" ] ;then
LOCAL_ADDR=cn
fi
if [ "${LOCAL_ADDR}" == "cn" ];then
if [ "${LOCAL_ADDR}" = "cn" ];then
if [ ! -f ${APP_DIR}/haproxy-${VERSION}.tar.gz ];then
wget -O ${APP_DIR}/haproxy-${VERSION}.tar.gz https://dl.midoks.icu/soft/haproxy/haproxy-${VERSION}.tar.gz
fi
@@ -39,7 +39,7 @@ Install_App()
if [ ! -f ${APP_DIR}/haproxy-${VERSION}.tar.gz ];then
if [ $sysName == 'Darwin' ]; then
if [ $sysName = 'Darwin' ]; then
wget --no-check-certificate -O ${APP_DIR}/haproxy-${VERSION}.tar.gz https://www.haproxy.org/download/${MIN_VERSION}/src/haproxy-${VERSION}.tar.gz
else
curl -sSLo ${APP_DIR}/haproxy-${VERSION}.tar.gz https://www.haproxy.org/download/${MIN_VERSION}/src/haproxy-${VERSION}.tar.gz
@@ -53,7 +53,7 @@ Install_App()
cd ${APP_DIR} && tar -zxvf haproxy-${VERSION}.tar.gz
if [ "$OSNAME" == "macos" ];then
if [ "$OSNAME" = "macos" ];then
cd ${APP_DIR}/haproxy-${VERSION} && make TARGET=osx && make install PREFIX=$serverPath/haproxy
else
cd ${APP_DIR}/haproxy-${VERSION} && make TARGET=linux-glibc && make install PREFIX=$serverPath/haproxy
@@ -94,7 +94,7 @@ Uninstall_App()
}
action=$1
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_App
else
Uninstall_App

View File

@@ -26,12 +26,12 @@ Install_App()
LOCAL_ADDR=common
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
if [ ! -z "$cn" ] || [ "$?" == "0" ] ;then
if [ ! -z "$cn" ] || [ "$?" = "0" ] ;then
LOCAL_ADDR=cn
fi
if [ "${LOCAL_ADDR}" == "cn" ];then
if [ "${LOCAL_ADDR}" = "cn" ];then
if [ ! -f ${APP_DIR}/haproxy-${VERSION}.tar.gz ];then
wget -O ${APP_DIR}/haproxy-${VERSION}.tar.gz https://dl.midoks.icu/soft/haproxy/haproxy-${VERSION}.tar.gz
fi
@@ -39,7 +39,7 @@ Install_App()
if [ ! -f ${APP_DIR}/haproxy-${VERSION}.tar.gz ];then
if [ $sysName == 'Darwin' ]; then
if [ $sysName = 'Darwin' ]; then
wget --no-check-certificate -O ${APP_DIR}/haproxy-${VERSION}.tar.gz https://www.haproxy.org/download/${MIN_VERSION}/src/haproxy-${VERSION}.tar.gz
else
curl -sSLo ${APP_DIR}/haproxy-${VERSION}.tar.gz https://www.haproxy.org/download/${MIN_VERSION}/src/haproxy-${VERSION}.tar.gz
@@ -53,7 +53,7 @@ Install_App()
cd ${APP_DIR} && tar -zxvf haproxy-${VERSION}.tar.gz
if [ "$OSNAME" == "macos" ];then
if [ "$OSNAME" = "macos" ];then
cd ${APP_DIR}/haproxy-${VERSION} && make TARGET=osx && make install PREFIX=$serverPath/haproxy
else
cd ${APP_DIR}/haproxy-${VERSION} && make TARGET=linux-glibc && make install PREFIX=$serverPath/haproxy
@@ -94,7 +94,7 @@ Uninstall_App()
}
action=$1
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_App
else
Uninstall_App

View File

@@ -10,7 +10,7 @@ serverPath=$(dirname "$rootPath")
action=$1
type=$2
if [ "${2}" == "" ];then
if [ "${2}" = "" ];then
echo '缺少安装脚本...'
exit 0
fi

View File

@@ -21,9 +21,9 @@ ARCH="amd64"
get_arch() {
TMP_ARCH=`arch`
if [ "$TMP_ARCH" == "x86_64" ];then
if [ "$TMP_ARCH" = "x86_64" ];then
ARCH="amd64"
elif [ "$TMP_ARCH" == "aarch64" ];then
elif [ "$TMP_ARCH" = "aarch64" ];then
ARCH="arm64"
else
echo $ARCH
@@ -104,7 +104,7 @@ Uninstall_App()
}
action=$1
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_App
else
Uninstall_App

View File

@@ -91,7 +91,7 @@ Uninstall_App()
}
action=$1
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_App
else
Uninstall_App

View File

@@ -11,7 +11,7 @@ rootPath=$(dirname "$curPath")
SOFT=$1
if [ "$SOFT" == "mysql" ];then
if [ "$SOFT" = "mysql" ];then
bash ${rootPath}/keepalived/scripts/chk_mysql.sh > ${rootPath}/keepalived/keepalived.log
else
echo "you should use [chk.sh mysql] exp ."

View File

@@ -11,10 +11,10 @@ serverPath=$(dirname "$rootPath")
# cd /www/server/mdserver-web && python3 plugins/lam/index.py start
if [ -f ${rootPath}/bin/activate ];then
source ${rootPath}/bin/activate
. ${rootPath}/bin/activate
fi
if [ "$sys_os" == "Darwin" ];then
if [ "$sys_os" = "Darwin" ];then
BAK='_bak'
else
BAK=''
@@ -23,7 +23,7 @@ fi
sysName=`uname`
echo "use system: ${sysName}"
if [ "${sysName}" == "Darwin" ]; then
if [ "${sysName}" = "Darwin" ]; then
OSNAME='macos'
elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then
OSNAME='centos'
@@ -83,7 +83,7 @@ Uninstall_App()
}
action=$1
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_App $2
else
Uninstall_App $2

View File

@@ -38,7 +38,7 @@ Uninstall_App()
}
action=$1
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_App
else
Uninstall_App

View File

@@ -37,7 +37,7 @@ Uninstall_App()
}
action=$1
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_App
else
Uninstall_App

View File

@@ -18,17 +18,17 @@ sysName=`uname`
echo "use system: ${sysName}"
OSNAME=`bash ${rootPath}/scripts/getos.sh`
if [ "" == "$OSNAME" ];then
if [ "" = "$OSNAME" ];then
OSNAME=`cat ${rootPath}/data/osname.pl`
fi
if [ "macos" == "$OSNAME" ];then
if [ "macos" = "$OSNAME" ];then
echo "不支持Macox"
exit
fi
if [ -f ${rootPath}/bin/activate ];then
source ${rootPath}/bin/activate
. ${rootPath}/bin/activate
fi
# if id grafana &> /dev/null ;then
@@ -77,7 +77,7 @@ Uninstall_App()
}
action=$1
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_App
else
Uninstall_App

View File

@@ -17,11 +17,11 @@ sysArch=`arch`
sysName=`uname`
ARCH_NAME=amd64
if [ "$sysArch" == "arm64" ];then
if [ "$sysArch" = "arm64" ];then
ARCH_NAME=arm64
elif [ "$sysArch" == "x86_64" ]; then
elif [ "$sysArch" = "x86_64" ]; then
ARCH_NAME=amd64
elif [ "$sysArch" == "aarch64" ]; then
elif [ "$sysArch" = "aarch64" ]; then
ARCH_NAME=aarch64
fi
@@ -77,7 +77,7 @@ curl -v -H "Content-Type: application/json" -XPOST "http://localhost:3100/loki/
-d "{\"streams\": [{\"stream\": {\"test\": \"test\"}, \"values\": [[\"$timestamp\", \"test message\"]]}]}"
action=${1}
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_App
else
Uninstall_App

View File

@@ -18,7 +18,7 @@ Install_LVS(){
mkdir -p $serverPath/source
which ipvsadm
if [ "$?" == "0" ];then
if [ "$?" = "0" ];then
echo '已安装LVS!!'
exit 0
fi
@@ -27,17 +27,17 @@ Install_LVS(){
# 检测平台命令
which apt
if [ "$?" == "0" ];then
if [ "$?" = "0" ];then
apt install -y ipvsadm
fi
which yum
if [ "$?" == "0" ];then
if [ "$?" = "0" ];then
yum install -y ipvsadm
fi
which ipvsadm
if [ "$?" == "0" ];then
if [ "$?" = "0" ];then
echo '正在安装LVS成功!'
mkdir -p $serverPath/lvs
@@ -59,12 +59,12 @@ Uninstall_LVS()
{
# 检测平台命令
which apt
if [ "$?" == "0" ];then
if [ "$?" = "0" ];then
apt remove -y ipvsadm
fi
which yum
if [ "$?" == "0" ];then
if [ "$?" = "0" ];then
yum uninstall -y ipvsadm
fi
echo "卸载LVS完成"
@@ -75,7 +75,7 @@ Uninstall_LVS()
}
action=$1
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_LVS
else
Uninstall_LVS

View File

@@ -9,11 +9,7 @@ searchd {
log = /var/log/manticore/searchd.log
query_log = /var/log/manticore/query.log
pid_file = /var/run/manticore/searchd.pid
data_dir = /var/lib/manticore
workers = threads
binlog_path = /var/lib/manticore
max_children = 1000
max_matches = 1000000
#binlog_path = /var/lib/manticore/binlog
}

View File

@@ -21,6 +21,7 @@
<p onclick="pluginLogs('manticoresearch','','query_log', 30);">查询日志</p>
<p onclick="mcsRunStatus();">运行状态</p>
<p onclick="mcsCommonFunc();">常用功能</p>
<p onclick="pluginLogsContent('manticoresearch',$('.plugin_version').attr('version'),'systemctl_log');">服务运行日志</p>
<p onclick="mcsReadme();">说明</p>
</div>
<div class="bt-w-con pd15">

View File

@@ -141,15 +141,18 @@ def initDreplace():
dirs_list = [
"/var/log/manticore",
"/var/run/manticore",
"/var/lib/manticore"
"/var/lib/manticore",
]
index_dir = getServerDir() + '/index'
dirs_list.append(index_dir)
for d in dirs_list:
if not os.path.exists(d):
mw.execShell('mkdir -p ' + d)
mw.execShell("chown -R manticore:manticore /var/run/manticore")
mw.execShell("chown -R manticore:manticore "+index_dir)
# config replace
conf_bin = getConf()
@@ -206,7 +209,8 @@ def reload():
def rebuild():
cmd = 'indexer --all --rotate'
data = mw.execShell(cmd)
cmd_manticore = asManticore(cmd)
data = mw.execShell(cmd_manticore)
if data[0].find('successfully')<0:
return data[0].replace("\n","<br/>")
return 'ok'
@@ -273,6 +277,11 @@ def queryLog():
tmp = re.search(rep, content)
return tmp.groups()[0]
def systemctlLog():
cmd = "journalctl -u manticore -n 15 --no-pager"
data = mw.execShell(cmd)
return data[0]
def runStatus():
s = status()
@@ -320,8 +329,8 @@ def sphinxConfParse():
file = getConf()
bin_dir = getServerDir()
content = mw.readFile(file)
rep = r'index\s(.*)'
sindex = re.findall(rep, content)
rep = r'^index\s+(\w+)'
sindex = re.findall(rep, content,re.MULTILINE)
indexlen = len(sindex)
cmd = {}
cmd['cmd'] = "indexer -c " + getConf()
@@ -413,6 +422,21 @@ def makeDbToSphinx():
return mw.returnJson(True,'测试中')
# 以 manticore 用户执行,避免生成文件属主为 root
def asManticore(cmd):
if mw.isAppleSystem():
return cmd
return 'su -s /bin/sh manticore -c "' + cmd + '"'
# 重建前修正索引目录归属,保证 manticore 用户有写权限
def fixIndexOwner():
index_dir = getServerDir() + '/index'
if not os.path.exists(index_dir):
return
mw.execShell("chown -R manticore:manticore " + index_dir)
# 全量更新
def updateAll():
data = sphinxConfParse()
@@ -421,10 +445,12 @@ def updateAll():
return '无更新'
index = data['index']
fixIndexOwner()
for x in range(len(index)):
cmd_index = cmd + ' ' + index[x]['index'] + ' --rotate'
subprocess.run(asManticore(cmd_index), shell=True)
print(cmd_index)
os.system(cmd_index)
return ''
#增量更新
@@ -435,15 +461,16 @@ def updateDelta():
return '无更新'
index = data['index']
fixIndexOwner()
for x in range(len(index)):
if 'delta' in index[x]:
cmd_index = cmd + ' ' + index[x]['delta'] + ' --rotate'
subprocess.run(asManticore(cmd_index), shell=True)
print(cmd_index)
os.system(cmd_index)
cmd_index_merge = cmd + ' --merge ' + index[x]['index'] + ' ' + index[x]['delta'] + ' --rotate'
subprocess.run(asManticore(cmd_index_merge), shell=True)
print(cmd_index_merge)
os.system(cmd_index_merge)
else:
print(index[x]['index'],'no delta')
@@ -491,6 +518,8 @@ if __name__ == "__main__":
print(runLog())
elif func == 'query_log':
print(queryLog())
elif func == 'systemctl_log':
print(systemctlLog())
elif func == 'run_status':
print(runStatus())
elif func == 'run_status_test':

View File

@@ -4,7 +4,7 @@
"name": "manticoresearch",
"title": "manticoresearch",
"shell": "install.sh",
"versions":["7.4.6"],
"versions":["latest"],
"tip": "soft",
"install_pre_inspection":true,
"checks": "server/manticoresearch",

View File

@@ -12,22 +12,26 @@ sysArch=`arch`
# cd /www/server/mdserver-web/plugins/manticoresearch && bash install.sh install 7.4.6
# cd /www/server/mdserver-web && python3 plugins/manticoresearch/index.py run_status_test
# cd /www/server/mdserver-web && python3 plugins/manticoresearch/index.py start
# su -s /bin/sh manticore -c "indexer -c /etc/manticoresearch/manticore.conf xx --rotate"
# su -s /bin/sh manticore -c "indexer -c /etc/manticoresearch/manticore.conf xx_delta --rotate"
# systemctl status manticore
# systemctl restart manticore
if [ -f ${rootPath}/bin/activate ];then
source ${rootPath}/bin/activate
. ${rootPath}/bin/activate
fi
ACTION=$1
VERSION=$2
which apt
if [ "$?" == "0" ];then
if [ "$?" = "0" ];then
sh -x $curPath/versions/apt/install.sh $1 $2
fi
which yum
if [ "$?" == "0" ];then
if [ "$?" = "0" ];then
sh -x $curPath/versions/yum/install.sh $1 $2
fi

View File

@@ -98,8 +98,8 @@ logs_file=$plugin_path/${rname}.log
''' % (mw_dir, name, getServerDir(), getPluginDir())
cmd += 'echo "★【`date +"%Y-%m-%d %H:%M:%S"`】 STSRT★" >> $logs_file' + "\n"
cmd += 'echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" >> $logs_file' + "\n"
cmd += 'echo "python3 $script_path/index.py update_all"' + "\n"
cmd += 'cd $mw_dir && python3 $script_path/index.py update_all' + "\n"
cmd += 'cd $mw_dir && . bin/activate && python3 plugins/manticoresearch/index.py update_all' + "\n"
cmd += 'echo "cd $mw_dir && . bin/activate && python3 plugins/manticoresearch/index.py update_all"' + "\n"
cmd += 'echo "【`date +"%Y-%m-%d %H:%M:%S"`】 END★" >> $logs_file' + "\n"
cmd += 'echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" >> $logs_file' + "\n"
@@ -147,8 +147,8 @@ logs_file=$plugin_path/${rname}.log
''' % (mw_dir, name, getServerDir(), getPluginDir())
cmd += 'echo "★【`date +"%Y-%m-%d %H:%M:%S"`】 STSRT★" >> $logs_file' + "\n"
cmd += 'echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" >> $logs_file' + "\n"
cmd += 'echo "python3 $script_path/index.py update_delta"' + "\n"
cmd += 'cd $mw_dir && python3 $script_path/index.py update_delta' + "\n"
cmd += 'cd $mw_dir && . bin/activate && python3 plugins/manticoresearch/index.py update_delta' + "\n"
cmd += 'echo "cd $mw_dir && . bin/activate && python3 plugins/manticoresearch/index.py update_delta"' + "\n"
cmd += 'echo "【`date +"%Y-%m-%d %H:%M:%S"`】 END★" >> $logs_file' + "\n"
cmd += 'echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" >> $logs_file' + "\n"

View File

@@ -5,5 +5,4 @@ searchd {
log = /var/log/manticore/searchd.log
query_log = /var/log/manticore/query.log
pid_file = /var/run/manticore/searchd.pid
data_dir = /var/lib/manticore
}

View File

@@ -10,7 +10,7 @@ sysName=`uname`
sysArch=`arch`
if [ -f ${rootPath}/bin/activate ];then
source ${rootPath}/bin/activate
. ${rootPath}/bin/activate
fi
VERSION=$2
@@ -23,21 +23,23 @@ Install_App()
MC_DIR=${serverPath}/source/manticoresearch
mkdir -p $MC_DIR
# wget --no-check-certificate -O /www/server/source/manticoresearch/manticore-repo.noarch.deb https://repo.manticoresearch.com/manticore-repo.noarch.deb
# cd /www/server/source/manticoresearch/ && dpkg -i manticore-repo.noarch.deb
wget --no-check-certificate -O $MC_DIR/manticore-repo.noarch.deb https://repo.manticoresearch.com/manticore-repo.noarch.deb
dpkg -i $MC_DIR/manticore-repo.noarch.deb
apt update -y
apt -y install manticore manticore-extra
apt -y install manticore
apt -y install manticore-extra
apt -y upgrade manticore
echo "${VERSION}" > $serverPath/manticoresearch/version.pl
cd ${rootPath} && python3 plugins/manticoresearch/index.py start ${VERSION}
cd ${rootPath} && python3 plugins/manticoresearch/index.py initd_install ${VERSION}
if [ -d ${MC_DIR} ];then
rm -rf ${MC_DIR}
fi
# if [ -d ${MC_DIR} ];then
# rm -rf ${MC_DIR}
# fi
}
Uninstall_App()
@@ -45,7 +47,8 @@ Uninstall_App()
cd ${rootPath} && python3 plugins/manticoresearch/index.py stop ${VERSION}
cd ${rootPath} && python3 plugins/manticoresearch/index.py initd_uninstall ${VERSION}
apt -y remove manticore manticore-extra
apt -y remove manticore
apt -y remove manticore-extra
apt -y autoremove
if [ -d $serverPath/manticoresearch ];then
@@ -64,7 +67,7 @@ Uninstall_App()
}
action=$1
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_App
else
Uninstall_App

View File

@@ -11,7 +11,7 @@ sysArch=`arch`
if [ -f ${rootPath}/bin/activate ];then
source ${rootPath}/bin/activate
. ${rootPath}/bin/activate
fi
VERSION=$2
@@ -25,7 +25,8 @@ Install_App()
mkdir -p $MC_DIR
yum install -y https://repo.manticoresearch.com/manticore-repo.noarch.rpm
yum install -y manticore manticore-extra
yum install -y manticore
yum install -y manticore-extra
echo "${VERSION}" > $serverPath/manticoresearch/version.pl
@@ -39,7 +40,8 @@ Install_App()
Uninstall_App()
{
yum -y remove manticore manticore-extra
yum -y remove manticore
yum -y remove manticore-extra
if [ -d $serverPath/manticoresearch ];then
rm -rf $serverPath/manticoresearch
@@ -60,7 +62,7 @@ Uninstall_App()
}
action=$1
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_App
else
Uninstall_App

View File

@@ -18,6 +18,7 @@ log-error = {$SERVER_APP_PATH}/data/error.log
server-id = {$SERVER_ID}
default_storage_engine = InnoDB
performance_schema = 1
key_buffer_size = 8M
max_allowed_packet = 100M
@@ -71,7 +72,11 @@ replicate-ignore-db = information_schema
replicate-ignore-db = performance_schema
replicate-ignore-db = mysql
replicate-ignore-db = test
replicate-wild-ignore-table=mysql.%
replicate-wild-ignore-table = mysql.%
replicate-wild-ignore-table = information_schema.%
replicate-wild-ignore-table = performance_schema.%
replicate-wild-ignore-table = sys.%
innodb_data_home_dir = {$SERVER_APP_PATH}/data

View File

@@ -626,7 +626,10 @@ def runInfo(version):
return mw.returnJson(False, 'MySQL未启动', [])
db = pMysqlDb()
data = db.query('show global status')
try:
data = db.query('show global status')
except Exception as e:
data = e
isError = isSqlError(data)
if isError != None:
return isError
@@ -659,7 +662,10 @@ def runInfo(version):
def myDbStatus():
result = {}
db = pMysqlDb()
data = db.query('show variables')
try:
data = db.query('show variables')
except Exception as e:
data = e
isError = isSqlError(data)
if isError != None:
return isError
@@ -726,21 +732,33 @@ def isSqlError(mysqlMsg):
def __createUser(dbname, username, password, address):
pdb = pMysqlDb('mysql')
pdb = pMysqlDb()
if username == 'root':
dbname = '*'
try:
pdb.execute("CREATE USER `%s`@`localhost` IDENTIFIED BY '%s'" % (username, password))
except Exception as e:
pass
pdb.execute(
"CREATE USER `%s`@`localhost` IDENTIFIED BY '%s'" % (username, password))
pdb.execute(
"grant all privileges on %s.* to `%s`@`localhost`" % (dbname, username))
try:
pdb.execute("grant all privileges on %s.* to `%s`@`localhost`" % (dbname, username))
except Exception as e:
pass
for a in address.split(','):
pdb.execute(
"CREATE USER `%s`@`%s` IDENTIFIED BY '%s'" % (username, a, password))
pdb.execute(
"grant all privileges on %s.* to `%s`@`%s`" % (dbname, username, a))
pdb.execute("flush privileges")
try:
pdb.execute("CREATE USER `%s`@`%s` IDENTIFIED BY '%s'" % (username, a, password))
except Exception as e:
pass
try:
pdb.execute("grant all privileges on %s.* to `%s`@`%s`" % (dbname, username, a))
except Exception as e:
pass
try:
pdb.execute("flush privileges")
except Exception as e:
pass
def getDbBackupListFunc(dbname=''):
@@ -763,8 +781,8 @@ def setDbBackup():
if not data[0]:
return data[1]
scDir = getPluginDir() + '/scripts/backup.py'
cmd = 'python3 ' + scDir + ' database ' + args['name'] + ' 3'
head = "cd "+mw.getPanelDir()
cmd = head +' && . bin/activate && python3 plugins/mariadb/scripts/backup.py database ' + args['name'] + ' 3'
os.system(cmd)
return mw.returnJson(True, 'ok')
@@ -794,6 +812,49 @@ def importDbBackup():
os.system(mysql_cmd)
return mw.returnJson(True, 'ok')
def importDbBackupProgress():
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 && . bin/activate && '
cmd += 'python3 '+mw.getServerDir()+'/mdserver-web/plugins/mariadb/index.py import_db_backup_progress_bar {"file":"'+file+'","name":"'+name+'"}'
return mw.returnJson(True, 'ok',cmd)
def importDbBackupProgressBar():
args = getArgs()
data = checkArgs(args, ['file', 'name'])
if not data[0]:
return data[1]
file = args['file']
name = args['name']
file_path = mw.getFatherDir() + '/backup/database/mariadb/' + file
file_path_sql = mw.getFatherDir() + '/backup/database/mariadb/' + file.replace('.gz', '')
if not os.path.exists(file_path_sql):
cmd = 'cd ' + mw.getFatherDir() + '/backup/database/mariadb && gzip -dk ' + file
mw.execShell(cmd)
local_mode = recognizeDbMode()
if local_mode == 'gtid':
pdb = pMysqlDb()
pdb.execute('reset master')
pwd = pSqliteDb('config').where('id=?', (1,)).getField('mysql_root')
sock = getSocketFile()
mysql_cmd = getServerDir() + '/bin/mariadb -S ' + sock + ' -uroot -p"' + pwd + \
'" ' + name
mysql_cmd_progress_bar = "pv -t -p " + file_path_sql + '|'+ mysql_cmd
print(mysql_cmd_progress_bar)
rdata = os.system(mysql_cmd_progress_bar)
return ''
def rootPwd():
return pSqliteDb('config').where(
@@ -878,8 +939,8 @@ def importDbExternalProgress():
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+'"}'
cmd = 'cd '+mw.getServerDir()+'/mdserver-web && . 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():
@@ -958,7 +1019,7 @@ def deleteDbBackup():
if path != "":
full_file = path + "/" + args['filename']
os.remove(full_file)
return mw.returnJson(True, 'ok')
return mw.returnJson(True, '删除成功!')
def getDbBackupList():
@@ -1073,16 +1134,44 @@ def getDbList():
return mw.getJson(data)
def getTableList():
args = getArgs()
db_name = ""
if 'dbname' in args:
db_name = args['dbname']
if db_name == "":
return mw.returnJson(-1,"table表不能为空")
pdb = pMysqlDb()
sql = 'show tables from `%s`' % db_name
try:
data = pdb.query(sql)
except Exception as e:
return mw.returnJson(-1, str(e))
table_list = []
key = "Tables_in_%s" % db_name
for i in data:
table_list.append(i[key])
return mw.returnJson(0,"ok", table_list)
def syncGetDatabases():
pdb = pMysqlDb('mysql')
psdb = pSqliteDb('databases')
data = pdb.query('show databases')
try:
data = pdb.query('show databases')
except Exception as e:
return mw.returnJson(-1, str(e))
isError = isSqlError(data)
if isError != None:
return isError
users = pdb.query(
"select User,Host from user where User!='root' AND Host!='localhost' AND Host!=''")
try:
users = pdb.query(
"select User,Host from user where User!='root' AND Host!='localhost' AND Host!=''")
except Exception:
users = []
nameArr = ['information_schema', 'performance_schema', 'mysql', 'sys']
n = 0
@@ -1121,18 +1210,24 @@ def toDbBase(find):
if len(find['password']) < 3:
find['username'] = find['name']
find['password'] = mw.md5(str(time.time()) + find['name'])[0:10]
psdb.where("id=?", (find['id'],)).save(
'password,username', (find['password'], find['username']))
psdb.where("id=?", (find['id'],)).save('password,username', (find['password'], find['username']))
result = pdb.execute("create database `" + find['name'] + "`")
if "using password:" in str(result):
return -1
if "Connection refused" in str(result):
return -1
result = pdb.query("show databases")
db_name = []
for db_info in result:
db_name.append(db_info['Database'])
password = find['password']
__createUser(find['name'], find['username'], password, find['accept'])
return 1
if not mw.inArray(db_name, find['name']):
try:
result = pdb.execute("create database `" + find['name'] + "`")
except Exception as e:
pass
access_list = getDbUserAccess(find['name'])
if len(access_list) < 1:
__createUser(find['name'], find['username'], find['password'], find['accept'])
return 1
return 0
def syncToDatabases():
@@ -1142,7 +1237,10 @@ def syncToDatabases():
return data[1]
pdb = pMysqlDb()
result = pdb.execute("show databases")
try:
result = pdb.execute("show databases")
except Exception as e:
result = e
isError = isSqlError(result)
if isError:
return isError
@@ -1170,27 +1268,78 @@ def syncToDatabases():
return mw.returnJson(True, msg)
def setRootPwdForce(new_password, version=''):
'''
当前root密码不可用(忘记密码/连接被拒)时, 通过跳过权限校验的方式真正重置密码
'''
changed = False
try:
appCMD(version, 'stop')
openSkipGrantTables()
appCMD(version, 'start')
time.sleep(3)
resetDbRootPwd(version, new_password)
changed = True
except Exception:
changed = False
finally:
# 无论成败都恢复密码校验, 避免数据库长期处于无校验状态
appCMD(version, 'stop')
closeSkipGrantTables()
appCMD(version, 'start')
time.sleep(2)
if not changed:
return False
# 用新密码验证是否真的可以连接(启动可能较慢, 重试几次)
for i in range(10):
try:
pdb = pMysqlDb()
result = pdb.query('show databases')
if isSqlError(result) == None:
return True
except Exception:
pass
time.sleep(2)
return False
def setRootPwd(version=''):
args = getArgs()
data = checkArgs(args, ['password'])
if not data[0]:
return data[1]
password = args['password']
#强制修改
force = 0
if 'force' in args and args['force'] == '1':
force = 1
pSqliteDb('config').where('id=?', (1,)).save('mysql_root', (password,))
return mw.returnJson(True, '【强制本地记录】数据库root密码修改成功(立马检查)!')
if 'force' in args and args['force'] == '2':
force = 2
ok = setRootPwdForce(password,version)
if not ok:
return mw.returnJson(False, '【强制】修改失败,请检查MySQL运行状态!')
pSqliteDb('config').where('id=?', (1,)).save('mysql_root', (password,))
if ok and version.startswith("8"):
pdb = pMysqlDb()
try:
pdb.query("SET GLOBAL validate_password.policy=MEDIUM;")
except Exception:
pass
return mw.returnJson(True, '【强制】数据库root密码修改成功!')
password = args['password']
try:
pdb = pMysqlDb('mysql')
result = pdb.query("show databases")
isError = isSqlError(result)
if isError != None:
if force == 1:
pSqliteDb('config').where('id=?', (1,)).save('mysql_root', (password,))
return mw.returnJson(True, '【强制修改】数据库root密码修改成功(不意为成功连接数据)!')
return isError
cmd = "ALTER USER 'root'@'localhost' IDENTIFIED BY '" + password + "';"
@@ -1201,11 +1350,7 @@ def setRootPwd(version=''):
orm = pMysqlDb()
orm.execute("flush privileges")
msg = ''
if force == 1:
msg = ',无须强制!'
return mw.returnJson(True, '数据库root密码修改成功!' + msg)
return mw.returnJson(True, '数据库root密码修改成功!')
except Exception as ex:
return mw.returnJson(False, '修改错误:' + str(ex))
@@ -1224,18 +1369,33 @@ def setUserPwd(version=''):
psdb = pSqliteDb('databases')
data = psdb.field('id,name,accept').where('id=?', (uid,)).find()
cmd = "SET PASSWORD FOR '" + username + \
"'@'localhost' = PASSWORD('" + newpassword + "')"
r = pdb.execute(cmd)
# print(cmd, r)
accept = data['accept']
alist = accept.split(',')
for x in alist:
cmd = "SET PASSWORD FOR '" + username + \
"'@'" + x + "' = PASSWORD('" + newpassword + "')"
r = pdb.execute(cmd)
# print(cmd, r)
hosts = ['localhost']
if accept:
for x in accept.split(','):
x = x.strip()
if len(x) > 0 and x != 'localhost':
hosts.append(x)
# 兼容所有 MariaDB 版本:
# 优先 ALTER USER(10.2+),用户不存在则 CREATE USER(10.0.2+),
# 旧版本不支持以上语法时回退 GRANT ... IDENTIFIED BY
for x in hosts:
sqls = [
"ALTER USER '%s'@'%s' IDENTIFIED BY '%s'" % (username, x, newpassword),
"CREATE USER '%s'@'%s' IDENTIFIED BY '%s'" % (username, x, newpassword),
"GRANT USAGE ON *.* TO '%s'@'%s' IDENTIFIED BY '%s'" % (username, x, newpassword),
]
err = None
for sql in sqls:
try:
pdb.execute(sql)
err = None
break
except Exception as e:
err = e
if err != None:
raise err
psdb.where("id=?", (uid,)).setField('password', newpassword)
@@ -1308,16 +1468,21 @@ def addDb():
if psdb.where("name=? or username=?", (dbname, dbuser)).count():
return mw.returnJson(False, '数据库已存在!')
result = pdb.execute("create database `" + dbname +
"` DEFAULT CHARACTER SET " + codeing + " COLLATE " + codeStr)
try:
result = pdb.execute("create database `" + dbname +"` DEFAULT CHARACTER SET " + codeing + " COLLATE " + codeStr)
except Exception as e:
result = e
# print result
isError = isSqlError(result)
if isError != None:
return isError
pdb.execute("drop user '" + dbuser + "'@'localhost'")
for a in address.split(','):
pdb.execute("drop user '" + dbuser + "'@'" + a + "'")
db_users_access = getDbUserAccess(dbuser)
for user_access in db_users_access:
try:
pdb.execute("drop user `%s`@'%s'" % (db_user, user_access))
except Exception:
pass
__createUser(dbname, dbuser, password, address)
@@ -1342,14 +1507,18 @@ def delDb():
accept = find['accept']
username = find['username']
# 删除MYSQL
result = pdb.execute("drop database `" + name + "`")
# 删除MYSQL(库或用户可能已不存在,失败忽略,保证面板记录可删除)
try:
pdb.execute("drop database `" + name + "`")
except Exception:
pass
users = pdb.query("select Host from user where User='" +
username + "' AND Host!='localhost'")
pdb.execute("drop user '" + username + "'@'localhost'")
for us in users:
pdb.execute("drop user '" + username + "'@'" + us["Host"] + "'")
db_users_access = getDbUserAccess(username)
for user_access in db_users_access:
try:
pdb.execute("drop user '" + username + "'@'%s'" % (user_access,))
except Exception:
pass
pdb.execute("flush privileges")
# 删除SQLITE
@@ -1359,57 +1528,120 @@ def delDb():
return mw.returnJson(False, '删除失败!' + str(ex))
def getDbUserAccess(username):
pdb = pMysqlDb()
accs = []
try:
users = pdb.query("select Host from mysql.user where User='" + username + "'")
except Exception as e:
return accs
for c in users:
accs.append(c["Host"])
return accs
def getDbUserAccessDiff(db_access, input_access):
add = []
delete = []
host_var = 'localhost'
local_ipvar = '127.0.0.1'
local_ip6var = '::1'
for ac in input_access:
if ac == host_var:
continue
if ac == local_ipvar:
continue
if ac == local_ip6var:
continue
if mw.inArray(db_access,ac):
continue
add.append(ac)
if not mw.inArray(db_access, local_ipvar) and not mw.inArray(add, local_ipvar):
add.append(local_ipvar)
if not mw.inArray(db_access, local_ip6var) and not mw.inArray(add, local_ip6var):
add.append(local_ip6var)
for ac in db_access:
if ac == host_var:
continue
if ac == local_ipvar:
continue
if ac == local_ip6var:
continue
if mw.inArray(input_access,ac):
continue
delete.append(ac)
if mw.inArray(delete, local_ipvar):
delete.remove(local_ipvar)
if mw.inArray(delete, local_ip6var):
delete.remove(local_ip6var)
return {"add":add,"delete":delete}
def getDbAccess():
args = getArgs()
data = checkArgs(args, ['username'])
if not data[0]:
return data[1]
username = args['username']
pdb = pMysqlDb('mysql')
users = pdb.query("select Host from user where User='" +
username + "' AND Host!='localhost'")
users = getDbUserAccess(username)
if len(users) == 1:
return mw.returnJson(True, "localhost")
userStr = ','.join(users)
if userStr == '127.0.0.1,localhost':
return mw.returnJson(True, 'localhost')
if userStr == '127.0.0.1,::1,localhost':
return mw.returnJson(True, 'localhost')
isError = isSqlError(users)
if isError != None:
return isError
if len(users) < 1:
return mw.returnJson(True, "127.0.0.1")
accs = []
for c in users:
accs.append(c["Host"])
userStr = ','.join(accs)
return mw.returnJson(True, userStr)
def setDbAccessByArgs(username,access):
pdb = pMysqlDb()
psdb = pSqliteDb('databases')
dbname = psdb.where('username=?', (username,)).getField('name')
password = psdb.where("username=?", (username,)).getField('password')
if username == 'root':
dbname = '*'
password = pSqliteDb('config').where('id=?', (1,)).getField('mysql_root')
db_users_access = getDbUserAccess(username)
diff_access = getDbUserAccessDiff(db_users_access,access.split(','))
# print(diff_access)
add_access_list = diff_access["add"]
pdb.execute("flush privileges")
for add_access in add_access_list:
pdb.execute("CREATE USER `%s`@`%s` IDENTIFIED BY '%s'" % (username, add_access, password))
pdb.execute("grant all privileges on %s.* to `%s`@`%s`" % (dbname, username, add_access))
pdb.execute("flush privileges")
delete_access_list = diff_access["delete"]
for del_access in delete_access_list:
try:
pdb.execute("drop user '" + username + "'@'" + del_access + "'")
except Exception:
pass
psdb.where('username=?', (username,)).save('accept,rw', (access, 'rw',))
return True
def setDbAccess():
args = getArgs()
data = checkArgs(args, ['username', 'access'])
if not data[0]:
return data[1]
name = args['username']
username = args['username']
access = args['access']
pdb = pMysqlDb('mysql')
psdb = pSqliteDb('databases')
dbname = psdb.where('username=?', (name,)).getField('name')
if name == 'root':
password = pSqliteDb('config').where(
'id=?', (1,)).getField('mysql_root')
else:
password = psdb.where("username=?", (name,)).getField('password')
users = pdb.query("select Host from user where User='" +
name + "' AND Host!='localhost'")
for us in users:
pdb.execute("drop user '" + name + "'@'" + us["Host"] + "'")
__createUser(dbname, name, password, access)
psdb.where('username=?', (name,)).save('accept,rw', (access, 'rw',))
setDbAccessByArgs(username, access)
return mw.returnJson(True, '设置成功!')
def openSkipGrantTables():
@@ -1427,10 +1659,11 @@ def closeSkipGrantTables():
return True
def resetDbRootPwd(version):
def resetDbRootPwd(version, newpwd=''):
serverdir = getServerDir()
myconf = serverdir + "/etc/my.cnf"
pwd = mw.getRandomString(16)
# newpwd 为空时生成随机密码, 强制修改时传入用户指定的密码
pwd = newpwd if newpwd != '' else mw.getRandomString(16)
pSqliteDb('config').where('id=?', (1,)).save('mysql_root', (pwd,))
db_option = "-S " + serverdir + "/mysql.sock"
@@ -1445,30 +1678,34 @@ def resetDbRootPwd(version):
def fixDbAccess(version):
pdb = pMysqlDb()
mdb_ddir = getDataDir()
if not os.path.exists(mdb_ddir):
return mw.returnJson(False, '数据目录不存在,尝试重启重建!')
# 1) 数据目录不存在或未初始化(缺少 mysql 系统库): 删除后重建, 启动时会自动 mariadb-install-db 初始化
if not os.path.exists(mdb_ddir + '/mysql'):
try:
appCMD(version, 'stop')
if os.path.exists(mdb_ddir):
mw.execShell('rm -rf ' + mdb_ddir)
appCMD(version, 'start')
return mw.returnJson(True, '数据目录不存在,已重建并初始化!')
except Exception as e:
return mw.returnJson(False, '重建失败:' + str(e))
try:
psdb = pSqliteDb('databases')
pdb = pMysqlDb()
data = pdb.query('show databases')
isError = isSqlError(data)
if isError != None:
# 重置密码
appCMD(version, 'stop')
openSkipGrantTables()
appCMD(version, 'start')
time.sleep(3)
resetDbRootPwd(version)
if isError == None:
return mw.returnJson(True, '正常无需修复!')
appCMD(version, 'stop')
closeSkipGrantTables()
appCMD(version, 'start')
return mw.returnJson(True, '修复成功!')
return mw.returnJson(True, '正常无需修复!')
# 2) 密码错误 -> 跳过权限校验重置密码, 并用新密码验证连接
if not setRootPwdForce(mw.getRandomString(16), version):
return mw.returnJson(False, '密码重置失败,请检查数据库运行状态!')
return mw.returnJson(True, '修复成功,root密码已重置!')
except Exception as e:
return mw.returnJson(False, '修复失败请重试!')
# 连接阶段抛异常一般是密码不可用, 仍尝试重置
if setRootPwdForce(mw.getRandomString(16), version):
return mw.returnJson(True, '修复成功,root密码已重置!')
return mw.returnJson(False, '修复失败:' + str(e))
def setDbRw(version=''):
@@ -1484,8 +1721,11 @@ def setDbRw(version=''):
pdb = pMysqlDb('mysql')
psdb = pSqliteDb('databases')
dbname = psdb.where("id=?", (uid,)).getField('name')
users = pdb.query(
"select Host from user where User='" + username + "'")
try:
users = pdb.query(
"select Host from user where User='" + username + "'")
except Exception as e:
return mw.returnJson(-1, str(e))
# show grants for demo@"127.0.0.1";
for x in users:
@@ -1493,7 +1733,10 @@ def setDbRw(version=''):
sql = "REVOKE ALL PRIVILEGES ON `" + dbname + \
"`.* FROM '" + username + "'@'" + x["Host"] + "';"
r = pdb.query(sql)
try:
pdb.query(sql)
except Exception:
pass
# print(sql, r)
if rw == 'rw':
@@ -1505,7 +1748,10 @@ def setDbRw(version=''):
else:
sql = "GRANT all privileges ON " + dbname + ".* TO " + \
username + "@'" + x["Host"] + "'"
pdb.execute(sql)
try:
pdb.execute(sql)
except Exception as e:
return mw.returnJson(False, '切换失败!' + str(e))
pdb.execute("flush privileges")
r = psdb.where("id=?", (uid,)).setField('rw', rw)
# print(r)
@@ -1521,11 +1767,17 @@ def getDbInfo():
db_name = args['name']
pdb = pMysqlDb()
# print 'show tables from `%s`' % db_name
tables = pdb.query('show tables from `%s`' % db_name)
try:
tables = pdb.query('show tables from `%s`' % db_name)
except Exception as e:
return mw.returnJson(-1, str(e))
ret = {}
sql = "select sum(DATA_LENGTH)+sum(INDEX_LENGTH) as sum_size from information_schema.tables where table_schema='%s'" % db_name
data_sum = pdb.query(sql)
try:
data_sum = pdb.query(sql)
except Exception as e:
return mw.returnJson(-1, str(e))
data = 0
if data_sum[0]['sum_size'] != None:
@@ -1539,7 +1791,12 @@ def getDbInfo():
for i in tables:
tb_sql = "show table status from `%s` where name = '%s'" % (db_name, i[
table_key])
table = pdb.query(tb_sql)
try:
table = pdb.query(tb_sql)
except Exception:
continue
if len(table) < 1:
continue
tmp = {}
tmp['type'] = table[0]["Engine"]
@@ -1572,7 +1829,10 @@ def repairTable():
db_name = args['db_name']
tables = json.loads(args['tables'])
pdb = pMysqlDb()
mtable = pdb.query('show tables from `%s`' % db_name)
try:
mtable = pdb.query('show tables from `%s`' % db_name)
except Exception as e:
return mw.returnJson(-1, str(e))
ret = []
key = "Tables_in_" + db_name
@@ -1597,7 +1857,10 @@ def optTable():
db_name = args['db_name']
tables = json.loads(args['tables'])
pdb = pMysqlDb()
mtable = pdb.query('show tables from `%s`' % db_name)
try:
mtable = pdb.query('show tables from `%s`' % db_name)
except Exception as e:
return mw.returnJson(-1, str(e))
ret = []
key = "Tables_in_" + db_name
for i in mtable:
@@ -1622,7 +1885,10 @@ def alterTable():
tables = json.loads(args['tables'])
table_type = args['table_type']
pdb = pMysqlDb()
mtable = pdb.query('show tables from `%s`' % db_name)
try:
mtable = pdb.query('show tables from `%s`' % db_name)
except Exception as e:
return mw.returnJson(-1, str(e))
ret = []
key = "Tables_in_" + db_name
@@ -1697,26 +1963,9 @@ def setDbrunMode(version=''):
con = re.sub(rep, rep_after, con)
mw.writeFile(path, con)
if version == '5.6':
dbreload = 'yes'
else:
db = pMysqlDb()
# The value of @@GLOBAL.GTID_MODE can only be changed one step at a
# time: OFF <-> OFF_PERMISSIVE <-> ON_PERMISSIVE <-> ON. Also note that
# this value must be stepped up or down simultaneously on all servers.
# See the Manual for instructions.
if mode == 'classic':
db.query('set global enforce_gtid_consistency=off')
db.query('set global gtid_mode=on')
db.query('set global gtid_mode=on_permissive')
db.query('set global gtid_mode=off_permissive')
db.query('set global gtid_mode=off')
elif mode == 'gtid':
db.query('set global enforce_gtid_consistency=on')
db.query('set global gtid_mode=off')
db.query('set global gtid_mode=off_permissive')
db.query('set global gtid_mode=on_permissive')
db.query('set global gtid_mode=on')
# MariaDB 无 gtid_mode/enforce_gtid_consistency 等全局变量,
# binlog 模式由 etc/mode 配置文件生效,统一重启
dbreload = 'yes'
if dbreload == "yes":
restart(version)
@@ -1750,17 +1999,18 @@ def setDbMasterAccess():
pdb = pMysqlDb()
psdb = pSqliteDb('master_replication_user')
password = psdb.where("username=?", (username,)).getField('password')
users = pdb.query("select Host from user where User='" +
username + "' AND Host!='localhost'")
for us in users:
pdb.execute("drop user '" + username + "'@'" + us["Host"] + "'")
db_users_access = getDbUserAccess(username)
for user_access in db_users_access:
try:
pdb.execute("drop user '" + username + "'@'%s'" % (user_access,))
except Exception:
pass
dbname = '*'
for a in access.split(','):
pdb.execute(
"CREATE USER `%s`@`%s` IDENTIFIED BY '%s'" % (username, a, password))
pdb.execute(
"grant all privileges on %s.* to `%s`@`%s`" % (dbname, username, a))
pdb.execute("CREATE USER `%s`@`%s` IDENTIFIED BY '%s'" % (username, a, password))
pdb.execute("grant all privileges on %s.* to `%s`@`%s`" % (dbname, username, a))
pdb.execute("flush privileges")
psdb.where('username=?', (username,)).save('accept', (access,))
@@ -2140,10 +2390,10 @@ def getMasterRepSlaveUserCmd(version):
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 = '<span class="set-info c7 ta_center">经典模式</span><hr style="margin-top: 5px;margin-bottom: 10px;"/>'
sql += base_sql + "', MASTER_LOG_FILE='" + mstatus[0]["File"] + \
"',MASTER_LOG_POS=" + str(mstatus[0]["Position"])
sql += "<br/><hr/>";
sql += '<br/><hr/><span class="set-info c7 ta_center">GTID模式</span><hr style="margin-top: 5px;margin-bottom: 10px;"/>'
sql += base_sql + "',MASTER_USE_GTID=slave_pos,MASTER_CONNECT_RETRY=10;";
sql += "<br/>";
@@ -2165,13 +2415,25 @@ def delMasterRepSlaveUser(version=''):
pdb = pMysqlDb()
psdb = pSqliteDb('master_replication_user')
pdb.execute("drop user '" + name + "'@'%'")
pdb.execute("drop user '" + name + "'@'localhost'")
try:
pdb.execute("drop user '" + name + "'@'%'")
except Exception:
pass
try:
pdb.execute("drop user '" + name + "'@'localhost'")
except Exception:
pass
users = pdb.query("select Host from user where User='" +
name + "' AND Host!='localhost'")
try:
users = pdb.query("select Host from user where User='" +
name + "' AND Host!='localhost'")
except Exception:
users = []
for us in users:
pdb.execute("drop user '" + name + "'@'" + us["Host"] + "'")
try:
pdb.execute("drop user '" + name + "'@'" + us["Host"] + "'")
except Exception:
pass
psdb.where("username=?", (args['username'],)).delete()
@@ -2186,7 +2448,10 @@ def updateMasterRepSlaveUser(version=''):
pdb = pMysqlDb()
psdb = pSqliteDb('master_replication_user')
pdb.execute("drop user '" + args['username'] + "'@'%'")
try:
pdb.execute("drop user '" + args['username'] + "'@'%'")
except Exception:
pass
pdb.execute("GRANT REPLICATION SLAVE ON *.* TO '" +
args['username'] + "'@'%' identified by '" + args['password'] + "'")
@@ -2417,13 +2682,17 @@ def updateSlaveSSH(version=''):
def getSlaveList(version=''):
db = pMysqlDb()
dlist = db.query('show slave status')
if len(dlist) == 0:
dlist = db.query('show all slaves status')
try:
dlist = db.query('show slave status')
if len(dlist) == 0:
dlist = db.query('show all slaves status')
except Exception as e:
return mw.returnJson(-1, str(e))
data = {}
data['data'] = dlist
return mw.getJson(data)
# 状态字段中包含 datetime 等对象,需转成字符串后才能序列化
return json.dumps(data, default=str)
def trySlaveSyncBugfix(version=''):
if status(version) == 'stop':
@@ -2572,9 +2841,12 @@ def initSlaveStatusSyncUser(version=''):
def initSlaveStatusSSH(version=''):
db = pMysqlDb()
dlist = db.query('show slave status')
if len(dlist) == 0:
dlist = db.query('show all slaves status')
try:
dlist = db.query('show slave status')
if len(dlist) == 0:
dlist = db.query('show all slaves status')
except Exception as e:
return mw.returnJson(-1, str(e))
conn = pSqliteDb('slave_id_rsa')
ssh_list = conn.field('ip,port,id_rsa,db_user').select()
@@ -2601,7 +2873,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_ssh {"username":"' + db_user + '","db":""}'
cmd = 'cd /www/server/mdserver-web && . 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')
@@ -2753,7 +3025,7 @@ def syncDatabaseRepairLog(version=''):
sync_args_sign = args['sign']
op = args['op']
tmp_log = syncDatabaseRepairTempFile()
cmd = 'cd '+mw.getServerDir()+'/mdserver-web && source bin/activate && python3 plugins/mariadb/index.py sync_database_repair {"db":"'+sync_args_db+'","sign":"'+sync_args_sign+'"}'
cmd = 'cd '+mw.getServerDir()+'/mdserver-web && . bin/activate && python3 plugins/mariadb/index.py sync_database_repair {"db":"'+sync_args_db+'","sign":"'+sync_args_sign+'"}'
# print(cmd)
if op == 'get':
@@ -3062,7 +3334,7 @@ def fullSyncCmd():
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+'"}'
cmd = 'cd '+mw.getServerDir()+'/mdserver-web && . 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"}
@@ -3247,7 +3519,7 @@ def doFullSyncSSH(version=''):
writeDbSyncStatus({'code': 0, 'msg': '登录Master成功...', 'progress': 5})
dbname = args['db']
cmd = "cd /www/server/mdserver-web && source bin/activate && python3 plugins/mariadb/index.py dump_mysql_data {\"db\":'" + dbname + "'}"
cmd = "cd /www/server/mdserver-web && . bin/activate && python3 plugins/mariadb/index.py dump_mysql_data {\"db\":'" + dbname + "'}"
print(cmd)
stdin, stdout, stderr = ssh.exec_command(cmd)
result = stdout.read()
@@ -3270,7 +3542,7 @@ def doFullSyncSSH(version=''):
if copy_status == None:
writeDbSyncStatus({'code': 2, 'msg': '数据同步本地完成...', 'progress': 40})
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 && . bin/activate && python3 plugins/mariadb/index.py get_master_rep_slave_user_cmd {"username":"' + db_user + '","db":""}'
stdin, stdout, stderr = ssh.exec_command(cmd)
result = stdout.read()
result = result.decode('utf-8')
@@ -3332,8 +3604,10 @@ def installPreInspection(version):
def uninstallPreInspection(version):
stop(version)
if mw.isDebugMode():
return 'ok'
# if mw.isDebugMode():
# return 'ok'
from utils.plugin import plugin as MwPlugin
MwPlugin.instance().removeIndex(getPluginName(), version)
return "请手动删除MariaDB[{}]<br/> rm -rf {}".format(version, getServerDir())
@@ -3397,6 +3671,8 @@ if __name__ == "__main__":
print(rootPwd())
elif func == 'get_db_list':
print(getDbList())
elif func == 'get_table_list':
print(getTableList())
elif func == 'set_db_backup':
print(setDbBackup())
elif func == 'import_db_backup':

View File

@@ -9,7 +9,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","11.4","11.5","11.6","11.7","11.8","12.0"],
"versions":["10.6","10.7","10.8","10.9","10.11","11.0","11.1","11.2","11.3","11.4","11.5","11.6","11.7","11.8","12.0","12.1","12.3"],
"shell":"install.sh",
"checks":"server/mariadb",
"path":"server/mariadb",

View File

@@ -8,11 +8,11 @@ rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
# cd /www/server/mdserver-web/plugins/mariadb && bash install.sh install 8.2
# cd /www/server/mdserver-web && source bin/activate && python3 plugins/mariadb/index.py try_slave_sync_bugfix {}
# cd /www/server/mdserver-web && source bin/activate && python3 plugins/mariadb/index.py do_full_sync {"db":"xxx","sign":"","begin":1}
# cd /www/server/mdserver-web && source bin/activate && python3 plugins/mariadb/index.py sync_database_repair {"db":"xxx","sign":""}
# cd /www/server/mdserver-web && source bin/activate && python3 plugins/mariadb/index.py init_slave_status
# cd /www/server/mdserver-web && source bin/activate && python3 plugins/mariadb/index.py install_pre_inspection
# cd /www/server/mdserver-web && . bin/activate && python3 plugins/mariadb/index.py try_slave_sync_bugfix {}
# cd /www/server/mdserver-web && . bin/activate && python3 plugins/mariadb/index.py do_full_sync {"db":"xxx","sign":"","begin":1}
# cd /www/server/mdserver-web && . bin/activate && python3 plugins/mariadb/index.py sync_database_repair {"db":"xxx","sign":""}
# cd /www/server/mdserver-web && . bin/activate && python3 plugins/mariadb/index.py init_slave_status
# cd /www/server/mdserver-web && . bin/activate && python3 plugins/mariadb/index.py install_pre_inspection
action=$1
@@ -26,7 +26,7 @@ else
useradd -g mysql -s /usr/sbin/nologin mysql
fi
if [ "${2}" == "" ];then
if [ "${2}" = "" ];then
echo '缺少安装脚本...'
exit 0
fi
@@ -36,7 +36,7 @@ if [ ! -d $curPath/versions/$2 ];then
exit 0
fi
if [ "${action}" == "uninstall" ];then
if [ "${action}" = "uninstall" ];then
if [ -f /usr/lib/systemd/system/mariadb.service ] || [ -f /lib/systemd/system/mariadb.service ];then
systemctl stop mariadb
@@ -49,7 +49,7 @@ fi
sh -x $curPath/versions/$2/install.sh $1
if [ "${action}" == "install" ] && [ -d $serverPath/mariadb ];then
if [ "${action}" = "install" ] && [ -d $serverPath/mariadb ];then
#初始化
cd ${rootPath} && python3 ${rootPath}/plugins/mariadb/index.py start ${type}
cd ${rootPath} && python3 ${rootPath}/plugins/mariadb/index.py initd_install ${type}

View File

@@ -507,11 +507,11 @@ function setRootPwd(type, pwd){
var index = layer.open({
type: 1,
area: '500px',
area: '800px',
title: '修改数据库密码',
closeBtn: 1,
shift: 5,
btn:["提交", "关闭", "复制ROOT密码", "强制修改"],
btn:["提交", "关闭", "复制ROOT密码", "修改本地ROOT记录", "强改ROOT密码"],
shadeClose: true,
content: "<form class='bt-form pd20' id='mod_pwd'>\
<div class='line'>\
@@ -537,7 +537,7 @@ function setRootPwd(type, pwd){
return false;
},
btn4:function(layerIndex){
layer.confirm('强制修改,是为了在重建时使用,确定强制?', {
layer.confirm('修改本地ROOT记录,确定修改?', {
btn: ['确定', '取消']
}, function(index, layero){
layer.close(index);
@@ -551,6 +551,22 @@ function setRootPwd(type, pwd){
});
});
return false;
},
btn5:function(layerIndex){
layer.confirm('强制修改MySQL密码,确定强制? (比较耗时)', {
btn: ['确定', '取消']
}, function(index, layero){
layer.close(index);
var password = $("#MyPassword").val();
myPost('set_root_pwd', {password:password,force:'2'}, function(data){
var rdata = $.parseJSON(data.data);
showMsg(rdata.msg,function(){
layer.close(layerIndex);
dbList();
},{icon: rdata.status ? 1 : 2});
});
});
return false;
}
});
}
@@ -617,7 +633,7 @@ function setDbAccess(username){
<span class='tname'>访问权限</span>\
<div class='info-r '>\
<select class='bt-input-text mr5' name='dataAccess' style='width:100px'>\
<option value='127.0.0.1'>本地服务器</option>\
<option value='localhost'>本地服务器</option>\
<option value=\"%\">所有人</option>\
<option value='ip'>指定IP</option>\
</select>\
@@ -625,9 +641,9 @@ function setDbAccess(username){
</div>\
</form>",
success:function(){
if (rdata.msg == '127.0.0.1'){
$('select[name="dataAccess"]').find("option[value='127.0.0.1']").attr("selected",true);
} else if (rdata.msg == '%'){
if (rdata.msg == 'localhost'){
$('select[name="dataAccess"]').find("option[value='localhost']").attr("selected",true);
} else if (rdata.msg.indexOf("%") > -1){
$('select[name="dataAccess"]').find('option[value="%"]').attr("selected",true);
} else if ( rdata.msg == 'ip' ){
$('select[name="dataAccess"]').find('option[value="ip"]').attr("selected",true);
@@ -914,7 +930,7 @@ function delBackup(filename, name, path){
path = "";
}
myPost('delete_db_backup',{filename:filename,path:path},function(){
layer.msg('执行成功!');
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
setTimeout(function(){
setBackupReq(name);
},2000);
@@ -931,13 +947,57 @@ function importBackup(file,name){
});
}
function importDbExternal(file,name){
myPost('import_db_external',{file:file,name:name}, function(data){
layer.msg('执行成功!');
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 importDbProgress(file,name){
myPost('import_db_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 importDbExternalProgress(file,name){
myPost('import_db_external_progress',{file:file,name:name}, function(data){
var rdata = $.parseJSON(data.data);
@@ -1086,12 +1146,13 @@ 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">\
<div class="db_list">\
<button id="btn_backup" class="btn btn-success btn-sm" type="button">备份</button>\
<button id="btn_backup_reload" class="btn btn-success btn-sm" type="button">刷新</button>\
<button id="btn_local_import" class="btn btn-success btn-sm" type="button">外部导入</button>\
</div >\
<div class="divtable">\
@@ -1123,6 +1184,10 @@ function setBackup(db_name){
setLocalImport(db_name);
});
$('#btn_backup_reload').click(function(){
setBackupReq(db_name);
});
setBackupReq(db_name);
},
});
@@ -1140,6 +1205,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>\
@@ -1732,7 +1798,7 @@ function getMasterRepSlaveUserCmd(username, db=''){
var loadOpen = layer.open({
type: 1,
title: '同步命令',
title: '同步命令[ 1-经典模式,2-GTID ]',
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>\
@@ -1780,7 +1846,7 @@ function setDbMasterAccess(username){
<span class='tname'>访问权限</span>\
<div class='info-r '>\
<select class='bt-input-text mr5' name='dataAccess' style='width:100px'>\
<option value='127.0.0.1'>本地服务器</option>\
<option value='localhost'>本地服务器</option>\
<option value=\"%\">所有人</option>\
<option value='ip'>指定IP</option>\
</select>\
@@ -1788,9 +1854,9 @@ function setDbMasterAccess(username){
</div>\
</form>",
success:function(){
if (rdata.msg == '127.0.0.1'){
$('select[name="dataAccess"]').find("option[value='127.0.0.1']").attr("selected",true);
} else if (rdata.msg == '%'){
if (rdata.msg == 'localhost'){
$('select[name="dataAccess"]').find("option[value='localhost']").attr("selected",true);
} else if (rdata.msg.indexOf("%") > -1 ){
$('select[name="dataAccess"]').find('option[value="%"]').attr("selected",true);
} else if ( rdata.msg == 'ip' ){
$('select[name="dataAccess"]').find('option[value="ip"]').attr("selected",true);

View File

@@ -29,7 +29,34 @@ import core.db as db
class backupTools:
def backupDatabase(self, name, count):
def getDbBackupList(self,dbname=''):
bkDir = mw.getFatherDir() + '/backup/database/mariadb'
if not os.path.isdir(bkDir):
return []
blist = os.listdir(bkDir)
r = []
bname = 'db_' + dbname
blen = len(bname)
for x in blist:
fbstr = x[0:blen]
if fbstr == bname:
r.append(x)
# 文件名按时间戳命名,排序后即为时间顺序(旧->新)
r.sort()
return r
def backupDatabase(self, params, count):
params_args = params.split("@")
name = params_args[0]
table_name = ''
if len(params_args) > 1:
table_name = params_args[1]
backup_name = name
if table_name != '':
backup_name = name+'@'+table_name
db_path = mw.getServerDir() + '/mariadb'
db_sock = mw.getServerDir() + '/mariadb/'
db_name = 'mysql'
@@ -48,7 +75,7 @@ class backupTools:
if not os.path.exists(backup_path):
mw.execShell("mkdir -p " + backup_path)
filename = backup_path + "/db_" + name + "_" + \
filename = backup_path + "/db_" + backup_name + "_" + \
time.strftime('%Y%m%d_%H%M%S', time.localtime()) + ".sql.gz"
mysql_root = mw.M('config').dbPos(db_path, db_name).where(
@@ -71,45 +98,41 @@ class backupTools:
cmd = db_path + "/bin/mariadb-dump --defaults-file=" + my_conf_path + " --single-transaction --quick --default-character-set=utf8 " + \
name + " | gzip > " + filename
if table_name != '':
cmd = db_path + "/bin/mariadb-dump --defaults-file=" + my_conf_path + " --single-transaction --quick --default-character-set=utf8 " + \
name + " " + table_name + " | gzip > " + filename
mw.execShell(cmd)
if not os.path.exists(filename):
endDate = time.strftime('%Y/%m/%d %X', time.localtime())
log = "数据库[" + name + "]备份失败!"
print("★[" + endDate + "] " + log)
print(
"----------------------------------------------------------------------------")
return
mycnf = mw.readFile(db_path + '/etc/my.cnf')
mycnf = mycnf.replace(subStr, sea)
if len(mycnf) > 100:
mw.writeFile(db_path + '/etc/my.cnf', mycnf)
if not os.path.exists(filename):
endDate = time.strftime('%Y/%m/%d %X', time.localtime())
log = "数据库[" + name + "]备份失败!"
print("★[" + endDate + "] " + log)
print("----------------------------------------------------------------------------")
return
endDate = time.strftime('%Y/%m/%d %X', time.localtime())
outTime = time.time() - startTime
pid = mw.M('databases').dbPos(db_path, db_name).where(
'name=?', (name,)).getField('id')
mw.M('backup').add('type,name,pid,filename,addtime,size', (3, os.path.basename(
filename), pid, filename, endDate, os.path.getsize(filename)))
log = "数据库[" + name + "]备份成功,用时[" + str(round(outTime, 2)) + "]秒"
log = "数据库[" + backup_name + "]备份成功,用时[" + str(round(outTime, 2)) + "]秒"
mw.writeLog('计划任务', log)
print("★[" + endDate + "] " + log)
print("|---保留最新的[" + count + "]份备份")
print("|---文件名:" + filename)
backups = self.getDbBackupList(backup_name)
# 清理多余备份
backups = mw.M('backup').where(
'type=? and pid=?', ('3', pid)).field('id,filename').select()
num = len(backups) - int(count)
if num > 0:
for backup in backups:
mw.execShell("rm -f " + backup['filename'])
mw.M('backup').where('id=?', (backup['id'],)).delete()
mw.execShell("rm -f " + backup_path + "/"+backup)
num -= 1
print("|---已清理过期备份文件:" + backup['filename'])
print("|---已清理过期文件:" + backup)
if num < 1:
break

View File

@@ -113,7 +113,7 @@ Uninstall_app()
}
action=$1
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_app
else
Uninstall_app

View File

@@ -65,13 +65,13 @@ Install_app()
fi
OPTIONS=''
if [ "$sysName" == "Darwin" ];then
if [ "$sysName" = "Darwin" ];then
OPTIONS='-DPLUGIN_TOKUDB=NO'
fi
INSTALL_CMD=cmake
CMAKE3=`which cmake3`
if [ "$?" == "0" ];then
if [ "$?" = "0" ];then
INSTALL_CMD=cmake3
fi
@@ -116,7 +116,7 @@ Uninstall_app()
}
action=$1
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_app
else
Uninstall_app

View File

@@ -103,7 +103,7 @@ Uninstall_app()
}
action=$1
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_app
else
Uninstall_app

View File

@@ -103,7 +103,7 @@ Uninstall_app()
}
action=$1
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_app
else
Uninstall_app

View File

@@ -113,7 +113,7 @@ Uninstall_app()
}
action=$1
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_app
else
Uninstall_app

View File

@@ -113,7 +113,7 @@ Uninstall_app()
}
action=$1
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_app
else
Uninstall_app

View File

@@ -113,7 +113,7 @@ Uninstall_app()
}
action=$1
if [ "${1}" == 'install' ];then
if [ "${1}" = 'install' ];then
Install_app
else
Uninstall_app

Some files were not shown because too many files have changed in this diff Show More