DBA面对新mysql环境
DBA面对新mysql环境
来源:http://blog.csdn.net/wyzxg/article/details/8491152
author:skate
time:2013/01/10
DBA面对新MySQL环境感悟
1.初识单个mysql服务器
2.初识生产环境mysql架构
3.初识cache层和mysql的关系
4.初识其他API(如消息队列)和mysql的关系
5.初识业务和mysql的关系
1.初识单个mysql服务器
1.1 一个全新的Mysql环境,要基本了解mysql版本、os平台、字符集等信息
mysql> status;
mysql Ver 14.12 Distrib 5.0.95, for redhat-Linux-gnu (x86_64) using readline 5.1
Connection id: 25
Current database: skate
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.5.24-log Source distribution
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: latin1
Conn. characterset: latin1
UNIX socket: /tmp/mysql.sock
Uptime: 12 days 13 min 7 sec
Threads: 3 Questions: 2100307 Slow queries: 0 Opens: 47 Flush tables: 1 Open tables: 39 Queries per second avg: 2.024
mysql>
1.2 了解mysql支持哪些存储引擎
mysql> show engines; | |||||
---|---|---|---|---|---|
Engine | Support | Comment | Transactions | XA | Savepoints |
InnoDB | DEFAULT | Percona-XtraDB, Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |
MyISAM | YES | MyISAM storage engine | NO | NO | NO |
CSV | YES | CSV storage engine | NO | NO | NO |
MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
6 rows in set (0.00 sec)
mysql>
1.3 了解mysql安装了哪些插件
mysql> show plugins; | ||||
---|---|---|---|---|
Name | Status | Type | Library | License |
binlog | ACTIVE | STORAGE ENGINE | NULL | GPL |
mysql_native_password | ACTIVE | AUTHENTICATION | NULL | GPL |
mysql_old_password | ACTIVE | AUTHENTICATION | NULL | GPL |
MEMORY | ACTIVE | STORAGE ENGINE | NULL | GPL |
MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
CSV | ACTIVE | STORAGE ENGINE | NULL | GPL |
MRG_MYISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
InnoDB | ACTIVE | STORAGE ENGINE | NULL | GPL |
......
......
| PERFORMANCE_SCHEMA | ACTIVE | STORAGE ENGINE | NULL | GPL |
| partition | ACTIVE | STORAGE ENGINE | NULL | GPL |
| rpl_semi_sync_slave | ACTIVE | REPLICATION | semisync_slave.so | GPL |
rpl_semi_sync_master | ACTIVE | REPLICATION | semisync_master.so | GPL |
---|
34 rows in set (0.00 sec)
mysql>
1.4 了解mysql是单机还是ndb集群
mysql> show variables like 'have_ndbcluster'; | |
---|---|
Variable_name | Value |
have_ndbcluster | NO |
1 row in set (0.00 sec)
mysql>
1.5 了解是否配置REPLICATION
mysql> show slave status\G;
mysql> show master status\G;
1.6 查看Mysql的日志模式
mysql> show variables like 'log%'; | |
---|---|
Variable_name | Value |
log | OFF |
log_bin | ON |
log_bin_trust_function_creators | OFF |
log_error | /data/mysql/usr/local/mysql/data/localhost.err |
log_output | FILE |
log_queries_not_using_indexes | OFF |
log_slave_updates | OFF |
log_slow_admin_statements | OFF |
log_slow_filter | |
log_slow_queries | OFF |
log_slow_rate_limit | 1 |
log_slow_rate_type | session |
log_slow_slave_statements | OFF |
log_slow_sp_statements | ON |
log_slow_verbosity | |
log_warnings | 1 |
log_warnings_suppress |
17 rows in set (0.00 sec)
mysql>
1.7 查看Mysql当前有哪些触发器和存储过程
mysql> show triggers;
mysql> show procedure status;
mysql> select TABLE_NAME from information_schema.PARTITIONS where PARTITION_NAME is not null;
1.8 有多少用户拥有超级权限,是否有密码为空(ROOT密码默认为空),密码为空马上处理
mysql> select * from information_schema.USER_PRIVILEGES where PRIVILEGE_TYPE='SUPER'; | |||
---|---|---|---|
GRANTEE | TABLE_CATALOG | PRIVILEGE_TYPE | IS_GRANTABLE |
'root'@'localhost' | def | SUPER | YES |
'root'@'127.0.0.1' | def | SUPER | YES |
'root'@'::1' | def | SUPER | YES |
'rep'@'%' | def | SUPER | NO |
'root'@'%' | def | SUPER | NO |
'skate'@'%' | def | SUPER | NO |
6 rows in set (0.02 sec)
mysql> select host,user,password from mysql.user where password=''; | ||
---|---|---|
host | user | password |
127.0.0.1 | root | |
::1 | root | |
localhost |
3 rows in set (0.00 sec)
mysql>
1.9 查看数据的存放目录
mysql> show variables like '%datadir%'; | |
---|---|
Variable_name | Value |
datadir | /data/mysql/usr/local/mysql/data/ |
1 row in set (0.00 sec)
mysql>
1.10 查看重要的内存参数
innodb_buffer_pool_size
innodb_log_file_size
innodb_log_buffer_size
innodb_log_files_in_group
max_connections
innodb_flush_log_trx_commit
innodb_max_dirty_pages_pct
innodb_flush_method
sync-binlog
1.11 执行一会show processlist,看看Mysql能有多少并发,一般都是什么sql。
1.12 更进一步,Mysql的备份方法和策略是什么?网络环境的配置是如何的?
1.13 跑几个性能分析报告,看看最近系统的运行状态如何,例如用mysqlreport。
os相关信息:
1.14 查看机器型号
dmidecode |grep "Product Name"
1.15 查看cpu型号,及逻辑cpu数量
cat /proc/cpuinfo |grep name| cut -f2 -d: |uniq -c
1.16 查看内存大小,存储大小
free,df
相关命令:
mysql> status;
mysql> show engines;
mysql> show plugins;
mysql> show variables like 'have_ndbcluster';
mysql> show slave status\G;
mysql> show master status\G;
mysql> show triggers;
mysql> show procedure status;
mysql> select * from information_schema.USER_PRIVILEGES where PRIVILEGE_TYPE='SUPER';
mysql> select host,user,password from mysql.user where password='';
mysql> show variables like '%datadir%';
mysql> show processlist
dmidecode |grep "Product Name"
cat /proc/cpuinfo |grep name| cut -f2 -d: |uniq -c
2.初识生产环境mysql架构
mysql单机环境通过个人就可以大概了解数据库的基本信息,如果数据库环境比较复杂,如下相关问题就要咨询相关同学,如果有
文档最好。
数据库如何横向、纵向的拆分
每个集群的容灾方式如何
是否有故障隔离
是否有优雅降级
数据库层是如何自我保护的
监控框架如何
备份框架如何
安全体系如何
3.初识cache层和mysql的关系
cache主要用于承载数据库存储层的大部分io,那我们就要对cache有一定的了解
那cache层和数据库存储层是什么关系?是应用来保证cache层数据库新鲜?还是数据库主动更新cache层数据?
cache层是用什么软件实现的?
cache层失效之后的数据预热是否对数据库存储层有冲击
4.初识其他API(如消息队列)和mysql的关系
不同的mysql之间(或mysql和其他组件之间)可能需要数据同步传输,这些依赖关系我们要了解。mysql之间的同步是通过什么技术?
5.初识业务和mysql的关系
数据库的存在的意义就是为不同的业务提供服务,所以要更好的了解数据库,就要了解业务和不同数据库的关系,从下到上,再从上到下,这样才能更好的做好数据库管理工作。
评论已关闭