将mysql、ftp迁移到虚拟服务器上后,发现连接都变慢了。网上查原因,说是域名反向解析的问题,按此处理,果然成功。
1、mysql连接慢
关闭mysql的反向解析。找到mysql使用的配置文件my.cnf,可以通过如下命令查找my.cnf的位置:
[root@devdb usr]# mysql --help | grep 'Default options' -A 1
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf
修改my.cnf,在[mysqld]下增加下面一条:
[mysqld]
skip-name-resolve
重启mysql服务,再次连接,速度快起来了
2、vsftpd连接很慢
同样是域名反向解析问题,修改vsftpd的配置文件,一般在/etc/vsftpd下,修改vsftpd.conf,增加一条:
reverse_lookup_enable=NO
重启vsftpd,此时连接速度变快了