centos磁盘满导致传文件不上去,mysql连接数满

2018-12-03 23:49 阅读 2,532 views 次 centos磁盘满导致传文件不上去,mysql连接数满已关闭评论

/tmp 占用最多,达到8G。最开始就移动到另外一个硬盘比较好。

vi /etc/cron.daily/tmpwatch

将自动清理时间改短到2天。


mysql 日志文件很大,删除并禁止:

ls /usr/local/mysql/var -lh

如何删除mysql-bin.0000X 日志文件呢?

  1. [root@jiucool var]# /usr/local/mysql/bin/mysql -u root -p
  2. Enter password:  (输入密码)
  3. Welcome to the MySQL monitor.  Commands end with ; or /g.
  4. Your MySQL connection id is 264001
  5. Server version: 5.1.35-log Source distribution
  6. Type ‘help;’ or ‘/h’ for help. Type ‘/c’ to clear the current input statement.
  7. mysql> reset master; (清除日志文件)
  8. Query OK, 0 rows affected (8.51 sec)
  9. mysql>

复制代码

其实关键的命令就是reset master;这个命令会清空mysql-bin文件。

另外如果你的mysql服务器不需要做主从复制的话,建议通过修改my.cnf文件,来设置不生成这些文件,只要删除或者注释my.cnf中的下面一行就可以了。

log-bin=mysql-bin

-------------------------

把新硬盘xvdb1挂到tmp:

mkfs -t ext4 /dev/xvdb1
mkdir /gfdisk1
mount /dev/xvdb1 /gfdisk1
mkdir /gfdisk1/systmp
chmod 1777 /gfdisk1/systmp
cp -r /tmp/* /gfdisk1/systmp/; mount --bind /gfdisk1/systmp /tmp;/root/lnmp restart

vi /etc/fstab
/dev/xvdb1 /gfdisk1 ext4 defaults 0 0

vi /etc/rc.local
mount --bind /gfdisk1/systmp /tmp

------------定位方法:

df -hl

du -h --max-depth=1 /home/wwwroot

登陆mysql后
show processlist;

check if any mysql instance is running

ps -ef | grep mysql

if yes, you should stop it, or kill the process

kill -9 PID

1.进入Mysql数据库查看max_connection_errors: show variables like ‘%max_connection_errors%’;

2.修改max_connection_errors的数量为1000: set global max_connect_errors = 1000;
---------------------

[root@www ~]# vi /etc/my.cnf

找到max_connections一行,修改为(如果没有,则自己添加),

复制代码代码如下:
max_connections = 1000

query_cache_size=128M
query_cache_type=1

版权声明:本文著作权归原作者所有,欢迎分享本文,谢谢支持!
转载请注明:centos磁盘满导致传文件不上去,mysql连接数满 | 文档
分类:电脑技术 标签:

评论已关闭!