os x 终端、ssh 和太多打开的文件 [英] Os x terminal, ssh , and too many open files

查看:31
本文介绍了os x 终端、ssh 和太多打开的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些代码通过 ssh 转发到 AWS 机器的连接运行多个其余查询(仅供参考:这些查询正在访问在这台机器上运行的 Solr 服务器),并且查询针对我的本地主机运行(它被转发到 AWS 实例).

I have some code that runs several rest queries over a connection that is ssh forwarded to an AWS machine (fyi: these queries are hitting a Solr server running on this machine), and the queries run against my localhost (which is forwarded to the AWS instance).

该代码最初运行良好,可根据需要获取数据,但运行一段时间后,代码停止运行(在 eclipse 中).

The code initially runs great getting data as necessary, but after running for a while, the code stalls (in eclipse).

此时,终端(即我开始 ssh 隧道的地方)完全冻结,并填满了字符串:

接受:打开的文件太多"

"accept : too many open files"

因为这个无限打印与 bash 终端无关(即我无法判断 ssh 连接是否仍然存在,并且没有文字表明我在哪个 shell 中......只是无耻的、无情的打印语句) 我分不清是来自亚马逊还是来自我的客户端.

Because this infinite print is not associated with a bash terminal (i.e. I can't tell wether the ssh connection is still alive or not, and there is no text indicating which shell im in... just unpridled, relentless print statements) I cant tell wether it's coming from amazon, or from my client terminal.

我想找到这种行为的原因并查明导致我的终端爆炸的机器

为了测试两台机器中的哪一台导致了错误的无限打印,我在服务器上运行了 ulimit 命令......并发现允许的最大打开文件数(在 aws 服务器上)远高于客户端程序(从我的 ide 运行)执行时的任何给定时间打开的文件数量(也使用 ulimit 确定).

To test which of the two machines was causing the infinite print outs of the error, I ran the ulimit command on the server... and found that the max number of open files allowed (on the aws server) was well above the amount of open files (also determined using ulimit) at any given time while the client program (running from my ide) is executing.

我对我的客户端做了同样的测试,发现打开的文件数量没有明显增加.

I did the same test on my client , and found no significant increase in the number of open files.

一些侧面细节:我正在一个 SOLR 服务器上运行数百个查询,该服务器在短时间内拥有超过 100GB 的数据.

Some side details : I'm running several hundreds of queries into a SOLR server that has over 100GB of data in a short time period.

关于如何确定我的 sshd mac os x 终端为什么会死机并无限打印此消息的任何提示可能对我非常有用.当然,无论它们是否特定于 solr.也就是说,任何有关使用 solr 服务时为什么会发生这种情况的见解也可能有助于解决此问题.

Any hints on how to determine why my sshd mac os x terminal is dying and infinitely printing this message would be potentially very useful to me. Of course, wether or not they were specific to solr. That said, any insights into why this would happen when using a solr service may also help to solve this problem.

推荐答案

你可以试试看ulimit(通过终端类型):

You could try looking at ulimit (via Terminal type):

ulimit -a

具体来说,检查open files 的值.在我的机器 (OS X) 上,它报告 256.您可能想尝试将其增加到 512:

Specifically, check the value for open files. On my machine (OS X) it reports 256. You might want to try increasing it to 512:

ulimit -n 512

这篇关于os x 终端、ssh 和太多打开的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆