文章目录
  1. 1. centos运维memo
    1. 1.1. 分区使用率100%
    2. 1.2. inode用完了
    3. 1.3. Mysql无法重启
  2. 2. vi /etc/my.cnf
    1. 2.0.1. ntp无法同步

centos运维memo

分区使用率100%

1
2
3
4
5
[root@node tmp]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root 6.7G 6.6G 0 100% /
tmpfs 939M 0 939M 0% /dev/shm
/dev/vda1 485M 32M 428M 7% /boot

解决办法:

找出哪个文件夹最占硬盘,du -sh ./*

/目录下查询

1
2
3
4
5
[root@node /]# du -sh /*

1.7G /usr
3.7G /var
[root@node /]# cd /var

查询哪个目录层数最多
du -h --max-depth=1du

用于统计Linux中文件或目录所占磁盘空间的大小参数
-h:以K、M、G为单位查询结果
–max-depth=1其中,数字1是指查询结果中显示的目录才能使,智这里指最多显示一层目录

inode用完了

1
# df  -i

查看 inode用完了,磁盘无法创建心得内容了,这个是某些临时的小文件太多,

解决方法:

或者 卸载100%的分区

1
2
3
4
5
6
7



[root@node spool]# umount /
umount: /: device is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))


Mysql无法重启

查看 /var/log/mysqld.log

1
2
3
4
5
6
7
8
9
10
11
[root@node mygit]# tail /var/log/mysqld.log 
160517 4:32:49 InnoDB: Started; log sequence number 0 44233
160517 4:32:49 [ERROR] Can't start server: Bind on TCP/IP port: Address already in use
160517 4:32:49 [ERROR] Do you already have another mysqld server running on port: 3306 ?
160517 4:32:49 [ERROR] Aborting

160517 4:32:49 InnoDB: Starting shutdown...
160517 4:32:55 InnoDB: Shutdown completed; log sequence number 0 44233
160517 4:32:55 [Note] /usr/libexec/mysqld: Shutdown complete

160517 04:32:55 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

解决方法

  1. 查看端口
    1
    2
    [root@node mygit]# netstat -nltp|grep mysql
    tcp 0 0 127.1.244.130:3306 0.0.0.0:* LISTEN 15550/mysqld

端口被另一个mysqld占用??

  1. 修改默认端口

    vi /etc/my.cnf

1
2
3
4
5
6
7
[mysqld]
port=3307
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

如果仍无法重启,请查看日志

tail /var/log/mysqld.log

1
2
3
4
160517  4:44:28  InnoDB: Started; log sequence number 0 44233
160517 4:44:28 [ERROR] Can't start server: Bind on TCP/IP port: Permission denied
160517 4:44:28 [ERROR] Do you already have another mysqld server running on port: 3307 ?
160517 4:44:28 [ERROR] Aborting

setenforce 0暂时管理selinux,再重启mysqld。在setenforce 1

ntp无法同步

1
6 Sep 09:35:09 ntpdate[30210]: the NTP socket is in use, exiting

解决方法:

1
2
# .    /etc/init.d/ntpd  stop
# ntpdate 192.168.200.10

文章目录
  1. 1. centos运维memo
    1. 1.1. 分区使用率100%
    2. 1.2. inode用完了
    3. 1.3. Mysql无法重启
  2. 2. vi /etc/my.cnf
    1. 2.0.1. ntp无法同步