我正在使用 MariaDB(10.1.21) 和以下存储引擎:
系统配置是:
我尝试使用pt-mysql-summary工具来识别内存使用情况,当服务器上没有进程运行时,它显示 innodb 缓冲池大小的 90% 已被填充。
我还尝试重新启动 MariaDB 服务器,这只会减少大约 1-2 小时的内存,之后就会耗尽内存。
知道为什么它消耗太多内存吗?
下面分享我的配置:
我的cnf
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
# Here is entries for some specific programs
# The following values assume you have at least 32M ram
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
#performance_schema=ON
tmp_table_size=16M
max_heap_table_size=16M
skip-log-bin
#table_open_cache =16384
#table_definition_cache =16384
#
# …Run Code Online (Sandbox Code Playgroud) MySQL抛出管道中断,MySQL服务器消失了错误。我的数据库表包含文本字段,我每隔1小时就会在其中插入大HTML。
我应该考虑设置哪个MySQL变量。
这是当前配置:
[mysqld]
datadir=/home/monk/mysql
socket=/home/monk/mysql/mysql.sock
user=mysql
default_time_zone='+06:00'
innodb_buffer_pool_size=35G
innodb_buffer_pool_instances=15
query_cache_type=ON
query_cache_size=64M
join_buffer_size=524288
tmp_table_size=32M
max_heap_table_size=32M
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
max_allowed_packet=1G
# Recommended in standard MySQL setup
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
wait_timeout = 2000
interactive_timeout = 2000
#bind-address=127.0.0.1
##skip-networking~
Run Code Online (Sandbox Code Playgroud) 我无法解决此查询问题,以获取两个处于OFF状态的两个不同IP地址的公共持续时间.
以下示例数据中的案例
1(简单情况) - 对于00:10:10到00:20:00,IP地址"10.0.1.2"保持为OFF,并且在此持续时间内"10.0.1.3"也为OFF,因此两者的共同持续时间为OFF 00:10:10到00:20:00
2(有问题) - IP地址"10.0.1.2"在13:00:00到13:25:00关闭,如果用其他IP地址检查,在12:55:00到13:20关闭: 00.因此,两者的共同持续时间为13:00:00至13:20:00.
样本数据:
ID IP address Status Time
----------------------------------
1 10.0.1.2 OFF 00:10:00
1 10.0.1.2 ON 00:20:00
1 10.0.1.2 OFF 11:00:00
1 10.0.1.2 ON 11:20:00
1 10.0.1.2 OFF 13:00:00
1 10.0.1.2 ON 13:25:00
1 10.0.1.2 OFF 14:05:00
1 10.0.1.2 ON 14:10:00
1 10.0.1.2 OFF 15:35:00
1 10.0.1.2 ON 15:45:00
1 10.0.1.3 OFF 00:10:00
1 10.0.1.3 ON 00:20:00
1 10.0.1.3 OFF 11:05:00
1 10.0.1.3 ON 11:25:00
1 10.0.1.3 OFF 12:55:00
1 10.0.1.3 ON …Run Code Online (Sandbox Code Playgroud) 我有一个表列,其中包含以下文本数据:
"drop table log_history_2_2015"
"drop table log_history_3_2015"
"drop table log_history_4_2015"
"drop table log_history_5_2015"
"drop table log_history_6_2015"
Run Code Online (Sandbox Code Playgroud)
如何单次执行它们而不循环遍历所有这些行并单独执行它们。
我尝试根据 SQLite 站点上提供的文档创建一个可共享的内存数据库。但我最终找到了解决问题的方法。
var connectionString = "Data Source=sharedmemdb;Mode=Memory;Cache=Shared";
using (var connection1 = new SQLiteConnection(connectionString))
{
connection1.Open();
var command1 = connection1.CreateCommand();
command1.CommandText =
"CREATE TABLE Message ( Text TEXT );" +
"INSERT INTO Message ( Text ) VALUES ( 'Is there anybody out there?' );";
command1.ExecuteNonQuery();
using (var connection2 = new SQLiteConnection(connectionString))
{
connection2.Open();
var command2 = connection2.CreateCommand();
command2.CommandText = "SELECT Text FROM Message;";
var message = command2.ExecuteScalar() as string;
}
}
Run Code Online (Sandbox Code Playgroud)
如果我执行此代码,它将创建名为 sharedmemdb 的内存数据库,并在建立连接时启用共享缓存,因此其他连接也可以访问此连接。如果我第一次运行这很好,但是如果我关闭应用程序并再次运行它会抛出错误“表消息已经存在”,这看起来很奇怪,因为我在内存中创建了表,如果应用程序重新启动,这应该不可用.
收到此错误后,我查看了应用程序目录并找到了文件“sharedmemdb”,这意味着 SQLite 没有创建可共享的内存数据库。
任何线索为什么会发生这种情况?
移动命令using …
我有下面的HTML
<ul id="tabStripSecondaryElements" class="k-tabstrip-items k-reset" data-role="tabstrip" style="margin-left: 37px; margin-right: 40px;" role="tablist" aria-activedescendant="tab_0">
<li class="k-item tabClick k-state-default k-first" id="tab_1" value="1" role="tab" aria-controls="tabStripSecondaryElements-1"><span class="k-loading k-complete"></span><span unselectable="on" class="k-link"> Automobile <span class="fa fa-ellipsis-v"></span></span></li>
<li class="k-item tabClick k-state-default" id="tab_3" value="3" role="tab" aria-controls="tabStripSecondaryElements-2"><span class="k-loading k-complete"></span><span unselectable="on" class="k-link"> Router <span class="fa fa-ellipsis-v"></span></span></li>
<li class="k-item tabClick k-state-default" id="tab_4" value="4" role="tab" aria-controls="tabStripSecondaryElements-3"><span class="k-loading k-complete"></span><span unselectable="on" class="k-link"> Smart City Sensor <span class="fa fa-ellipsis-v"></span></span></li>
<li class="k-item tabClick k-state-default" id="tab_5" value="5" role="tab" aria-controls="tabStripSecondaryElements-4"><span class="k-loading k-complete"></span><span unselectable="on" class="k-link"> ZigBee Power Cable <span class="fa fa-ellipsis-v"></span></span></li>
<li class="k-item tabClick …Run Code Online (Sandbox Code Playgroud) 我正在尝试制作应用程序的布局,其中主容器将具有设备高度的 45%,并且主容器内的容器应具有固定大小。
我编写了以下代码,但内部容器将完整高度作为其父(主)容器。
class TestContainer extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
width: 50,
height:MediaQuery.of(context).size.height * 0.45,
color: Colors.red
child:Container(
width: 50,
height: 100,
color: Colors.green
)
);
}
}
Run Code Online (Sandbox Code Playgroud)
知道我做错了什么吗?
尝试找到问题需要5个小时,但无法确定循环for fn in L运行无限的原因.
L=[]
N=int(raw_input())
for i in range(0,N):
L.append(list(raw_input().split()))
print L
for fn in L:
if 'insert'==fn[0]:
L.insert(int(fn[1]),int(fn[2]))
elif 'append'==fn[0]:
L.append(int(fn[1]))
elif 'remove'==fn[0]:
L.remove(int(fn[1]))
elif 'pop'==fn[0]:
L.pop(int(fn[1]))
elif 'index'==fn[0]:
L.index(int(fn[1]))
elif 'count'==fn[0]:
L.count(int(fn[1]))
elif 'sort'==fn[0]:
L.sort()
elif 'reverse'==fn[0]:
L.reverse()
else :
print L
Run Code Online (Sandbox Code Playgroud)
提供给列表的输入:
12
insert 0 5
insert 1 10
insert 0 6
print
remove 6
append 9
append 1
sort
print
pop
reverse
print
Run Code Online (Sandbox Code Playgroud)