How to increase ulimit max open files, permanently?

I have a shell script that needs to be able to receive hundreds of incoming socket connections. The default max of open files is 256. Strangely, if I run:
sudo ulimit -n 800
...ulimit -a still shows just 256 max open files. If I become root (sudo su), then I can increase the max files to 800, but that setting only remains while I'm root user.
Anyone know how to increase the max open files setting for my regular user name, as I run scripts from the Terminal bash shell?
...Rene

Wow, within 2 minutes, I realized what I had to do, so in case anyone else wonders the same, here's the solutions:
Just edit the .bash_profile file in your home directory (create it if it's not already there), and add the line:
ulimit -n 1024
Now, whenever you start terminal, that process will be able to open up to 1024 files or socket connections.
...Rene

Similar Messages

  • Problem to increaase max open files to more than 1024

    Hello,
    I tried to increase the max open files to more than 1024 in the following way
    $ sudo nano /etc/security/limits.conf
    mysql hard nofile 8192
    mysql soft nofile 1200
    However, after reboot I am still not able to start MariaDB:
    $ sudo systemctl start mysqld
    Job for mysqld.service failed. See 'systemctl status mysqld.service' and 'journalctl -xn' for details.
    $ sudo systemctl status mysqld
    ● mysqld.service - MariaDB database server
    Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled)
    Active: activating (start-post) since Tue 2014-09-02 13:08:20 EST; 53s ago
    Main PID: 6504 (mysqld); : 6505 (mysqld-post)
    CGroup: /system.slice/mysqld.service
    ├─6504 /usr/bin/mysqld --pid-file=/run/mysqld/mysqld.pid
    └─control
    ├─6505 /bin/sh /usr/bin/mysqld-post
    └─6953 sleep 1
    Sep 02 13:08:20 acpfg mysqld[6504]: 140902 13:08:20 [Warning] Could not increase number of max_open_files to more than 1024 (request: 4607)
    I am using the following /etc/mysql/my.cnf
    [mysql]
    # CLIENT #
    port = 3306
    socket = /home/u/tmp/mysql/mysql.sock
    [mysqld]
    # GENERAL #
    user = mysql
    default-storage-engine = InnoDB
    socket = /home/u/tmp/mysql/mysql.sock
    pid-file = /home/u/tmp/mysql/mysql.pid
    # MyISAM #
    key-buffer-size = 32M
    myisam-recover = FORCE,BACKUP
    # SAFETY #
    max-allowed-packet = 16M
    max-connect-errors = 1000000
    skip-name-resolve
    sql-mode = STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ONLY_FULL_GROUP_BY
    sysdate-is-now = 1
    innodb = FORCE
    innodb-strict-mode = 1
    # DATA STORAGE #
    datadir = /home/u/tmp/mysql/
    # BINARY LOGGING #
    log-bin = /home/u/tmp/mysql/mysql-bin
    expire-logs-days = 14
    sync-binlog = 1
    # CACHES AND LIMITS #
    tmp-table-size = 32M
    max-heap-table-size = 32M
    query-cache-type = 0
    query-cache-size = 0
    max-connections = 500
    thread-cache-size = 50
    open-files-limit = 65535
    table-definition-cache = 1024
    table-open-cache = 2048
    # INNODB #
    innodb-flush-method = O_DIRECT
    innodb-log-files-in-group = 2
    innodb-log-file-size = 128M
    innodb-flush-log-at-trx-commit = 1
    innodb-file-per-table = 1
    innodb-buffer-pool-size = 2G
    # LOGGING #
    log-error = /home/u/tmp/mysql/mysql-error.log
    log-queries-not-using-indexes = 1
    slow-query-log = 1
    slow-query-log-file = /home/u/tmp/mysql/mysql-slow.log
    How is it possible to increase the number?
    Thank you in advance.

    Change/add in the my.ini file, under [mysqld]:
    max_allowed_packet=2048M
    Reference:
    * http://dev.mysql.com/doc/refman/5.5/en/ … wed_packet

  • Problems changing the max open files attribute (ulimit)

    I realised that I posted this message in the wrong section
    (newbie corner) but there is no way to delete a message
    so this was a duplicate of the one in Kernel & Hardware
    Issues
    Last edited by Rehto (2009-04-06 08:53:52)

    Rehto wrote:
    I'm trying to change the max open files by
    putting this line to /etc/security/limits.conf
    <username> hard nofile 4096
    but nothing changes ('ulimit -n' spits as 1024 as an answer).
    I did try to logout and log back in and reboot the
    system but no go
    set the soft limits first. smth like:
    <your_name> soft nofile 4096
    <your_name> hard nofile 4096
    ulimit always uses the soft resource limit first. hard limits kills the application then, if it goes mad.
    vlad
    ps: logout then login again...
    Last edited by DonVla (2009-04-06 11:25:56)

  • [SOLVED] Problems changing the max open files attribute (ulimit)

    I'm trying to change the max open files by
    putting this line to /etc/security/limits.conf
    <username> hard nofile 4096
    but nothing changes ('ulimit -n' spits as 1024 as an answer).
    I did try to logout and log back in and reboot the
    system but no go
    P.S. I also tried adding 'ulimit -n 4096' to ~/.bashrc
    but then I get:
    bash: ulimit: open files: cannot modify limit: Operation not permitted
    so should I add it to the global profile file
    (etc/profile right?) or to /root/.bashrc or what?
    Last edited by Rehto (2009-04-06 12:08:32)

    Rehto wrote:
    I'm trying to change the max open files by
    putting this line to /etc/security/limits.conf
    <username> hard nofile 4096
    but nothing changes ('ulimit -n' spits as 1024 as an answer).
    I did try to logout and log back in and reboot the
    system but no go
    set the soft limits first. smth like:
    <your_name> soft nofile 4096
    <your_name> hard nofile 4096
    ulimit always uses the soft resource limit first. hard limits kills the application then, if it goes mad.
    vlad
    ps: logout then login again...
    Last edited by DonVla (2009-04-06 11:25:56)

  • How to increase the number of files picked up by File adaptor

    Dear all,
    Can any one tell me how to increase the number of files picked up by File adapter.
    Pl post ASAP.
    Useful answers will be appreciated accordingly.
    Thanks,
    Srinivas

    Hi Srinivasa,
    there is no parameter for number of files to be picked..............if you have too many source files and you want to get them processed quickly, then you can specify a very small polling interval, then XI will pick your source files quickly..........but it will cause heavy load on the XI system which can lead to blockage of messages in queues........
    Regards,
    Rajeev Gupta

  • How to increase ulimit permanantly

    I have the following ulimit limits. The number 532 seems to be from kern.maxproc. But I have ~/.launchd.conf that sets maxproc to a larger value.
    ~$ ulimit -H -a
    core file size          (blocks, -c) unlimited
    data seg size           (kbytes, -d) unlimited
    file size               (blocks, -f) unlimited
    max locked memory       (kbytes, -l) unlimited
    max memory size         (kbytes, -m) unlimited
    open files                      (-n) unlimited
    pipe size            (512 bytes, -p) 1
    stack size              (kbytes, -s) 65532
    cpu time               (seconds, -t) unlimited
    max user processes              (-u) 532
    virtual memory          (kbytes, -v) unlimited
    ~$ ulimit -S -a
    core file size          (blocks, -c) 0
    data seg size           (kbytes, -d) unlimited
    file size               (blocks, -f) unlimited
    max locked memory       (kbytes, -l) unlimited
    max memory size         (kbytes, -m) unlimited
    open files                      (-n) 256
    pipe size            (512 bytes, -p) 1
    stack size              (kbytes, -s) 8192
    cpu time               (seconds, -t) unlimited
    max user processes              (-u) 266
    virtual memory          (kbytes, -v) unlimited
    ~$ echo $SHELL
    /bin/bash
    ~$ sysctl -a |grep 532
    kern.maxproc = 532
    kern.maxproc: 532
    ~$ cat ~/.launchd.conf
    limit maxproc 1024 1024
    I could run in my bashrc. But I still can not increase the hard limit.
    sudo sysctl -w kern.maxproc=1024
    sudo sysctl -w kern.maxprocperuid=1024
    Does anybody have a solution to this problem?

    You're not going to be able to alter system limits from a user-level settings file ;-)
    http://support.apple.com/kb/HT3854?locale=en_US
    http://support.apple.com/kb/HT4022

  • How to increase the per-process file descriptor limit for JDBC connection 15

    If I need JDBC connection more that 15, the only solution is increase the per-process file descriptor limit. But how to increase this limit? modify the oracle server or JDBC software?
    I'm using JDBC thin driver connect to Oracle 806 server.
    From JDBC faq:
    Is there any limit on number of connections for jdbc?
    No. As such JDBC drivers doesn't have any scalability restrictions by themselves.
    It may be it restricted by the no of 'processes' (in the init.ora file) on the server. However, now-a-days we do get questions that even when the no of processes is 30, we are not able to open more than 16 active JDBC-OCI connections when the JDK is running in the default (green) thread model. This is because the no. of per-process file descriptor limit exceeded. It is important to note that depending on whether you are using OCI or THIN, or Green Vs Native, a JDBC sql connection can consume any where from 1-4 file descriptors. The solution is to increase the per-process file descriptor limit.
    null

    maybe it is OS issue, but the suggestion solution is from Oracle document. However, it is not provide a clear enough solution, just state "The solution is to increase the per-process file descriptor limit"
    Now I know the solution, but not know how to increase it.....
    pls help.

  • How to increase the Max. No. of connections(Sessions) & Processes in DB?

    Hi,
    What are all the options to increase the Max. No. of connections(Sessions) & Processes in Database?
    Also, I would like to know How we have to validate the count to fix the No. of connections based on the Database Health?
    Kindly clarify me on this.
    Thanks,
    Orahar.

    Orahar wrote:
    Hi,
    What are all the options to increase the Max. No. of connections(Sessions) & Processes in Database?Set PROCESSES parameter. SESSIONS is a derived parameter.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/initparams169.htm#i1132608
    Also, I would like to know How we have to validate the count to fix the No. of connections based on the Database Health?Check v$license.SESSIONS_HIGHWATER value. That would give you an indication of highest possible load on the database. In case of a brand new setup (with no information about the number of concurrent users), you need to start with a reasonable value and revise if needed.

  • (Need Help) how to clear the recently opened file list on Flash Player 11?

    excuse me pals, may i ask how to clear recently opened file list under "File" tab on Flash Player 11 (the standalone player) ? i've tried to browse my registry but i can't find the solution (and i can't find the .mru files containg the list). my OS is Windows 7 32bit, i hope i can find solution here

    I found it in the Windows registry under HKCU\Software\Macromedia\FlashPlayer

  • Developer: How can I let people open files with my program?

    Hello Everyone,
    I just finished my program for the Mac, and decided to make it an application.
    I used Platypus to make my program into an application. Unfortunately when I try to open a file with my program (control + click on file + open with -> other), my application is grayed out and I can't select it. I see it there along with the other applications but I can't select it like I can Mail or TextEdit.
    I read somewhere I had to use XCode to let people open files with my program but I have never used XCode and I have no idea how to do that. Any help would be appreciated.
    Thanks,
    Nick

    You've posted in the wrong forum. This is the OS X Leopard Installation and Setup forum. You need to post your problem in the Developers forum. Also, since Platypus is not an Apple product, you should visit it's developers forum for assistance. The Apple Discussions is intended to assist users with problems and questions about Apple products only.
    To use XCode Tools you need to install it from the Optional Installs folder on your OS X Installer Disc One. It comes with documentation. More assistance can be found at developer.apple.com.

  • How to view thumbnails of open files in elements 12?

    For some reason i cannot figure out how to see my open files as thumbs when editing in elements 12. I am sure it is something i am overlooking. thanks for the help.

    Click where it says Photo Bin at the bottom left of the editor window. As part of Adobe's way of making PSE "easier" to use, you can't see the tool options and the photo thumbnails at the same time anymore.

  • How can I use the "open file" alarm on an iPhone?

    In the iCal program on a Mac, I can set an alarm to open a webpage at a specified time each morning automatically by using the "open file" feature in iCal and using a .webloc file for the URL.  However, the event, when synced through iCloud, does not open the webpage on my iPhone.  Is there a way for me to use the "open file" feature on my iPhone?
    If not by using the "open file" feature, is there a way (through an app or other setting) for me to open a website or a program at a specified time each morning?  Thanks!

    timl006 wrote:
    Hi all,
    I have an iPhone 4, running the latest IOS 4.x revision.  Like many of you, I have installed 3rd party apps to replace the existing default apps from Apple in order to get improved functionality.  Chief among them is the calendar app "Week Cal".  I had already switched to my various Google calendars for my appointments exclusively.  I then made my principal Google calendar my default calendar on both my iPhone and iCal on my Mac.
    The problem is that even though I deleted all local calendars on my mac and told the default iPhone Calendar app to hide all calendars, occasionally it somehow "finds" my Google calendar. Once found, the Calendar app is the one that pops up upon calendar alerts and not Week Cal.  The switch does not seem to be linked to syncing.
    Question #1:  How can I tell my iPhone what my default apps are?  Do I need to do something on my Mac as well?
    I'm guessing that Week Cal has some sort of setting that you use to point it to your calendar, yes?
    If so:
    #1 make sure that Sync iCal Calendars is unchecked in iTunes.
    #2 on your iPhone... Settings > Mail, Contacts, Calendars > turn OFF Calendars for all accounts.
    Now the iOS should no be looking to make contact with any data for Calendar.

  • How to increase number of data files parameter

    Dear All,
    I am facing problem in increasing number of data files associated with the DB. I have DB_FILES = 200 and want to set it to 300. DB was started with SPFILE.
    Tell me how to increase this parameter. I dont want to stop DB also. I will be thankful if anyone guide me in both ways to stop DB and without stopping it.
    Regards
    Aqeel Nawaz

    Madrid,
    Please don't take it as nit-picking.Just wanted to point an enhancement in 10g regarding recreating control file for increasing number of datafiles.I am sure you must be aware about it.
    Please see this link and this note,
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/dfiles.htm#sthref1340
    When you issue CREATE DATABASE or CREATE CONTROLFILE statements, the MAXDATAFILES parameter specifies an initial size of the datafile portion of the control file. However, if you attempt to add a new file whose number is greater than MAXDATAFILES, but less than or equal to DB_FILES, the control file will expand automatically so that the datafiles section can accommodate more files.
    From 10g onwards,the requirement to recreate teh control file is lifted.
    Please correct me if I interpreted the note in a wrong way.
    Regards
    Aman....

  • Easy question - how to increase number of recent files in menu?

    This is for CS5 if it matters.
    I'm an infrequent Illustrator user (at best) but I have what I hope is an easy question: I want to increase number of recent files showing in the menu.
    I can't find a preferece to set such as in PS and almost every other application on the face of the earth. I've tried to reset the preferences file (start Illustrator with ctrl-alt-shift held down) but I'm stuck at 4 files, which I assume is the anemic default option.
    Is there an easy way to do this that Adobe has hidded somewhere? As expected, it can't be found in the help, I can't find it on the forums, or even on the net, but I do know it can be done because I can see other installs showing lots of files in the list.
    thanks for any help.

    This might be because of a new feature that you can turn off for each object, and alltogether. When you create a new document at the bottom, make sure 'Align New Objects to Pixel Grid' is unchecked.  After you have created a new file, you can still go into the 'TRANSFORM' palette (SHIFT+8), use the little right top menu, and make sure 'Align New Objects to Pixel Grid' is unchecked. And if you want to get fancy with each object; you can select an object, and look at the 'TRANSFORM' palette at the bottom is a place to uncheck the 'Align to Pixel Grid' at your disposall.
    Before I found this, it ruined my week.
    http://www.kenwells.com

  • How to increase number of recent files in menu?

    How do you increase the number of recent files in Open Recent menu?
    Thanks

    Paul Ferguson wrote:
    Charles: Right now, there are as many rows as there are entries, but only three are visible so I have to scroll the list to see all twelve in my case.  Would it be possible to simply grab the window and increase its size so that more rows were visible, in the same way that you can with the entire Plugin Manager window?
    To automatically increase the size of the list of folders while also automatically increasing the size of the list of plug-ins is actually a fair amount of work to refactor.  Our research shows that the vast majority of people just have the default two folders.  However, how would you feel about 5 rows of folders as a compromise?

Maybe you are looking for