Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaces bash with file resource to adjust file descriptor limits via limits.d #118

Closed
wants to merge 1 commit into from
Closed

Replaces bash with file resource to adjust file descriptor limits via limits.d #118

wants to merge 1 commit into from

Conversation

ctrabold
Copy link

While reading the recommendations found here I thought that it would be a good idea to use limits.d instead of hacking the limits.conf file directly.

This way Chef handles the idempotency itself and we can drop the custom (and hard to read) not_if magic.

The result is the following file:

# cat /etc/security/limits.d/10-elasticsearch.conf
elasticsearch     -    nofile    4000
elasticsearch     -    memlock   unlimited

Tested on Vagrant with Debian 6 by removing the two lines from /etc/security/limits.conf and restarting the machine.

Calling ulimit -Hn showed the expected value.

While reading the recommendations found [here](http://asquera.de/opensource/2012/11/25/elasticsearch-pre-flight-checklist/#file-descriptors)
I thought that it would be a good idea to use `limits.d` instead of hacking the `limits.conf` file directly.

This way Chef handles the idempotency itself and we can drop the custom (and hard to read) `not_if` magic.

The result is the following file:

    # cat /etc/security/limits.d/10-elasticsearch.conf
    elasticsearch     -    nofile    4000
    elasticsearch     -    memlock   unlimited

Tested on Vagrant with Debian 6 by removing the two lines from `/etc/security/limits.conf` and restarting the machine.

Calling `ulimit -Hn` showed the expected value.
@chrisroberts
Copy link

#103 does this as well but uses a source'd file via the init script to deal where the limits.d may not be available.

@karmi karmi closed this in 3043d7d Aug 1, 2013
karmi added a commit that referenced this pull request Aug 1, 2013
Refactoring the way we set limits on the system:

* Use separate file in `/etc/limits.d/`
* Run `ulimit` in the init script defensively

Related issues: #118, #109, #103
@karmi
Copy link
Contributor

karmi commented Aug 1, 2013

I've created a mashup of @chrisroberts' and @ctrabold's versions, so now we have a sane approach to /etc/security/limits.* and run ulimit in the init script to be on the defensive. Thanks for writing and testing the code!

thoughtcroft pushed a commit to ninefold/chef-elasticsearch that referenced this pull request Jan 30, 2015
While reading the recommendations found [here](http://asquera.de/opensource/2012/11/25/elasticsearch-pre-flight-checklist/#file-descriptors)
I thought that it would be a good idea to use `limits.d` instead of hacking the `limits.conf` file directly.

This way Chef handles the idempotency itself and we can drop the custom (and hard to read) `not_if` magic.

The "chef-ulimit" cookbook uses the same approach: https://github.com/bmhatfield/chef-ulimit/blob/master/definitions/user_ulimit.rb#L13

Tested on Vagrant with Debian 6 and Ubuntu Precise.

Closes sous-chefs#101
Closes sous-chefs#118

Fixes sous-chefs#102
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants