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
    • 最新
    • 标签
主页 / dba / 问题

问题[debian](dba)

Martin Hope
mbouzahir
Asked: 2021-01-04 13:46:24 +0800 CST

MySQL 挂起 SELECT 来自带有 blob 字段的表

  • 1

我设法创建了一个具有三个节点的 mysql 8 InnoDB 集群(一台专用服务器中的 VPS,每个 VPS 中的 25GB 内存,服务器中的总 RAM 96GB)和 MySQL 路由器 8 一切正常,但是当我尝试从下表从另一台服务器冻结,但当我将结果限制为 26 以下的数字时它可以工作

SET NAMES utf8;
SET time_zone = '+00:00';

SET NAMES utf8mb4;

DROP TABLE IF EXISTS `v7_addad`;
CREATE TABLE `v7_addad` (
  `id` int NOT NULL AUTO_INCREMENT,
  `body` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  `page_id` int NOT NULL,
  `done` tinyint NOT NULL DEFAULT '0',
  `book` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  PRIMARY KEY (`id`),
  FULLTEXT KEY `body` (`body`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

例如 :

select * from v7_addad limit 25; # this works
select * from v7_addad limit 26; # this freezes

顺便说一句,当 MySQL 路由器与应用程序位于同一服务器时,它不会冻结。

只想添加我从本地主机测试的这个,即使没有限制我也可以得到结果。所以可能是配置或网络问题。但我不知道如何解决这个问题

[mysqld]
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
datadir         = /var/lib/mysql
log-error       = /var/log/mysql/error.log

key_buffer_size         = 5G
table_open_cache               = 3072
table_definition_cache         = 4096
innodb_buffer_pool_size        = 15G
innodb_buffer_pool_instances = 2
innodb_log_file_size         = 2047M
max_allowed_packet           = 64M

'SHOW PROCESSLIST' 当“冻结”发生时 mysql> SHOW PROCESSLIST;

| Id     | User                       | Host                         | db     | Command | Time   | State                                                  | Info                             |
|      6 | event_scheduler            | localhost                    | NULL   | Daemon  | 285970 | Waiting on empty queue                                 | NULL                             |
|     10 | system user                |                              | NULL   | Connect | 285970 | waiting for handler commit                             | Group replication applier module |
|     13 | system user                |                              | NULL   | Query   | 285970 | Slave has read all relay log; waiting for more updates | NULL                             |
| 619140 | micadmin                   | LinuxSQL01.**.***.**.*:51896 | db0003 | Sleep   |    535 |                                                        | NULL                             |
| 620298 | micadmin                   | LinuxSQL01.**.***.**.*:54218 | db0003 | Sleep   |      3 |                                                        | NULL                             |
| 620304 | mysql_router1_g2wcum04fipm | LinuxSQL01.**.***.**.*:54230 | NULL   | Sleep   |      0 |                                                        | NULL                             |
| 620305 | micadmin                   | LinuxSQL01.**.***.**.*:54234 | NULL   | Query   |      0 | init                                                   | SHOW PROCESSLIST                 |

'SHOW ENGINE INNODB STATUS' 当“冻结”发生时

mysql > 显示引擎 INNODB 状态;

| Type   | Name | Status
| InnoDB |      | 
=====================================
2021-01-03 23:44:29 0x7f85843b4700 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 13 seconds
-----------------
BACKGROUND THREAD
-----------------
srv_master_thread loops: 59377 srv_active, 0 srv_shutdown, 226562 srv_idle
srv_master_thread log flush and writes: 0
----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 642
OS WAIT ARRAY INFO: signal count 972
RW-shared spins 449, rounds 449, OS waits 0
RW-excl spins 227, rounds 6734, OS waits 207
RW-sx spins 1, rounds 1, OS waits 0
Spin rounds per wait: 1.00 RW-shared, 29.67 RW-excl, 1.00 RW-sx
------------
TRANSACTIONS
------------
Trx id counter 298328
Purge done for trx's n:o < 298327 undo n:o < 0 state: running but idle
History list length 3
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 421696252935760, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421696252933192, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421696252934904, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421696252934048, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421696252932336, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421696252931480, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421696252930624, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421696252929768, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
--------
FILE I/O
--------
I/O thread 0 state: waiting for completed aio requests (insert buffer thread)
I/O thread 1 state: waiting for completed aio requests (log thread)
I/O thread 2 state: waiting for completed aio requests (read thread)
I/O thread 3 state: waiting for completed aio requests (read thread)
I/O thread 4 state: waiting for completed aio requests (read thread)
I/O thread 5 state: waiting for completed aio requests (read thread)
I/O thread 6 state: waiting for completed aio requests (write thread)
I/O thread 7 state: waiting for completed aio requests (write thread)
I/O thread 8 state: waiting for completed aio requests (write thread)
I/O thread 9 state: waiting for completed aio requests (write thread)
Pending normal aio reads: [0, 0, 0, 0] , aio writes: [0, 0, 0, 0] ,
 ibuf aio reads:, log i/o's:, sync i/o's:
Pending flushes (fsync) log: 0; buffer pool: 18446744073709551516
5244 OS file reads, 1279100 OS file writes, 997056 OS fsyncs
0.00 reads/s, 0 avg bytes/read, 3.69 writes/s, 3.23 fsyncs/s
-------------------------------------
INSERT BUFFER AND ADAPTIVE HASH INDEX
-------------------------------------
Ibuf: size 1, free list len 0, seg size 2, 0 merges
merged operations:
 insert 0, delete mark 0, delete 0
discarded operations:
 insert 0, delete mark 0, delete 0
Hash table size 3984439, node heap has 2 buffer(s)
Hash table size 3984439, node heap has 1 buffer(s)
Hash table size 3984439, node heap has 1 buffer(s)
Hash table size 3984439, node heap has 2 buffer(s)
Hash table size 3984439, node heap has 1 buffer(s)
Hash table size 3984439, node heap has 3 buffer(s)
Hash table size 3984439, node heap has 4 buffer(s)
Hash table size 3984439, node heap has 7 buffer(s)
0.23 hash searches/s, 1.62 non-hash searches/s
---
LOG
---
Log sequence number          2270625140
Log buffer assigned up to    2270625140
Log buffer completed up to   2270625140
Log written up to            2270625140
Log flushed up to            2270625140
Added dirty pages up to      2270625140
Pages flushed up to          2270624443
Last checkpoint at           2270624443
413027 log i/o's done, 1.36 log i/o's/second
----------------------
BUFFER POOL AND MEMORY
----------------------
Total large memory allocated 16483614720
Dictionary memory allocated 1956558
Buffer pool size   983040
Free buffers       977582
Database pages     5437
Old database pages 2006
Modified db pages  1
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 209, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 5172, created 268, written 603288
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 5437, unzip_LRU len: 0
I/O sum[258]:cur[0], unzip sum[0]:cur[0]
----------------------
INDIVIDUAL BUFFER POOL INFO
----------------------
---BUFFER POOL 0
Buffer pool size   491520
Free buffers       488755
Database pages     2754
Old database pages 996
Modified db pages  1
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 209, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 2596, created 161, written 384262
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 2754, unzip_LRU len: 0
I/O sum[129]:cur[0], unzip sum[0]:cur[0]
---BUFFER POOL 1
Buffer pool size   491520
Free buffers       488827
Database pages     2683
Old database pages 1010
Modified db pages  0
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 0, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 2576, created 107, written 219026
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 2683, unzip_LRU len: 0
I/O sum[129]:cur[0], unzip sum[0]:cur[0]
--------------
ROW OPERATIONS
--------------
0 queries inside InnoDB, 0 queries in queue
0 read views open inside InnoDB
Process ID=3803, Main thread ID=140203552966400 , state=sleeping
Number of rows inserted 9, updated 56291, deleted 0, read 7084971
0.00 inserts/s, 0.23 updates/s, 0.00 deletes/s, 21.69 reads/s
Number of system rows inserted 56323, updated 1572, deleted 56302, read 128455
0.23 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s
----------------------------
END OF INNODB MONITOR OUTPUT
============================
mysql debian
  • 2 个回答
  • 301 Views
Martin Hope
rookie09
Asked: 2017-11-30 23:25:18 +0800 CST

如何获取服务器的远程主机名?

  • 1

我可以在 PostgreSQLSELECT语句中使用服务器的主机名吗?以下内容可能很接近,但显然不太有效:

\set x \! hostname
select :x;

这适用于 Debian 上的 PostgreSQL 9.6。

postgresql debian
  • 2 个回答
  • 3838 Views
Martin Hope
russellhoff
Asked: 2017-10-09 23:07:54 +0800 CST

从文件恢复 MySQL 数据库

  • 0

我拥有一个运行 raspbian jessie (SYS_A) 的树莓派 1。两周前我执行了系统更新(aptitude update && aptitude upgrade,不是 aptitude dist-upgrade,因为我知道它存在 raspbian stretch)并且出现了一个不希望的情况。

我正在运行一个 MySQL 数据库,我猜是 5.5 版。升级后systemd没有启动mysqld守护进程,其日志如下:

user@rpi:~ $ sudo systemctl start mysql
Job for mysql.service failed. See 'systemctl status mysql.service' and     'journalctl -xn' for details.

user@rpi:~ $ systemctl status mysql.service
● mysql.service - LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mysql)
Active: failed (Result: exit-code) since mar 2017-10-10 10:13:11 CEST; 55s ago
Process: 7815 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)

user@rpi:~ $ sudo systemctl status mysql.service
● mysql.service - LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mysql)
Active: failed (Result: exit-code) since mar 2017-10-10 10:13:11 CEST; 2min 46s ago
Process: 7815 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)
oct 10 10:13:10 rpi /etc/init.d/mysql[8535]: 0 processes alive and     '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in
oct 10 10:13:11 rpi mysql[7815]: Starting MySQL database server: mysqld . . .     . . . . . . . . . . . . . . . . . . . . . . . . . . . failed!
oct 10 10:13:11 rpi systemd[1]: mysql.service: control process exited,     code=exited status=1
oct 10 10:13:11 rpi systemd[1]: Failed to start LSB: Start and stop the mysql     database server daemon.
oct 10 10:13:11 rpi systemd[1]: Unit mysql.service entered failed state.

幸运的是,我没有删除里面的 MySQL 文件/var/lib/mysql,所以看起来所有的数据都保留在那里。

我试图打开ibdataX文件,但似乎是二进制文件...

我还尝试过在另一个树莓派中设置另一个 raspbian jessie (SYS_B),安装 mysql,停止服务,备份 SYS_B 的原始/var/lib/mysql文件夹,将其替换为 SYS_A 的/var/lib/mysql文件夹,然后再次启动 mysqld 守护进程。但这导致了与 SYS_A 中相同的启动错误。

我有一个 wordpress 数据库,我不想丢失它。那么,有什么办法可以恢复吗?

/var/logs/mysql/error.log

171010 10:12:36 [Warning] Using unique option prefix myisam-recover instead     of myisam-recover-options is deprecated and will be removed in a future release.     Please use the full name instead.
171010 10:12:36 [Note] Plugin 'FEDERATED' is disabled.
171010 10:12:36 InnoDB: The InnoDB memory heap is disabled
171010 10:12:36 InnoDB: Mutexes and rw_locks use GCC atomic builtins
171010 10:12:36 InnoDB: Compressed tables use zlib 1.2.8
171010 10:12:36 InnoDB: Using Linux native AIO
171010 10:12:36 InnoDB: Initializing buffer pool, size = 128.0M
171010 10:12:37 InnoDB: Completed initialization of buffer pool
171010 10:12:37 InnoDB: highest supported file format is Barracuda.
171010 10:12:38  InnoDB: Waiting for the background threads to start
171010 10:12:39 InnoDB: 5.5.57 started; log sequence number 28689772
171010 10:12:39 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
171010 10:12:39 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
171010 10:12:39 [Note] Server socket created on IP: '0.0.0.0'.
171010 10:12:39 [ERROR] Fatal error: Can't open and lock privilege tables:     Incorrect file format 'user'

总结:我无法启动 mysqld,所以我无法备份我的数据库,我不想丢失它们,尤其是与 wordpress 相关的。/var/lib/mysql 上的数据,ibd 文件等等我都没有删除。我可以将 mysql 数据库恢复到另一个安装的 mysql 中吗?

mysql debian
  • 1 个回答
  • 145 Views
Martin Hope
rfreytag
Asked: 2017-03-07 12:49:44 +0800 CST

PostgreSQL pg_ctlcluster 不起作用

  • 0

今天我在 Debian 8 上重新配置了 PostgreSQL 9.4 安装上的一些东西。完成后我输入

# pg_ctcluster 9.4 main restart

像往常一样,但这次它不会重新启动。错误消息将我引导到集群的日志,该日志是空的。

# pg_ctcluster 9.4 main start

也没有用。所以为了追踪错误,我手动启动了集群

$ /usr/lib/postgresql/9.4/bin/postgres -d 3 -D /var/lib/postgresql/9.4/main -c config_file=/etc/postgresql/9.4/main/postgresql.conf 

作为用户 postgres。那工作得很好。所以集群正常工作,那么启动脚本本身一定是罪魁祸首。因此,为了获得更详细的错误消息,我尝试像这样启动它

# pg_ctcluster --foreground 9.4 main start

令我惊讶的是,它工作得很好,没有打嗝。

我现在能做些什么呢?还有什么要检查的可能会导致启动脚本出错?我不想修改 pg_ctlcluster 脚本 tbh。

postgresql debian
  • 1 个回答
  • 1716 Views
Martin Hope
Marcin Wasilewski
Asked: 2015-07-01 17:33:31 +0800 CST

Neo4j 服务不会从 Debian 上的导入数据库启动

  • 2

我最近在安装 Debian 7.8 时一直在玩 neo4j。这很棒!

今天我使用 neo4j-import 工具导入了大约 100000 个节点和 75000 个关系。我停止了 neo4j 服务并将导入的数据库复制到 /var/lib/neo4j/data/graph.db - 但现在 Neo4j 服务将无法启动

Starting Neo4j Server...WARNING: not changing user
process [4963]... waiting for server to be ready....... Failed to start within 120 seconds.
Neo4j Server may have failed to start, please check the logs.

这很奇怪,因为它不会等待 120 秒才能启动 - 最多 5 秒。生成的唯一日志是 /var/log/neo4j 中的 console.log

2015-07-01 00:10:24.363+0000 INFO  [API] Setting startup timeout to: 120000ms based on 120000
2015-07-01 00:10:26.501+0000 INFO  [API] Successfully shutdown Neo4j Server.

这不是很有用。当我删除数据库时,neo4j 能够启动。我将graph.db复制到我的Windows安装中,它运行良好,我可以搜索节点等。所以也许它与我的Debian上的配置有关?我在 /etc/neo4j/neo4j-server.properties 添加了一行

 org.neo4j.server.startup_timeout=0

但这没有任何改变,几秒钟后服务启动仍然超时。有任何想法吗?

这是 graph.db messages.log - 当我尝试启动服务时没有附加任何内容

2015-07-01 01:58:12.142+0000 INFO  [org.neo4j]: Import starting
2015-07-01 01:58:12.282+0000 INFO  [org.neo4j]: Creating new db @ /var/www/ddl/scripts/./graph.db/neostore
2015-07-01 01:58:13.238+0000 INFO  [org.neo4j]: Missing counts store, rebuilding it.
2015-07-01 01:58:13.607+0000 INFO  [org.neo4j]: No lucene scan store index found, this might just be first use. Preparing to rebuild.
2015-07-01 01:58:13.663+0000 INFO  [org.neo4j]: No lucene scan store index found, this might just be first use. Preparing to rebuild.
2015-07-01 01:58:13.952+0000 INFO  [org.neo4j]: Rebuilding lucene scan store, this may take a while
2015-07-01 01:58:13.955+0000 INFO  [org.neo4j]: Lucene scan store rebuilt (roughly -1 nodes)
2015-07-01 01:58:30.337+0000 INFO  [org.neo4j]: IMPORT DONE in 18s 182ms. Imported:
  95941 nodes
  158227 relationships
  369482 properties
2015-07-01 01:58:30.341+0000 INFO  [org.neo4j]: About to rotate counts store at transaction 1 to [/var/www/ddl/scripts/./graph.db/neostore.counts.db.b], from [/var/www/ddl/scripts/./graph.db/neostore.counts.db.a].
2015-07-01 01:58:30.344+0000 INFO  [org.neo4j]: Successfully rotated counts store at transaction 1 to [/var/www/ddl/scripts/./graph.db/neostore.counts.db.b], from [/var/www/ddl/scripts/./graph.db/neostore.counts.db.a].
debian neo4j
  • 1 个回答
  • 1548 Views

Sidebar

Stats

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

    连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目

    • 12 个回答
  • Marko Smith

    如何让sqlplus的输出出现在一行中?

    • 3 个回答
  • Marko Smith

    选择具有最大日期或最晚日期的日期

    • 3 个回答
  • Marko Smith

    如何列出 PostgreSQL 中的所有模式?

    • 4 个回答
  • Marko Smith

    列出指定表的所有列

    • 5 个回答
  • Marko Smith

    如何在不修改我自己的 tnsnames.ora 的情况下使用 sqlplus 连接到位于另一台主机上的 Oracle 数据库

    • 4 个回答
  • Marko Smith

    你如何mysqldump特定的表?

    • 4 个回答
  • Marko Smith

    使用 psql 列出数据库权限

    • 10 个回答
  • Marko Smith

    如何从 PostgreSQL 中的选择查询中将值插入表中?

    • 4 个回答
  • Marko Smith

    如何使用 psql 列出所有数据库和表?

    • 7 个回答
  • Martin Hope
    Jin 连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目 2014-12-02 02:54:58 +0800 CST
  • Martin Hope
    Stéphane 如何列出 PostgreSQL 中的所有模式? 2013-04-16 11:19:16 +0800 CST
  • Martin Hope
    Mike Walsh 为什么事务日志不断增长或空间不足? 2012-12-05 18:11:22 +0800 CST
  • Martin Hope
    Stephane Rolland 列出指定表的所有列 2012-08-14 04:44:44 +0800 CST
  • Martin Hope
    haxney MySQL 能否合理地对数十亿行执行查询? 2012-07-03 11:36:13 +0800 CST
  • Martin Hope
    qazwsx 如何监控大型 .sql 文件的导入进度? 2012-05-03 08:54:41 +0800 CST
  • Martin Hope
    markdorison 你如何mysqldump特定的表? 2011-12-17 12:39:37 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 对 SQL 查询进行计时? 2011-06-04 02:22:54 +0800 CST
  • Martin Hope
    Jonas 如何从 PostgreSQL 中的选择查询中将值插入表中? 2011-05-28 00:33:05 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 列出所有数据库和表? 2011-02-18 00:45:49 +0800 CST

热门标签

sql-server mysql postgresql sql-server-2014 sql-server-2016 oracle sql-server-2008 database-design query-performance sql-server-2017

Explore

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

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve