- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想在 mysql 5.6 的 docker 容器中将 max_connections
增加到 1024|托管于 AWS EC2 . EC2的实例类型是m4.large
。
我通过在 my.cnf
中添加 max_connections=1024
将 max_connections 设置为 1024,但在键入 show varialbes like 'max_connections' 时我只看到 214 ;
mysql命令。这是我的my.cnf
:
my.cnf
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
[mysqld_safe]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
skip-host-cache
skip-name-resolve
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
explicit_defaults_for_timestamp
max_connections=1024
max_connect_errors=100000
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address = 127.0.0.1
#log-error = /var/log/mysql/error.log
# Recommended in standard MySQL setup
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/
我已经尝试了 MySQL Max_connections stuck on 214 ? 中提到的解决方案.但是这个在我的情况下不起作用。以下是我的设置:
共同 session
# here are the per-package modules (the "Primary" block)
session [default=1] pam_permit.so
# here's the fallback if no module succeeds
session requisite pam_deny.so
# prime the stack with a positive return value if there isn't one already;
# this avoids us returning an error just because nothing sets a success code
# since the modules above will each just jump around
session required pam_permit.so
# and here are more per-package modules (the "Additional" block)
session required pam_unix.so
session required pam_limits.so
# end of pam-auth-update config
limits.conf
#<domain> <type> <item> <value>
* soft nofile 65536
* hard nofile 65536
* soft nproc 100000
* hard nproc 127466
我也尝试过解决方案 here .
mysql.service
[Unit]
Description=MySQL Community Server
After=network.target
[Install]
WantedBy=multi-user.target
[Service]
User=mysql
Group=mysql
PermissionsStartOnly=true
ExecStartPre=/usr/share/mysql/mysql-systemd-start pre
ExecStart=/usr/bin/mysqld_safe
ExecStartPost=/usr/share/mysql/mysql-systemd-start post
TimeoutSec=600
Restart=on-failure
LimitNOFILE=infinity
LimitMEMLOCK=infinity
这个解决方案也不适合我。
我通过在 ECS 的任务定义中使用 mountPoints
和 volumes
将上述文件从主机传递到 docker 容器中。
这是我的 ECS 任务定义的挂载点和卷:
"mountPoints": [
{
"containerPath": "/docker-entrypoint-initdb.d/user.sql",
"sourceVolume": "user",
"readOnly": true
},
{
"containerPath": "/etc/mysql/my.cnf",
"sourceVolume": "mysql_config",
"readOnly": false
},
{
"containerPath": "/etc/security/limits.conf",
"sourceVolume": "limits_conf",
"readOnly": null
},
{
"containerPath": "/etc/systemd/system/mysql.service",
"sourceVolume": "mysql_service",
"readOnly": null
},
{
"containerPath": "/etc/pam.d/common-session",
"sourceVolume": "common_session",
"readOnly": null
}
],
"volumes": [
{
"host": {
"sourcePath": "/home/docker/mysql/user.sql"
},
"name": "user"
},
{
"host": {
"sourcePath": "/home/docker/mysql/my.cnf"
},
"name": "mysql_config"
},
{
"host": {
"sourcePath": "/home/docker/mysql/limits.conf"
},
"name": "limits_conf"
},
{
"host": {
"sourcePath": "/home/docker/mysql/mysql.service"
},
"name": "mysql_service"
},
{
"host": {
"sourcePath": "/home/docker/mysql/common-session"
},
"name": "common_session"
}
],
我还能做什么才能使 max_connections
达到 1024?
如果您需要了解我的 docker 容器的更多信息,请告诉我。
最佳答案
最后,我发现添加 --ulimit nofile=65536:65536
解决了我的问题。
选项中第一个65536代表软限制,第二个65536代表硬限制。
关于mysql - 在 docker 容器中将 mysql max_connections 增加到 1024,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39054410/
我的小公司已构建并托管了 300 多个网站。只选择了少数,由于 max_connections 设置太低,实际上有 2 或 3 个无法加载。我的问题是, max_connections 是基于每个页面
我正在尝试为共享主机上所需的 MySQL 和资源设置理想的性能设置。 我的问题是,max_connections 的真正含义是什么? 是向服务器发出的唯一并发请求数吗?因此,如果有两个用户,1 个打开
在 mysql 中,如何强制执行 max_connections 变量?也就是说,我的问题是——当达到最大连接数时——(a) 新连接是否被拒绝,或者 (b) mysql 会首先尝试关闭旧连接和/或空闲
我有一个多线程进程,其中 36 个线程随机写入数据库,平均每 10 秒一次,每个线程有 99% 的空闲时间( sleep )。 我不确定这是否意味着我有 36 个事件连接,或者实际上只有一两个,因为每
如何将变量 max_connection 更改为高于 214 的值。我在 my.cnf 上尝试了这个,但不起作用 max_connections = 2000 MySql的版本是5.6.24,我已经重
我已经设置max_connections=2000在/etc/my.conf并重新启动mysqld 但仍然max_connections似乎被困在 412 mysql> SHOW VARIABLES
我的简单问题:如何增加我的 Amazon RDS 数据库的可能连接数?我在我设置的地方使用了一个参数组 max_connections = 30000 这似乎是第一手的工作,因为 SHOW VARIA
在 MySQL 上,有什么理由不将 max_connections 设置为最大值 (100000)? 这种方法的副作用是什么? 最佳答案 来自docs:- Too many connections :
我的 postgres 服务器限制在 100 个 max_connections 上,并且在应用程序大量使用的某个时刻达到了限制,所以我尝试增加该数量并且当我尝试重新启动 postgres 时,不会启
我刚刚安装了 apache 2.2.3 并且已经出现“太多连接”的错误。我去 my.cnf 增加 max_connections 但它不存在! 里面唯一的内容是: [mysqld] datadir=/
我想知道在阅读世界场景中,连接池大小是否有意义!= max_connections ? 最佳答案 连接池大小 是始终可用连接的大小,而max connections 是最大连接数。 彻底地,当 max
我正在使用带有 Sequelize 的 Postgres作为 ORM/查询接口(interface)。最近我们开始遇到一些错误: SequelizeConnectionError: remaining
使用Varnish 3.0.4,我们看到了很多backend_busy,但是在任何后端中都没有设置max_connection设置。 我试图找出原因,因为似乎某些客户端请求被中止了。 什么会导致bac
我们在创建 MySQL 连接、查询然后关闭连接(通过 PHP)的页面上使用 ab (apachebench) 对我们的一个网站进行基准测试。 我们对 my.cnf 进行了硬编码,最大连接数限制为 50
我有一个指向 MySQL 5.7 的应用程序,它在启动时需要的不仅仅是默认的 MySQL max_connections(151)。但是,它会在服务器启动几分钟后逐渐减少(大约 20 个连接)。因此,
遗憾的是,我在任何地方都找不到对此查询的任何直接解释,甚至在 MySQL 文档中也找不到。 各种论坛上有人说 max_user_connections 永远不能大于 max_connections?例
我在 Linux Centos 上使用 MySQL 5.1.35 数据库。 Linux 服务器有 2GB RAM 和 14GB 磁盘空间。 我使用 Java 中的 ReSTLet 框架创建了网络服务,
我有一个服务器,很多用户都会连接到它并在那里使用数据库,而我正在使用 MySQL。我知道 MySQL 中 max_connections 的默认数量是 100 或 150,但我确信我需要超出该数量,因
MySQL 数据库的每个套接字的默认连接数为 100,但我正在寻找任何方法来增加 MySQL 数据库的套接字连接的可能连接数 > 100。 最佳答案 如果您需要在不重启 MySQL 的情况下增加 My
我正在使用这个网站分析工具:Umami 我目前正在查看 postgresql.conf文件,我看到 max_connections设置为 100。 在高峰期,我的网站可能有 1000 并发用户。 Po
我是一名优秀的程序员,十分优秀!