免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 8535 | 回复: 2
打印 上一主题 下一主题

查看mysql连接监听端口的问题 [复制链接]

论坛徽章:
3
15-16赛季CBA联赛之辽宁
日期:2017-12-28 12:15:1015-16赛季CBA联赛之福建
日期:2017-12-28 12:26:5115-16赛季CBA联赛之新疆
日期:2018-03-07 15:09:17
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-07-27 13:46 |只看该作者 |倒序浏览
# netstat -n | grep -i wait | grep 3306

tcp        0      0    192.168.1.27:16748          192.168.1.27:3306           TIME_WAIT   
tcp        0      0    192.168.1.27:16759          192.168.1.27:3306           TIME_WAIT   
tcp        0      0    192.168.1.27:16762          192.168.1.27:3306           TIME_WAIT

   
tcp        0      0    192.168.1.27:3306           192.168.1.27:17056          TIME_WAIT   
tcp        0      0    192.168.1.27:3306           192.168.1.27:16801          TIME_WAIT   
tcp        0      0    192.168.1.27:3306           192.168.1.27:16803          TIME_WAIT   
tcp        0      0    192.168.1.27:3306           192.168.1.27:17085          TIME_WAIT   


如上面显示的结果,3306端口有时候出现在第四个域,有时候出现在第五个域
请问,这是正常的吗?

另外,我的系统中有很多TIME_WAIT,(300个以上),请问这是什么原因造成的?(sysctl.conf参数已改,mysql_close()代码正在查找,还有第三个原因吗?)


第三个问题。
mysql和php,apache位于同一台服务器,服务器有公网ip和局网ip。
有时候netstat -n | grep -i wait | grep 3306
能找到公网的连接,请问这是什么设置错误?

论坛徽章:
0
2 [报告]
发表于 2011-07-27 15:58 |只看该作者
这个没关系的吧

论坛徽章:
0
3 [报告]
发表于 2011-07-28 09:01 |只看该作者
本帖最后由 horizonhyg 于 2011-07-28 09:05 编辑

回复 1# XQKA


   
After a TCP connection has been closed, the state changes to TIME_WAIT. If I
recall correctly, this is a way to prevent the same port from being
immediately reused, and allow any duplicate packets from the previous
connection that might still be floating around the network time to expire.
In general, the presence of TIME_WAIT isn't something to be too concerned
about.

If you see a large number of these, it may be because your application is
opening a new database connection for each web server request.  You might be
able to save yourself a bit of overhead by refactoring your application to
use a database connection pool.


有公网IP就说明有用公网IP连接数据库的应用
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP