【Linux】Tomcat与MySQL服务自动shutdown

  1. 云栖社区>
  2. 博客>
  3. 正文

【Linux】Tomcat与MySQL服务自动shutdown

awesome@qa 2018-04-09 20:07:47 浏览923
展开阅读全文

问题现象一:先启动Tomcat,再启动MySQL,Tomcat服务自动shutdown

问题现象二:先启动MySQL,再启动Tomcat,MySQL服务自动shutdown


报错如下:

[root@iz2ze2q8e0xhao9pcnm0qxz apache-tomcat-7.0.82]# /usr/local/mysql/bin/mysqld_safe
180409 18:28:41 mysqld_safe Logging to '/usr/local/mysql/data/iz2ze2q8e0xhao9pcnm0qxz.err'.
180409 18:28:41 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
/usr/local/mysql/bin/mysqld_safe: 行 183:   582 已杀死   nohup /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=iz2ze2q8e0xhao9pcnm0qxz.err --pid-file=iz2ze2q8e0xhao9pcnm0qxz.pid < /dev/null > /dev/null 2>&1

解决方法:在my.cnf中增加内存配置,可以完美解决问题
key_buffer=16K
table_open_cache=4
query_cache_limit=256K
query_cache_size=4M
max_allowed_packet=1M
sort_buffer_size=64K
read_buffer_size=256K
thread_stack=64K
innodb_buffer_pool_size = 56M

PS:购买的Ali ECS 1G内存的云主机,因为内存太小,服务彼此竞争资源而导致的。


网友评论

登录后评论
0/500
评论
awesome@qa
+ 关注