4.52-55 php-fpm配置

4.56 mariadb密码重置

4.57 MariaDB慢查询日志

一、php-fpm配置

Nginx可以配置多个虚拟主机,php-fpm配置文件php-fpm.conf可以设置多个pool,每个pool可以监听一个端口,在其中一个pool资源耗尽,会导致其他站点无法访问资源,报502错误。有必要把站点进行分离,分别使用单独的pool

在php-fpm配置文件中添加一个ying.com的池子

保障训练-20200915

检查语法,并重启php-fpm

保障训练-20200915

查看进程,此时 有两个池子,其中一个就是ying.com

保障训练-20200915

虚拟主机里面设置

保障训练-20200915

创建 www.conf 配置文件,就相当于之前的www池子

保障训练-20200915

创建 ying.com.conf 配置文件,就相当于之前的一个池子

保障训练-20200915

查看php-fpm.conf内容,只有三行,其余的两个池子,被分成两个文件

保障训练-20200915

检查语法,并重启服务

保障训练-20200915

在查看进程,同样有两个池子

保障训练-20200915

二、mariadb密码重置

如果记得root密码:

mysqladmin -uroot -paminglinux password “aming-linux”

如果不记得root密码:

1.编辑/etc/my.cnf

增加:skip-grant

重启服务

2.登陆进mariadb,执行

use mysql 切换到mysql库

desc user 查看user表的所有字段

update user set authentication_string=password(“aming-linux”) where user=‘root’;

3.退出mariadb,删除/etc/my.cnf里面的skip-grant,重启服务

4.用新密码登陆即可

常识:

mysql在5.7.36版本之后把密码字段存到了authentication_string字段里,在之前的版本存在password字段里

update user set password=password(“aming-linux”) where user=‘root’;

三、MariaDB慢查询日志

为什么要配置慢查询日志?

为了帮助我们分析mariadb的瓶颈点

如何配置:

1.进入mariadb里面执行:

show variables like ‘slow%’;

show variables like ‘datadir’;

show variables like ‘long%’;

2.打开配置文件/etc/my.cnf,编辑,增加:

slow_query_log = ON

slow_query_log_file = /data/mysql/aminglinux01-slow.log

slow_query_time = 2

3.重启服务

4.模拟慢查询

select sleep(5);

5.查看慢查询日志:

cat /data/mysql/aminglinux01-slow.log

扩展:

show processlist;

show full processlist;

mysql -uroot -pxxxx -e “show processlist”

相关文章:

  • 2022-01-05
  • 2021-07-09
  • 2021-09-18
  • 2021-09-04
  • 2021-05-27
  • 2021-09-07
  • 2021-07-05
  • 2021-12-23
猜你喜欢
  • 2021-05-06
  • 2022-01-17
  • 2021-11-15
  • 2022-01-16
  • 2021-06-26
  • 2021-05-14
  • 2021-12-19
相关资源
相似解决方案