# Elasticsearch 7 and FreeBSD 12.1 openfiles limit (Jail)



## brianjm (Sep 23, 2020)

I am trying to install and set up elasticsearch 7 in an iocage jail. I get an error when trying to run elasticsearch:

`[1]: max file descriptors [16384] for elasticsearch process is too low, increase to at least [65535]`

I have tried to increase the max file limit of the jail to 65536 by doing `sysctl kern.maxfiles=65536` and adding it to the `/etc/sysct.conf` file but I get an error saying the operation isn't supported. I also read that I can further tune the settings of the jail by adding `kern.racct.enabled="1"` to `/boot/loader.conf`. I haven't added this line yet because I couldn't find any info on the parameter and was a little hesitant to modify the loader.conf file without fully understanding what I was doing. 

Is there a way to increase the file limit of the jail? Do I need to increase the file limit on the host system first? 

Thanks.

System info:
Host OS: 12.1-RELEASE
Jail OS: 12.1-RELEASE-p5
Elasticsearch v 7.7.1 (installed from packages)

output of `limit`(from within the jail):
`root@elasticsearch:~ # limit
cputime      unlimited
filesize     unlimited
datasize     33554432 kbytes
stacksize    524288 kbytes
coredumpsize unlimited
memoryuse    unlimited
vmemoryuse   unlimited
descriptors  16384
pseudoterminaunlimited
kqueues      unlimited
memorylocked unlimited
maxproc      30430
sbsize       unlimited
swapsize     unlimited`

output of `limit`(from the host server):
`brian@server:~ % limit
cputime      unlimited
filesize     unlimited
datasize     33554432 kbytes
stacksize    524288 kbytes
coredumpsize unlimited
memoryuse    unlimited
vmemoryuse   unlimited
descriptors  16384
pseudoterminaunlimited
kqueues      unlimited
memorylocked 64 kbytes
maxproc      30430
sbsize       unlimited
swapsize     unlimited`


----------



## suntzu00 (Sep 24, 2020)

you can only increase `kern.maxfiles` from the host. you can tune it further per jail with rctl. 
	
	



```
kern.racct.enabled="1"
```
 goes on the /boot/loader.conf on the host as well.


----------



## brianjm (Sep 24, 2020)

suntzu00 said:


> you can only increase `kern.maxfiles` from the host. you can tune it further per jail with rctl.
> 
> 
> 
> ...



Does `kern.maxfiles` go in sysctl.conf or loader.conf? I saw that some people were doing it in both places when I searched online. 

And is it `kern.racct.enable` or `enabled`? In the docs for Resource Limits (section 13.13.2) it says 'kern.racct.enable'.


----------



## suntzu00 (Sep 24, 2020)

it's 
	
	



```
kern.racct.enable="1"
```
usually the read-only sysctl variables go into /boot/loader.conf although looking at /boot/defaults/loader.conf you'll see this entry 
	
	



```
#kern.maxfiles=""               # Set the sys. wide open files limit
```


----------



## brianjm (Sep 25, 2020)

suntzu00 said:


> it's
> 
> 
> 
> ...



Okay, Thanks I'll try these out and see how they work.


----------

