Linux随记(三十)
一、ambari 的 主机界面无法 “启动/停止/重启”所有组件 restart all componnents,呈禁用 灰色图标状态。
处理方法: 重启ambari-agent
#第一次重启报错ambari-agent restartecho$?cat/var/log/ambari-agent/ambari-agent.outnetstat-naltp|grep8670ps-ef|grep82051#/usr/bin/python2 /usr/lib/ambari-agent/lib/ambari_agent/main.py restart#杀相关进程,然后重启ambari-agentkill-1582051ambari-agent restart ambari-agent status二、单节点mysql8.0.46启动报错ERROR! The server quit without updating PID file (/data/mysql8/data/mysql.pid)
环境信息:bclinux euler 21.10 。 单节点mysql 8.0.44 需要升级到 8.0.46
#报错内容:[root@xx data]# service mysql restartERROR!MySQL server PIDfilecould not be found!Starting MySQL.Logging to'/data/mysql8/data/error.log'.........ERROR!The server quit without updating PIDfile(/data/mysql8/data/mysql.pid).[root@xx data]# cat /data/mysql8/data/error.log2026-04-28T08:26:43.505248Z0[Warning][MY-010918][Server]'default_authentication_plugin'is deprecated and will be removedina future release. Please use authentication_policy instead.2026-04-28T08:26:43.505322Z0[System][MY-010116][Server]/usr/local/mysql8/bin/mysqld(mysqld8.0.46)starting as process2333352026-04-28T08:26:43.510245Z0[Warning][MY-013242][Server]--character-set-server:'utf8'is currently analiasforthe charactersetUTF8MB3, but will be analiasforUTF8MB4ina future release. Please consider using UTF8MB4inorder to be unambiguous.2026-04-28T08:26:43.522394Z0[Warning][MY-013907][InnoDB]Deprecated configuration parameters innodb_log_file_size and/or innodb_log_files_in_group have been used to computeinnodb_redo_log_capacity=1073741824. Please use innodb_redo_log_capacity instead.2026-04-28T08:26:43.526947Z1[System][MY-013576][InnoDB]InnoDB initialization has started.2026-04-28T08:26:47.961943Z1[System][MY-013577][InnoDB]InnoDB initialization has ended. mysqld: File'/var/log/mysql/slow.log'not found(OS errno2- No suchfileor directory)2026-04-28T08:26:48.464211Z0[ERROR][MY-011263][Server]Could not use /var/log/mysql/slow.logforlogging(error2- No suchfileor directory). Turning logging offforthe server process. To turn it on again: fix the cause,theneither restart the query logging by using"SET GLOBAL SLOW_QUERY_LOG=ON"or restart the MySQL server.2026-04-28T08:26:48.661507Z0[Warning][MY-010068][Server]CA certificate ca.pem is self signed.2026-04-28T08:26:48.661591Z0[System][MY-013602][Server]Channel mysql_main configured to support TLS. Encrypted connections are now supportedforthis channel.2026-04-28T08:26:48.672853Z0[Warning][MY-011810][Server]Insecure configurationfor--pid-file: Location'/data'inthe path is accessible to all OS users. Consider choosing a different directory.2026-04-28T08:26:48.677931Z0[ERROR][MY-000067][Server]unknown variable'query_cache_type=0'.2026-04-28T08:26:48.678075Z0[ERROR][MY-010119][Server]Aborting2026-04-28T08:26:51.389974Z0[System][MY-010910][Server]/usr/local/mysql8/bin/mysqld: Shutdown complete(mysqld8.0.46)MySQL Community Server - GPL.[root@xx data]##处理方法:修改my.cnf 添加记录错误日志#202604 addlog-error=/data/mysql8/data/error.log pid-file=/data/mysql8/data/mysql.pid my.cnf注释弃用报错的配置行,再启动即可。#(MySQL5.X)查询缓存设置#query_cache_type=0#query_cache_size=0不过有点奇怪,之前升级到8.0.44的时候,印象是没改动my.cnf ,那时候为啥没报错呢。8.0.46此时就报错无法启动。操作过程:
#之前的/etc/my.cnf 配置信息:[root@xx data]# vi /etc/my.cnf[mysqld]# 设置3306端口port=3306#配置主服务器log-bin=mysql-bin server-id=1#202604 addlog-error=/data/mysql8/data/error.log pid-file=/data/mysql8/data/mysql.pid# 设置mysql的安装目录basedir=/usr/local/mysql8# 设置mysql数据库的数据存放目录datadir=/data/mysql8/data# 允许最大连接数#max_connections=200# 服务端使用的字符集默认为UTF8character-set-server=utf8# 创建新表时将使用的默认存储引擎default-storage-engine=INNODB# 认证方式(MySQL 8默认使用caching_sha2_password)default_authentication_plugin=mysql_native_password"/etc/my.cnf"56L, 1502C written[root@xx data]#[root@xx data]# service mysql restartERROR!MySQL server PIDfilecould not be found!Starting MySQL.Logging to'/data/mysql8/data/error.log'.........ERROR!The server quit without updating PIDfile(/data/mysql8/data/mysql.pid).[root@xx data]# cat /data/mysql8/data/error.log2026-04-28T08:26:43.505248Z0[Warning][MY-010918][Server]'default_authentication_plugin'is deprecated and will be removedina future release. Please use authentication_policy instead.2026-04-28T08:26:43.505322Z0[System][MY-010116][Server]/usr/local/mysql8/bin/mysqld(mysqld8.0.46)starting as process2333352026-04-28T08:26:43.510245Z0[Warning][MY-013242][Server]--character-set-server:'utf8'is currently analiasforthe charactersetUTF8MB3, but will be analiasforUTF8MB4ina future release. Please consider using UTF8MB4inorder to be unambiguous.2026-04-28T08:26:43.522394Z0[Warning][MY-013907][InnoDB]Deprecated configuration parameters innodb_log_file_size and/or innodb_log_files_in_group have been used to computeinnodb_redo_log_capacity=1073741824. Please use innodb_redo_log_capacity instead.2026-04-28T08:26:43.526947Z1[System][MY-013576][InnoDB]InnoDB initialization has started.2026-04-28T08:26:47.961943Z1[System][MY-013577][InnoDB]InnoDB initialization has ended. mysqld: File'/var/log/mysql/slow.log'not found(OS errno2- No suchfileor directory)2026-04-28T08:26:48.464211Z0[ERROR][MY-011263][Server]Could not use /var/log/mysql/slow.logforlogging(error2- No suchfileor directory). Turning logging offforthe server process. To turn it on again: fix the cause,theneither restart the query logging by using"SET GLOBAL SLOW_QUERY_LOG=ON"or restart the MySQL server.2026-04-28T08:26:48.661507Z0[Warning][MY-010068][Server]CA certificate ca.pem is self signed.2026-04-28T08:26:48.661591Z0[System][MY-013602][Server]Channel mysql_main configured to support TLS. Encrypted connections are now supportedforthis channel.2026-04-28T08:26:48.672853Z0[Warning][MY-011810][Server]Insecure configurationfor--pid-file: Location'/data'inthe path is accessible to all OS users. Consider choosing a different directory.2026-04-28T08:26:48.677931Z0[ERROR][MY-000067][Server]unknown variable'query_cache_type=0'.2026-04-28T08:26:48.678075Z0[ERROR][MY-010119][Server]Aborting2026-04-28T08:26:51.389974Z0[System][MY-010910][Server]/usr/local/mysql8/bin/mysqld: Shutdown complete(mysqld8.0.46)MySQL Community Server - GPL.[root@xx data]#[root@xx data]#[root@xx data]# mkdir -p /var/log/mysql[root@xx data]# chown mysql:mysql /var/log/mysql[root@xx data]# chmod 755 /var/log/mysql[root@xx data]##########根据报错内容 修改/etc/my.cnf[root@xx data]# vi /etc/my.cnf[mysqld]# 设置3306端口port=3306#配置主服务器log-bin=mysql-bin server-id=1#202604 addlog-error=/data/mysql8/data/error.log pid-file=/data/mysql8/data/mysql.pid# 设置mysql的安装目录basedir=/usr/local/mysql8# 设置mysql数据库的数据存放目录datadir=/data/mysql8/data# 允许最大连接数#max_connections=200# 服务端使用的字符集默认为UTF8character-set-server=utf8# 创建新表时将使用的默认存储引擎default-storage-engine=INNODB# 认证方式(MySQL 8默认使用caching_sha2_password)default_authentication_plugin=mysql_native_password#MySql性能调优相关配置示例(/etc/my.cnf)innodb_buffer_pool_size=10G#调整为物理内存的60%-80%innodb_log_file_size=512M#Redo日志文件大小max_connections=600#最大连接tmp_table_size=64M#内存临时表大小max_heap_table_size=64M#MEMORY表最大大小(影响临时表)sort_buffer_size=4M#排序操作缓存innodb_flush_log_at_trx_commit=1#事务提交时刷新日志策略,保留强一致性#(MySQL5.X)查询缓存设置#query_cache_type=0 #0=禁用查询缓存#query_cache_size=0#慢查询日志开启slow_query_log=1long_query_time=2slow_query_log_file=/var/log/mysql/slow.log"/etc/my.cnf"56L, 1504C written[root@xx data]#[root@xx data]# service mysql restartERROR!MySQL server PIDfilecould not be found!Starting MySQL....... SUCCESS![root@xx data]#[root@xx data]# service mysql statusSUCCESS!MySQL running(249273)[root@xx data]#[root@xx data]# ss -naltp | grep mysqlLISTEN070*:33060 *:* users:(("mysqld",pid=249273,fd=20))LISTEN0128*:3306 *:* users:(("mysqld",pid=249273,fd=23))[root@xx data]#[root@xx data]#[root@xx data]# ps -ef | grep mysqlroot2489331016:31 pts/0 00:00:00 /bin/sh /usr/local/mysql8/bin/mysqld_safe--datadir=/data/mysql8/data --pid-file=/data/mysql8/data/mysql.pid mysql249273248933416:31 pts/0 00:00:18 /usr/local/mysql8/bin/mysqld--basedir=/usr/local/mysql8--datadir=/data/mysql8/data --plugin-dir=/usr/local/mysql8/lib/plugin--user=mysql --log-error=/data/mysql8/data/error.log --pid-file=/data/mysql8/data/mysql.pid--port=3306root25426468896016:37 pts/0 00:00:00grep--color=auto mysql[root@xx data]#END
