Adjust file descriptor limit when systemd is used
Change-Id: I083c60d28904e6a6eeebd36ed114df06d83072a6 Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
parent
81d23ffe59
commit
21aaa7cc4f
@ -53,3 +53,8 @@
|
||||
until: galera_restart_fall_back | success
|
||||
retries: 3
|
||||
delay: 5
|
||||
|
||||
- name: Reload the systemd daemon
|
||||
command: "systemctl daemon-reload"
|
||||
when:
|
||||
- pid1_name == "systemd"
|
||||
|
@ -68,14 +68,54 @@
|
||||
tags:
|
||||
- galera-config
|
||||
|
||||
# NOTE: (mancdaz) The target will need to change to /etc/default/mariadb
|
||||
# for mariadb-10.1
|
||||
- name: Drop mariadb config(s)
|
||||
- name: Drop limits config (upstart)
|
||||
template:
|
||||
src: "upstart.limits.conf.j2"
|
||||
dest: "/etc/security/limits.conf"
|
||||
when:
|
||||
- pid1_name != "systemd"
|
||||
notify:
|
||||
- Restart mysql
|
||||
tags:
|
||||
- galera-config
|
||||
|
||||
# NOTE: (mancdaz) REMOVE "/etc/default/mysql" when running MariaDB 10.1
|
||||
- name: Apply resource limits (upstart)
|
||||
template:
|
||||
src: "mysql_defaults.j2"
|
||||
dest: "/etc/default/mysql"
|
||||
dest: "{{ item }}"
|
||||
mode: "0644"
|
||||
notify: Restart mysql
|
||||
with_items:
|
||||
- /etc/default/mysql
|
||||
- /etc/default/mariadb
|
||||
when:
|
||||
- ansible_pkg_mgr == 'apt'
|
||||
- pid1_name != "systemd"
|
||||
notify:
|
||||
- Restart mysql
|
||||
tags:
|
||||
- galera-config
|
||||
|
||||
- name: Create mariadb systemd service config dir
|
||||
file:
|
||||
path: "/etc/systemd/system/mariadb.service.d"
|
||||
state: "directory"
|
||||
group: "root"
|
||||
owner: "root"
|
||||
mode: "0755"
|
||||
when:
|
||||
- pid1_name == "systemd"
|
||||
|
||||
- name: Apply resource limits (systemd)
|
||||
template:
|
||||
src: "systemd.limits.conf.j2"
|
||||
dest: "/etc/systemd/system/mariadb.service.d/limits.conf"
|
||||
mode: "0644"
|
||||
when:
|
||||
- pid1_name == "systemd"
|
||||
notify:
|
||||
- Reload the systemd daemon
|
||||
- Restart mysql
|
||||
tags:
|
||||
- galera-config
|
||||
|
||||
|
@ -41,11 +41,3 @@
|
||||
when: not use_percona_upstream | bool
|
||||
tags:
|
||||
- percona-apt-packages
|
||||
|
||||
- name: Drop limits config
|
||||
template:
|
||||
src: "limits.conf.j2"
|
||||
dest: "/etc/security/limits.conf"
|
||||
notify: Restart mysql
|
||||
tags:
|
||||
- galera-config
|
||||
|
@ -35,6 +35,18 @@
|
||||
tags:
|
||||
- always
|
||||
|
||||
- name: Check init system
|
||||
command: cat /proc/1/comm
|
||||
register: _pid1_name
|
||||
tags:
|
||||
- always
|
||||
|
||||
- name: Set the name of pid1
|
||||
set_fact:
|
||||
pid1_name: "{{ _pid1_name.stdout }}"
|
||||
tags:
|
||||
- always
|
||||
|
||||
- include: galera_upgrade_check.yml
|
||||
- include: galera_cluster_state.yml
|
||||
- include: galera_pre_install.yml
|
||||
|
12
templates/systemd.limits.conf.j2
Normal file
12
templates/systemd.limits.conf.j2
Normal file
@ -0,0 +1,12 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
{%- set all_calculated_max_connections = [] %}
|
||||
{%- for galera_node in galera_cluster_members %}
|
||||
{%- set _ = all_calculated_max_connections.append((hostvars[galera_node]['ansible_processor_vcpus'] | int > 0) | ternary (ansible_processor_vcpus, 2) * 100) %}
|
||||
{%- endfor %}
|
||||
{%- set calculated_min_connections = all_calculated_max_connections | min %}
|
||||
{%- set calculated_max_connections = galera_max_connections | default(calculated_min_connections) %}
|
||||
|
||||
[Service]
|
||||
LimitNOFILE={{ calculated_max_connections }}
|
||||
|
Loading…
x
Reference in New Issue
Block a user