2016-08-20 13 views
0

ドッキング・コンテナ「mysql 5.6」をAWS EC2にホストして、max_connectionsを1024に増やしたいとします。 EC2のインスタンスタイプはm4.largeです。ドッキング・コンテナのmysql max_connectionsを1024に増やす

私はmy.cnfmax_connections=1024を追加することによって、1024年にMAX_CONNECTIONSを設定しましたが、show varialbes like 'max_connections'; mysqlコマンドを入力するとき、私は214を見ました。ここで私が持っている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 ?で述べた解決策を試してみました。しかし、これは私の場合は機能しません。以下は私の設定です:

#<domain>  <type> <item>   <value> 
* soft nofile 65536 
* hard nofile 65536 
* soft nproc 100000 
* hard nproc 127466 

limits.confを

共通セッション

# 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 

私はまた、溶液hereを試してみました。

[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 

mysql.serviceは、このソリューションでは、どちらか私のために動作しません。

私はECSのタスク定義にmountPointsvolumesを使用してドッキングウィンドウコンテナにホストマシンから上記のファイルを渡します。ここで

は私のECSのタスク定義のマウントポイントとボリュームです:max_connectionsが1024に到達できるように

"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" 
} 
], 

は、私は他に何ができますか?

私のドッカーコンテナーの詳細を知りたい場合は、私に知らせてください。

答えて

0

最後に、--ulimit nofile=65536:65536を追加すると私の問題が解決されます。

オプションの最初の65536はソフトリミットを表し、2番目の65536はハードリミットを表します。アマゾンECSタスク定義については

0

これはで行うことができます。

[CMD Parameters Resource Limits

関連する問題