AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题

问题[mariadb](server)

Martin Hope
squarefighter
Asked: 2024-08-28 02:57:09 +0800 CST

将转储从 mariadb 10.4.22 恢复到 11.2.4 后数据库性能缓慢,ANALYZE TABLE 命令不起作用

  • 6

我在我的两台服务器中的一台上运行着 moodle,他的 moodle 数据库安装在 mariadb 10.4.22 上并且正在维护中,因此我将 moodle 转移到了另一台安装有 mariadb 11.2.4 的服务器上,但是第二台服务器的 moodle 数据库性能存在问题,我在 moodle 论坛上找到了一个帖子,讨论了将 10.4.2 mariadb 的数据库转储恢复到 11 之后的版本时出现的问题,那里说我需要在数据库上运行 ANALYZE TABLE 才能使其更好地工作:

https://moodle.org/mod/forum/discuss.php?d=446712

我尝试在数据库的每个表上执行此命令,但是它不起作用,数据库仍然非常慢(主要是消息),我尝试将转储恢复到旧服务器并且它正常工作,但是 moodle 不再支持 mariadb 10.4.2,所以我必须更新,我该怎么办?我可以运行其他命令吗?我该如何解决问题?(我对故障排除不是很有经验,所以如果你们想要一些信息,就说我会提供,因为我不知道解决这个问题需要什么信息)

当我在新服务器(装有 mariadb 11.2.4 的服务器)上运行 mysqltuner 时有结果,但似乎没有太大帮助。

mysqltuner1 mysqltuner2 mysqltuner3 mysqltuner4

编辑:我收到了来自 slowlog 的回复

# Time: 240828 12:55:04
# User@Host: user[user] @ localhost []
# Thread_id: 318  Schema: my_db  QC_hit: No
# Query_time: 332.625304  Lock_time: 0.000335  Rows_sent: 32  Rows_examined: 111342578
# Rows_affected: 0  Bytes_sent: 0
use my_db;
SET timestamp=1724849704;
SELECT m.id as messageid, mc.id as id, mc.name as conversationname, mc.type as conversationtype, m.useridfrom,
                   m.smallmessage, m.fullmessage, m.fullmessageformat, m.fullmessagetrust, m.fullmessagehtml, m.timecreated,
                   mc.component, mc.itemtype, mc.itemid, mc.contextid, mca.action as ismuted
              FROM ehvp_message_conversations mc
        INNER JOIN ehvp_message_conversation_members mcm
                ON (mcm.conversationid = mc.id AND mcm.userid = '21')
        LEFT JOIN (
                      SELECT m.conversationid, MAX(m.id) AS messageid
                        FROM ehvp_messages m
                  INNER JOIN (
                                  SELECT m.conversationid, MAX(m.timecreated) as maxtime
                                    FROM ehvp_messages m
                              INNER JOIN ehvp_message_conversation_members mcm
                                      ON mcm.conversationid = m.conversationid
                               LEFT JOIN ehvp_message_user_actions mua
                                      ON (mua.messageid = m.id AND mua.userid = '21' AND mua.action = '2')
                                   WHERE mua.id is NULL
                                     AND mcm.userid = '21'
                                GROUP BY m.conversationid
                             ) maxmessage
                           ON maxmessage.maxtime = m.timecreated AND maxmessage.conversationid = m.conversationid
                     GROUP BY m.conversationid
                   ) lastmessage
                ON lastmessage.conversationid = mc.id
        LEFT JOIN ehvp_messages m
               ON m.id = lastmessage.messageid
        LEFT JOIN ehvp_message_conversation_actions mca
               ON (mca.conversationid = mc.id AND mca.userid = '21' AND mca.action = '1')
            WHERE mc.id IS NOT NULL
              AND mc.enabled = 1  AND (mc.type = '1' OR mc.type = '3')   AND mc.id <> '13'
          ORDER BY (CASE WHEN m.timecreated IS NULL THEN 0 ELSE 1 END) DESC, m.timecreated DESC, id DESC LIMIT 0, 51;

编辑2:我在两台服务器上的查询中使用命令 EXPLAIN:

11.2.4 mariadb服务器(存在性能问题的服务器,这里的数据库称为my_db):

+------+-----------------+------------+------------+----------------------------------------------------------------------------------+---------------------------------------------------+---------+--------------------------------------------+---------+----------------------------------------------+
| id   | select_type     | table      | type       | possible_keys                                                                    | key                                               | key_len | ref                                        | rows    | Extra                                        |
+------+-----------------+------------+------------+----------------------------------------------------------------------------------+---------------------------------------------------+---------+--------------------------------------------+---------+----------------------------------------------+
|    1 | PRIMARY         | mcm        | ref        | ehvp_messconvmemb_con_ix,ehvp_messconvmemb_use_ix                                | ehvp_messconvmemb_use_ix                          | 8       | const                                      | 4092    | Using where; Using temporary; Using filesort |
|    1 | PRIMARY         | mc         | eq_ref     | PRIMARY,ehvp_messconv_typ_ix                                                     | PRIMARY                                           | 8       | my_db.mcm.conversationid                   | 1       | Using where                                  |
|    1 | PRIMARY         | <derived2> | ref        | key0                                                                             | key0                                              | 9       | my_db.mcm.conversationid                   | 1       |                                              |
|    1 | PRIMARY         | m          | eq_ref     | PRIMARY                                                                          | PRIMARY                                           | 8       | lastmessage.messageid                      | 1       | Using where                                  |
|    1 | PRIMARY         | mca        | ref|filter | ehvp_messconvacti_use_ix,ehvp_messconvacti_con_ix                                | ehvp_messconvacti_con_ix|ehvp_messconvacti_use_ix | 8|8     | my_db.mcm.conversationid                   | 1 (11%) | Using where; Using rowid filter              |
|    2 | LATERAL DERIVED | m          | ref        | ehvp_mess_contim_ix,ehvp_mess_con_ix                                             | ehvp_mess_contim_ix                               | 8       | my_db.mcm.conversationid                   | 2       | Using where; Using index                     |
|    2 | LATERAL DERIVED | <derived3> | ref        | key0                                                                             | key0                                              | 17      | my_db.m.conversationid,my_db.m.timecreated | 1       |                                              |
|    3 | DERIVED         | m          | index      | ehvp_mess_contim_ix,ehvp_mess_con_ix                                             | ehvp_mess_contim_ix                               | 16      | NULL                                       | 9664    | Using index; Using temporary; Using filesort |
|    3 | DERIVED         | mua        | eq_ref     | ehvp_messuseracti_usemesac_uix,ehvp_messuseracti_use_ix,ehvp_messuseracti_mes_ix | ehvp_messuseracti_usemesac_uix                    | 24      | const,my_db.m.id,const                     | 1       | Using where; Using index; Not exists         |
|    3 | DERIVED         | mcm        | ref        | ehvp_messconvmemb_con_ix,ehvp_messconvmemb_use_ix                                | ehvp_messconvmemb_con_ix                          | 8       | my_db.m.conversationid                     | 1       | Using where                                  |
+------+-----------------+------------+------------+----------------------------------------------------------------------------------+---------------------------------------------------+---------+--------------------------------------------+---------+----------------------------------------------+

10.4.2 mariadb服务器(没有问题的服务器,这里的数据库称为moodle):

+------+-----------------+------------+------------+----------------------------------------------------------------------------------+---------------------------------------------------+---------+----------------------------------------------+---------+----------------------------------------------+
| id   | select_type     | table      | type       | possible_keys                                                                    | key                                               | key_len | ref                                          | rows    | Extra                                        |
+------+-----------------+------------+------------+----------------------------------------------------------------------------------+---------------------------------------------------+---------+----------------------------------------------+---------+----------------------------------------------+
|    1 | PRIMARY         | mcm        | ref        | ehvp_messconvmemb_con_ix,ehvp_messconvmemb_use_ix                                | ehvp_messconvmemb_use_ix                          | 8       | const                                        | 2988    | Using where; Using temporary; Using filesort |
|    1 | PRIMARY         | mc         | eq_ref     | PRIMARY,ehvp_messconv_typ_ix                                                     | PRIMARY                                           | 8       | moodle.mcm.conversationid                    | 1       | Using where                                  |
|    1 | PRIMARY         | <derived2> | ref        | key0                                                                             | key0                                              | 9       | moodle.mcm.conversationid                    | 2       |                                              |
|    1 | PRIMARY         | m          | eq_ref     | PRIMARY                                                                          | PRIMARY                                           | 8       | lastmessage.messageid                        | 1       | Using where                                  |
|    1 | PRIMARY         | mca        | ref|filter | ehvp_messconvacti_use_ix,ehvp_messconvacti_con_ix                                | ehvp_messconvacti_con_ix|ehvp_messconvacti_use_ix | 8|8     | moodle.mcm.conversationid                    | 1 (11%) | Using where; Using rowid filter              |
|    2 | LATERAL DERIVED | m          | ref        | ehvp_mess_contim_ix,ehvp_mess_con_ix                                             | ehvp_mess_contim_ix                               | 8       | moodle.mcm.conversationid                    | 1       | Using index                                  |
|    2 | LATERAL DERIVED | <derived3> | ref        | key0                                                                             | key0                                              | 17      | moodle.m.conversationid,moodle.m.timecreated | 2       |                                              |
|    3 | DERIVED         | m          | index      | ehvp_mess_contim_ix,ehvp_mess_con_ix                                             | ehvp_mess_contim_ix                               | 16      | NULL                                         | 5005    | Using index; Using temporary; Using filesort |
|    3 | DERIVED         | mua        | ref        | ehvp_messuseracti_usemesac_uix,ehvp_messuseracti_use_ix,ehvp_messuseracti_mes_ix | ehvp_messuseracti_mes_ix                          | 8       | moodle.m.id                                  | 1       | Using where; Not exists                      |
|    3 | DERIVED         | mcm        | ref|filter | ehvp_messconvmemb_con_ix,ehvp_messconvmemb_use_ix                                | ehvp_messconvmemb_con_ix|ehvp_messconvmemb_use_ix | 8|8     | moodle.m.conversationid                      | 1 (3%)  | Using where; Using rowid filter              |
+------+-----------------+------------+------------+----------------------------------------------------------------------------------+---------------------------------------------------+---------+----------------------------------------------+---------+----------------------------------------------+

看起来两个服务器的索引之间没有太大差别。

编辑 3:这些是针对来自 slowlog 的查询所涉及的表的命令 SHOW CREATE TABLE 的返回值:

为服务器 mariadb 11.2.4(存在性能问题的服务器)创建表

https://pastebin.com/LFTyXvcJ

为服务器 mariadb 10.4.2(没有问题的服务器)创建表

https://pastebin.com/FSvj9fCV

mariadb
  • 2 个回答
  • 103 Views
Martin Hope
CaptainSkyfish
Asked: 2023-10-25 08:56:03 +0800 CST

Grafana 在高可用性模式下不共享仪表板

  • 5

我正在尝试在外部服务器上使用 MariaDB 将 Grafana(版本 9.5.5,SUSE Linux)设置为高可用性模式。我的理解是,这应该会导致我的多个 Grafana 实例共享仪表板(在一个实例上创建,在另一个实例上可见)。我可以让它们连接,但不能共享仪表板。
注意:我对 Grafana 配置和数据库使用都很陌生。

我使用以下命令设置 MariaDB(出于隐私考虑,我将使用示例密码和 IPS):

在 MariaDB 服务器上:

mysql -u root -p

create database grafana;

grant all privileges on grafana.* TO 'grafanareader' identified by "PWORD";

在两台 Grafana 服务器上:

nano /usr/share/grafana/conf/defaults.ini

type = sqlite3
host = 123.45.678.99 (my MariaDB host IP) 
name = grafana
user = grafanareader

password = PWORD

(注意,我不知道这是否相关,但是当我尝试将其设置为 mysql 而不是 sqlite3 时,它不会启动服务)

systemctl restart grafana-server.service (没有错误,它解析ini并运行)

已确认这些设置反映在 GUI 的“管理设置”部分中。

测试1:登录GUI,进入菜单-数据源-添加新-Mysql-输入与上面相同的参数-保存并测试=测试成功

测试 2:使用新数据源,通过 GUI 访问数据库中手动创建的表=测试成功

(以上两个测试只是为了说明问题不在于连接失败或者用户访问数据库失败)

测试 3:在 Grafana 服务器上创建仪表板 1. 检查仪表板是否已正确复制到 Grafana 服务器 2. =测试失败

那么,我是否误解了高可用性模式?Grafana 是否不可能在实例之间共享仪表板?或者我配置有什么错误?

mariadb
  • 1 个回答
  • 27 Views
Martin Hope
MeSo2
Asked: 2023-08-28 05:57:28 +0800 CST

当与 ASP Classic 一起使用时,MariaDB ODBC 连接器 3.1.19 现在在生产环境中是否稳定?

  • 5

有人在生产环境中成功使用过这个驱动吗?

不久前,我尝试使用 MariaDB ODBC Connector 3.1.15 和 MariaDB 10.6 数据库;并且网站不断崩溃。

ODBC驱动程序设置3.1.15

我必须恢复使用MySQL ODBC 8.0 Unicode 驱动程序才能使站点稳定。

我在 MariaDB ODBC Connector 3.1.18发行说明中看到存在内存泄漏修复;该驱动程序还修复了很多其他错误:https://mariadb.com/kb/en/mariadb-connector-odbc-31-release-notes/。

生产准备好了吗?


我将 MariaDB ODBC 连接器更新到 3.1.19 mariadb-connector-odbc-3.1.19-win64.msi,如果仍然崩溃,我会报告。

mariadb
  • 1 个回答
  • 34 Views
Martin Hope
Gbl
Asked: 2023-06-28 18:44:06 +0800 CST

Mysqldump max_allowed_pa​​cket问题

  • 5

我需要迁移由离开公司的人员管理的数据库。源服务器是 MariaDB 1:10.5.5,目标服务器是 MariaDB 1:10.5.19。

现有的备份脚本使用以下命令:

mysqldump --max_allowed_pa​​cket=5120M -u root -p my_db > my_dump.sql

两台服务器在 /etc/mysql/conf.d/mysqldump.cnf 中都有以下设置:

[mysqldump]
quick
quote-names
max_allowed_packet      = 16M

在/etc/mysql/mariadb.conf.d/50-server.cnf中:

max_allowed_packet=524288000 (-> = 500MB)

我不知道为什么,但这样设置一定是有原因的。

我不明白为什么在命令行上使用“--max_allowed_pa​​cket=5120M”。

它不符合服务器设置,并且 MySQL 文档表示 mysqldump max_allowed_pa​​cket 值不得超过服务器值,并且协议的最大值为 1G。

如果我手动运行“mysqldump --max_allowed_pa​​cket=5120M -u root -p my_db > my_dump.sql”,

我收到此警告:“警告:选项‘max_allowed_pa​​cket’:无符号值 5368709120 调整为 2147483648”

我怎样才能安全地转储这个数据库?我需要确保不会丢失任何数据并且它将导入到新服务器中。我必须使用“max_allowed_pa​​cket”吗?也许与服务器具有相同的值(524288000)?

谢谢!

mariadb
  • 1 个回答
  • 15 Views
Martin Hope
H. Weirauch
Asked: 2023-06-11 22:45:06 +0800 CST

列出 MariaDB 的所有用户

  • 6

如何列出我的 MariaDB 中的所有用户?

互联网充满了

SELECT user FROM mysql.user;

在所有变体中,但这在 MariaDB 上不起作用(如果重要的话,我使用的是 10.5.19 版),而是会产生错误(以 root 权限运行):

ERROR 1356 (HY000): View 'mysql.user' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them

我只发现一个模糊有用的评论:https://stackoverflow.com/a/64841540

MariaDB-10.4+mysql.user是一个视图而不是一个表。

[...] 始终查看官方文档。

重点是,我确实检查了官方文档,但它似乎默默地假设您已经知道您的用户名。我没有找到任何关于如何首先获得这些的提及,即如何只显示用户列表。

mariadb
  • 2 个回答
  • 127 Views
Martin Hope
Joel Divekar
Asked: 2022-02-06 23:44:29 +0800 CST

mariabackup 失败并出现错误:cannot mkdir 2: /data/backups/mariadb/

  • 0

尝试使用 mariabackup 备份我们所有的数据库。首先创建的备份目录为

mkdir -p /mnt/data/backup/mariadb
chown -R mysql:mysql /mnt/data/backup/mariadb

并继续做备份

# mariabackup --backup --target-dir=/mnt/data/backups/mariadb/ --user=root --password=xxxxxxxx
[00] 2022-02-06 11:28:46 Connecting to MySQL server host: localhost, user: root, password: set, port: not set, socket: /mnt/data/mysql/mysql.sock
[00] 2022-02-06 11:28:46 Using server version 10.3.28-MariaDB
mariabackup based on MariaDB server 10.3.28-MariaDB Linux (x86_64)
[00] 2022-02-06 11:28:46 uses posix_fadvise().
[00] 2022-02-06 11:28:46 cd to /mnt/data/mysql/
[00] 2022-02-06 11:28:46 open files limit requested 0, set to 1024
[00] 2022-02-06 11:28:46 mariabackup: using the following InnoDB configuration:
[00] 2022-02-06 11:28:46 innodb_data_home_dir = 
[00] 2022-02-06 11:28:46 innodb_data_file_path = ibdata1:12M:autoextend
[00] 2022-02-06 11:28:46 innodb_log_group_home_dir = ./
[00] 2022-02-06 11:28:46 InnoDB: Using Linux native AIO
2022-02-06 11:28:46 0 [Note] InnoDB: Number of pools: 1
[00] 2022-02-06 11:28:46 Error: cannot mkdir 2: /mnt/data/backups/mariadb/

尝试了护目镜和各种选项它没有工作所以最后尝试没有 --target-directory 选项并再次进行备份,它成功运行并得到了这个

# ls -ld /mnt/data/backup
drwxr-xr-x 3 mysql mysql 21 Feb  6 11:41 /mnt/data/backup

# pwd
/mnt/data/mysql

# ll
total 8
drwxr-xr-x  3 mysql mysql   21 Feb  6 11:41 backup
drwxr-xr-x 27 mysql mysql 4096 Feb  4 19:07 mysql
drwx------ 27 root  root  4096 Feb  6 11:22 xtrabackup_backupfiles

我做错了什么或如何使用 ----target-directory 运行它

backup mariadb rocky-linux
  • 2 个回答
  • 281 Views
Martin Hope
MeSo2
Asked: 2021-12-17 18:24:26 +0800 CST

什么会启动 MariaDB 开始解析 IP 地址?

  • 0

在我的Windows Logs > Application我看到这些警告

无法解析 IP 地址“xxx.xxx.xxx.xxx”:不知道这样的主机。

我不知道IP。这些警告记录为:

Log Name: Application
Source: MariaDB
Event ID: 100
Level: Warning

- <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  - <System>
      <Provider Name="MariaDB" /> 
      <EventID Qualifiers="49152">100</EventID> 
      <Version>0</Version> 
      <Level>3</Level> 
      <Task>0</Task> 
      <Opcode>0</Opcode> 
      <Keywords>0x80000000000000</Keywords> 
      <TimeCreated SystemTime="2021-12-16T23:32:07.8659376Z" /> 
      <EventRecordID>2182760</EventRecordID> 
      <Correlation /> 
      <Execution ProcessID="0" ThreadID="0" /> 
      <Channel>Application</Channel> 
      <Computer>vm-white</Computer> 
      <Security /> 
    </System>
  - <EventData>
      <Data>IP address 'xxx.xxx.xxx.xxx' could not be resolved: No such host is known.</Data> 
    </EventData>
</Event>

我正在托管 WordPress 网站和 Matomo(一个开源网络分析应用程序)。这可能是在尝试使用 MariaDB 查找要绑定的 rDNS 条目吗?

还有什么办法呢?恶意 WordPress 插件?

我很困惑。


我试过了

[mysqld]
bind-address = 127.0.0.1

看看它是否会影响这些记录的警告;但不知何故,我的网站加载时间更长。所以我解开了它。我所有的用户都设置为使用localhost而不是127.0.0.1. 基于这个skip-name-resolve信息,我可能最好禁用名称解析——它可以解释为什么如果它们消失了我会收到这些警告。


Bob 建议检查我的防火墙设置。我做了一些调整,并将继续检查日志是否有任何更改。

MariaDB 的防火墙设置


现在,刚刚收到这个警告

IP 地址“34.96.130.11”已解析为主机名“11.130.96.34.bc.googleusercontent.com”,类似于 IPv4 地址本身。

ip windows-event-log mariadb resolve warning
  • 1 个回答
  • 462 Views
Martin Hope
Gilberto Martins
Asked: 2021-11-23 11:52:28 +0800 CST

Windows 2019 .BAT 脚本中的奇怪行为

  • 1

我必须将备份从 Linux MariaDB 恢复到 Windows MariaDB,PowerBI 网关将在其中导入其数据。“mariabackup”是 MariaDB 的物理备份工具。但要恢复它,目标文件夹 ( %programfiles%\MariaDB 10.3\data\) 必须为空。

由于rmdir /S /Q "%programfiles%\MariaDB 10.3\data\将删除“数据”目录(我不想要的!!!),我一直在努力避免在以下脚本(uncompress.bat)中出现这种不需要的行为:

rem Uncompress the backup sent by the linux server
rem and imports it to MariaDB
rem Gilberto Martins - 19/11/2021

rem Uncompress the backup
rem The backup path is "mnt\external01\"
tar -xf c:\users\mariabkp\bkp.tgz -C c:\users\mariabkp\

rem Stop MariaDB
net stop mysql

rem Prepare the Backup for Restoration
"C:\Program Files\MariaDB 10.3\bin\mariabackup.exe" --prepare --target-dir="c:\users\mariabkp\mnt\external01\backup"\

rem Erase the Database files
del /q "C:\Program Files\MariaDB 10.3\data\*.*"
FOR /D %p IN ("c:\Program Files\MariaDB 10.3\data\*") DO rmdir "%p" /s /q

rem Import backup to MariaDB
"C:\Program Files\MariaDB 10.3\bin\mariabackup.exe" --move-back --target-dir="c:\users\mariabkp\mnt\external01\backup"\

rem Restore MariaDB conf file
copy "c:\Users\Administrator\my.ini" "c:\Program Files\MariaDB 10.3\data" /y

rem Start MariaDB
net start mysql

我工作得很好,直到我必须删除要恢复的文件,正如您在前面看到的那样:

Microsoft Windows [Version 10.0.17763.1935]
(c) 2018 Microsoft Corporation. All rights reserved.

C:\Users\Administrator>uncompress.bat

C:\Users\Administrator>rem Uncompress the backup sent by the linux server

C:\Users\Administrator>rem and imports it to MariaDB

C:\Users\Administrator>rem Gilberto Martins - 19/11/2021

C:\Users\Administrator>rem Uncompress the backup

C:\Users\Administrator>rem The backup path is "mnt\external01\backup"

C:\Users\Administrator>tar -xf c:\users\mariabkp\bkp.tgz -C c:\users\mariabkp\

C:\Users\Administrator>rem Stop MariaDB

C:\Users\Administrator>net stop mysql
The MySQL service is stopping.
The MySQL service was stopped successfully.


C:\Users\Administrator>rem Prepare the Backup for Restoration

C:\Users\Administrator>"C:\Program Files\MariaDB 10.3\bin\mariabackup.exe" --prepare --target-dir="c:\users\mariabkp\mnt\external01\backup"\
C:\Program Files\MariaDB 10.3\bin\mariabackup.exe based on MariaDB server 10.3.31-MariaDB Win64 (AMD64)
[00] 2021-11-22 16:26:29 cd to c:\users\mariabkp\mnt\external01\backup\
[00] 2021-11-22 16:26:29 open files limit requested 0, set to 0
[00] 2021-11-22 16:26:29 This target seems to be not prepared yet.
[00] 2021-11-22 16:26:29 mariabackup: using the following InnoDB configuration for recovery:
[00] 2021-11-22 16:26:29 innodb_data_home_dir = .
[00] 2021-11-22 16:26:29 innodb_data_file_path = ibdata1:12M:autoextend
[00] 2021-11-22 16:26:29 innodb_log_group_home_dir = .
[00] 2021-11-22 16:26:29 Starting InnoDB instance for recovery.
[00] 2021-11-22 16:26:29 mariabackup: Using 104857600 bytes for buffer pool (set by --use-memory parameter)
2021-11-22 16:26:29 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2021-11-22 16:26:29 0 [Note] InnoDB: Uses event mutexes
2021-11-22 16:26:29 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-11-22 16:26:29 0 [Note] InnoDB: Number of pools: 1
2021-11-22 16:26:29 0 [Note] InnoDB: Using SSE2 crc32 instructions
2021-11-22 16:26:29 0 [Note] InnoDB: Initializing buffer pool, total size = 100M, instances = 1, chunk size = 100M
2021-11-22 16:26:29 0 [Note] InnoDB: Completed initialization of buffer pool
2021-11-22 16:26:29 0 [Note] InnoDB: Starting crash recovery from checkpoint LSN=7032026737757
2021-11-22 16:26:29 0 [Note] InnoDB: Starting final batch to recover 68 pages from redo log.
[00] 2021-11-22 16:26:30 Last binlog file , position 0
[00] 2021-11-22 16:26:31 completed OK!

C:\Users\Administrator>rem Erase the Database files

C:\Users\Administrator>del /q "C:\Program Files\MariaDB 10.3\data\*.*"
\Program was unexpected at this time.

C:\Users\Administrator>FOR /D \Program Files\MariaDB 10.3\data\*") DO rmdir "p" /s /q

C:\Users\Administrator>

我的问题:

  1. 为什么\Program was unexpected at this time.当我尝试时出现消息del /q "C:\Program Files\MariaDB 10.3\data\*.*"

  2. 为什么原始指令FOR /D %p IN ("c:\Program Files\MariaDB 10.3\data\*") DO rmdir "%p" /s /q回显为FOR /D \Program Files\MariaDB 10.3\data\*") DO rmdir "p" /s /q?看起来(但我不确定)它可能与“%p”变量有关。

  3. 为什么剩下的指令(导入备份、恢复 my.ini 和启动 MariaDB)没有执行?

我不得不承认,我是 Windows 脚本的新手。而且我认为没有必要为一个脚本安装完整的 Python3!

更新:我试图在“准备备份以进行恢复”之前“擦除数据库文件”,但我得到了相同的结果,即它在“FOR”指令处停止。

windows scripting batch mariadb
  • 1 个回答
  • 64 Views
Martin Hope
knm
Asked: 2021-11-19 05:32:43 +0800 CST

循环法的高可用性 - rsync 和数据库复制或集群?

  • 0

我有一台机器(centos7),安装了 Apache、PHP、MariaDB 和 Nginx、Nodejs、MongoDB,并被许多不同的域使用。

我想创建一个工作镜像,但无法在 2 个选项之间做出决定:

  1. rsync 静态网站、服务器和配置文件 + mariadb 和 mongodb 复制
  2. 集群由 2 台机器组成,带有一些 proxmox 或其他免费技术(对我来说是新主题)

我希望它们都提供文件,例如 master-master sync ,因此它们可以分别处理约 50% 的请求。

您会建议哪个更有效并推荐您选择的软件/系统吗?

apache-2.2 high-availability node.js mongodb mariadb
  • 2 个回答
  • 219 Views
Martin Hope
Tim
Asked: 2021-07-09 22:22:09 +0800 CST

为什么当字段为 NULL 时 MariaDB CHAR_LENGTH 返回 NULL 而不是 0?

  • 1

我正在尝试使用 CHAR_LENGTH 计算表中存储的元数据的总大小,以将每行中相关字段的大小相加,以大致了解结果集的存储大小。

我不想要表中所有数据的大小,只想要一组结果的大小。

但是,表中的某些字段具有 NULL 值,一旦 CHAR_LENGTH 达到其中之一,整个计算就会失败,因为 CHAR_LENGTH 返回 NULL 而不是 0。

例如:

SELECT SUM(row_size) as `total` FROM ( SELECT CHAR_LENGTH(`field1`)+CHAR_LENGTH(`field2`)+CHAR_LENGTH(`field3`)+CHAR_LENGTH(`field4`) as `row_size` FROM `meta_data` WHERE `id` = 1 AND `id2` = 2 ) as tbl1;

对于某些查询,这是可行的,我得到了以字节为单位的大小,但对于任何在结果的任何行中的任何字段上具有 NULL 值的查询,我什么都得不到。

为什么 CHAR_LENGTH 不会为 NULL 值返回 0?

我想下一个最好的事情是取回结果并在代码中迭代它们以增加大小。我希望避免这样做,但这可能是唯一的方法吗?

mysql mariadb
  • 2 个回答
  • 86 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve